Alfred-Emoj 开源项目教程

Alfred-Emoj 开源项目教程

alfred-emojAlfred 3 workflow to find relevant emoji from text项目地址:https://gitcode.com/gh_mirrors/al/alfred-emoj

1. 项目的目录结构及介绍

Alfred-Emoj 项目的目录结构相对简单,主要包含以下几个部分:

alfred-emoj/
├── node_modules/
├── icons/
├── .editorconfig
├── .gitignore
├── .npmrc
├── .prettierrc
├── emoji.json
├── info.plist
├── index.js
├── package.json
├── readme.md
└── yarn.lock
  • node_modules/: 存放项目依赖的 Node.js 模块。
  • icons/: 存放项目使用的图标文件。
  • emoji.json: 包含所有表情符号的数据文件。
  • info.plist: Alfred Workflow 的配置文件。
  • index.js: 项目的主入口文件。
  • package.json: 项目的配置文件,包含依赖、脚本等信息。
  • readme.md: 项目的说明文档。

2. 项目的启动文件介绍

项目的启动文件是 index.js,它是 Alfred Workflow 的主要逻辑文件。以下是 index.js 的主要内容:

const alfy = require('alfy');
const emojis = require('./emoji.json');

const input = alfy.input.toLowerCase();

const items = emojis
	.filter(emoji => emoji.keywords.some(keyword => keyword.includes(input)))
	.map(emoji => ({
		title: emoji.char,
		subtitle: emoji.description,
		arg: emoji.char,
		icon: {
			path: `icons/${emoji.group}.png`
		}
	}));

alfy.output(items);
  • alfy: 一个用于创建 Alfred Workflow 的 Node.js 库。
  • emoji.json: 包含所有表情符号的数据文件。
  • input: 用户输入的查询字符串。
  • items: 根据用户输入过滤并生成的表情符号列表。
  • alfy.output(items): 将生成的表情符号列表输出到 Alfred。

3. 项目的配置文件介绍

项目的配置文件主要包括 package.jsoninfo.plist

package.json

package.json 文件包含了项目的元数据和依赖信息:

{
  "name": "alfred-emoj",
  "version": "1.0.0",
  "description": "Emoji search workflow for Alfred",
  "main": "index.js",
  "scripts": {
    "postinstall": "alfy-init",
    "preuninstall": "alfy-cleanup"
  },
  "author": "Sindre Sorhus",
  "license": "MIT",
  "dependencies": {
    "alfy": "^0.10.0"
  }
}
  • name: 项目的名称。
  • version: 项目的版本号。
  • description: 项目的描述。
  • main: 项目的主入口文件。
  • scripts: 包含项目的脚本命令。
  • dependencies: 项目的依赖模块。

info.plist

info.plist 文件是 Alfred Workflow 的配置文件,包含了 Workflow 的各种设置和参数:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>bundleid</key>
	<string>com.sindresorhus.emoj</string>
	<key>connections</key>
	<dict>
		<key>0</key>
		<dict>
			<key>destinationuid</key>
			<string>1</string>
			<key>modifiers</key>
			<integer>0</integer>
			<key>modifiersubtext</key>
			<string></string>
		</dict>
	</dict>
	<key>createdby</key>
	<string>Sindre Sorhus</string>
	<key>description</key>
	<string>Find relevant emoji from a keyword</string>
	<key>disabled</key>
	<false/>
	<key

alfred-emojAlfred 3 workflow to find relevant emoji from text项目地址:https://gitcode.com/gh_mirrors/al/alfred-emoj

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

石淞畅Oprah

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值