Skip to content

Commit

Permalink
feat: initial commit ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Mar 20, 2024
1 parent bef4c97 commit b70b9c2
Show file tree
Hide file tree
Showing 26 changed files with 574 additions and 1,033 deletions.
10 changes: 0 additions & 10 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
"plugin:n/recommended",
"plugin:perfectionist/recommended-natural",
"plugin:regexp/recommended",
"plugin:vitest/recommended",
],
ignorePatterns: ["!.*", "coverage", "lib", "node_modules", "pnpm-lock.yaml"],
overrides: [
Expand Down Expand Up @@ -91,14 +90,6 @@ module.exports = {
parser: "jsonc-eslint-parser",
plugins: ["package-json"],
},
{
files: "**/*.test.ts",
rules: {
// These on-by-default rules aren't useful in test files.
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
},
},
{
extends: ["plugin:yml/standard", "plugin:yml/prettier"],
files: ["**/*.{yml,yaml}"],
Expand Down Expand Up @@ -129,7 +120,6 @@ module.exports = {
"jsdoc",
"perfectionist",
"regexp",
"vitest",
],
reportUnusedDisableDirectives: true,
root: true,
Expand Down
33 changes: 6 additions & 27 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ pnpm install
## Building

Run [**tsup**](https://tsup.egoist.dev) locally to build source files from `src/` into output files in `lib/`:
This project doesn't use the TypeScript compiler or other transpilers to turn TypeScript syntax into JavaScript.
The `lib/data` directory, including `lib/data/index.mjs` and its sibling `*.json` files, is populated by the script at `src/buildData.ts`.
Run source code with [tsx](https://github.com/privatenumber/tsx) to manually generate files under the `lib/` directory:

```shell
pnpm build
npm run build
```

Add `--watch` to run the builder in a watch mode that continuously cleans and recreates `lib/` as you save files:
To continuously build in watch mode, run:

```shell
pnpm build --watch
npx tsx --watch src/buildData.ts
```

## Formatting
Expand Down Expand Up @@ -57,29 +59,6 @@ pnpm run lint --fix

Note that you'll likely need to run `pnpm build` before `pnpm lint` so that lint rules which check the file system can pick up on any built files.

## Testing

[Vitest](https://vitest.dev) is used for tests.
You can run it locally on the command-line:

```shell
pnpm run test
```

Add the `--coverage` flag to compute test coverage and place reports in the `coverage/` directory:

```shell
pnpm run test --coverage
```

Note that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.
Calls to `console.log`, `console.warn`, and other console methods will cause a test to fail.

### Debugging Tests

This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).

## Type Checking

You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build
- run: node ./lib/index.js
- run: node ./lib/index.mjs

name: Build

Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coverage/
lib/
node_modules/
lib/
16 changes: 0 additions & 16 deletions .vscode/launch.json

This file was deleted.

29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- prettier-ignore-end -->
<a href="https://github.com/JoshuaKGoldberg/emoji-platform-data/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
<a href="https://codecov.io/gh/JoshuaKGoldberg/emoji-platform-data" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/JoshuaKGoldberg/emoji-platform-data?label=%F0%9F%A7%AA%20coverage" /></a>
<a href="https://github.com/JoshuaKGoldberg/emoji-platform-data/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg"></a>
<a href="http://npmjs.com/package/emoji-platform-data"><img alt="📦 npm version" src="https://img.shields.io/npm/v/emoji-platform-data?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
Expand All @@ -22,11 +21,35 @@ npm i emoji-platform-data
```

```ts
import { greet } from "emoji-platform-data";
import { byTitle } from "emoji-platform-data";

greet("Hello, world! 💖");
console.log(byTitle["Sparkling Heart"]);
/*
{
emoji: "💖",
emojipedia: { "currentCldrName": "Sparkling Heart", ... },
fluemoji: { "cldr": "sparkling heart", ... },
gemoji: { "description": "sparkling heart", ... },
twemoji: { "description": "Sparkling heart", ... },
...
}
*/
```

`emoji-platform-data` combines emoji data from the following projects:

- [Emojipedia](https://github.com/JoshuaKGoldberg/emojipedia)
- [Fluent UI / Windows](https://github.com/microsoft/fluentui-emoji) ("fluemoji")
- [Gemoji](https://github.com/wooorm/gemoji)
- [Twemoji](https://raw.githubusercontent.com/twitter/twemoji-parser)

Each emoji supported in at least one of those projects is stored by its emoji glyph and Emojipedia title.

## Why?

This is useful if you're looking to see the metadata supported for emojis in each of those platforms.
For example, if you wanted to [determine the keywords associated with any emoji](https://github.com/muan/emojilib/issues/194), this would let you know accumulate all the keywords across the supported platforms.

## Contributors

<!-- spellchecker: disable -->
Expand Down
10 changes: 9 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@
"node_modules",
"pnpm-lock.yaml"
],
"words": ["knip", "packagejson", "tsup"]
"words": [
"cldr",
"emojipedia",
"fluemoji",
"gemoji",
"knip",
"packagejson",
"skintones"
]
}
3 changes: 2 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://unpkg.com/knip@latest/schema.json",
"entry": ["src/index.ts!"],
"entry": ["src/index.ts!", "src/types.ts!"],
"ignoreDependencies": ["fluemoji", "twemoji-parser"],
"ignoreExportsUsedInFile": { "interface": true, "type": true },
"project": ["src/**/*.ts!"]
}
26 changes: 18 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,44 @@
"repository": "JoshuaKGoldberg/emoji-platform-data",
"license": "MIT",
"author": {
"name": "Josh Goldberg",
"email": "[email protected]"
},
"type": "module",
"main": "./lib/index.js",
"exports": {
".": "./lib/index.mjs",
"./by-emoji.json": "./lib/by-emoji.json",
"./by-title.json": "./lib/by-title.json"
},
"files": [
"lib/",
"package.json",
"LICENSE.md",
"README.md"
],
"scripts": {
"build": "tsup",
"build": "tsx src/buildData.ts",
"format": "prettier .",
"lint": "eslint . .*js --max-warnings 0",
"lint:knip": "knip",
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
"lint:packages": "pnpm dedupe --check",
"lint:spelling": "cspell \"**\" \".github/**/*\"",
"prepare": "husky install",
"test": "vitest",
"tsc": "tsc"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write"
},
"dependencies": {
"emojipedia": "^0.3.0"
},
"devDependencies": {
"@release-it/conventional-changelog": "^8.0.1",
"@types/eslint": "^8.56.6",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitest/coverage-v8": "^1.4.0",
"console-fail-test": "^0.2.3",
"change-case": "^5.4.3",
"cspell": "^8.6.0",
"eslint": "^8.57.0",
"eslint-plugin-deprecation": "^2.0.0",
Expand All @@ -48,8 +54,10 @@
"eslint-plugin-package-json": "^0.10.4",
"eslint-plugin-perfectionist": "^2.7.0",
"eslint-plugin-regexp": "^2.3.0",
"eslint-plugin-vitest": "^0.3.26",
"eslint-plugin-yml": "^1.13.1",
"fast-glob": "^3.3.2",
"fluemoji": "git+https://github.com/microsoft/fluentui-emoji.git",
"gemoji": "^8.1.0",
"husky": "^9.0.11",
"jsonc-eslint-parser": "^2.4.0",
"knip": "^5.1.2",
Expand All @@ -61,9 +69,11 @@
"prettier-plugin-packagejson": "^2.4.12",
"release-it": "^17.1.1",
"sentences-per-line": "^0.2.1",
"tsup": "^8.0.2",
"title-case": "^4.3.1",
"tsx": "^4.7.1",
"twemoji-parser": "git+https://github.com/twitter/twemoji-parser.git",
"typescript": "^5.4.2",
"vitest": "^1.4.0",
"yaml": "^2.4.1",
"yaml-eslint-parser": "^1.2.2"
},
"packageManager": "[email protected]",
Expand Down
Loading

0 comments on commit b70b9c2

Please sign in to comment.