Skip to content

Commit

Permalink
internal: Migrate from beemo to moon. (#144)
Browse files Browse the repository at this point in the history
* Remove beemo.

* Migrate typescript.

* Migrate jest/babel.

* Migrate eslint.

* Run prettier.

* Rework react.

* Drop node 12.
  • Loading branch information
milesj authored Sep 27, 2022
1 parent 49fe5f9 commit 0607d6e
Show file tree
Hide file tree
Showing 45 changed files with 2,443 additions and 2,727 deletions.
37 changes: 0 additions & 37 deletions .config/beemo.ts

This file was deleted.

13 changes: 0 additions & 13 deletions .config/beemo/eslint.ts

This file was deleted.

9 changes: 0 additions & 9 deletions .config/beemo/prettier.ts

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules/
build/
cjs/
coverage/
dist/
dts/
esm/
lib/
mjs/
umd/
*.min.js
*.map
*.snap
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
root: true,
extends: ['moon', 'moon/node'],
parserOptions: {
project: 'tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
rules: {
// All of the emoji mappings use numbers
'no-magic-numbers': 'off',
},
};
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 14, 16]
node-version: [14, 16]
fail-fast: true
steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ node_modules/
*.mo

# Configs
.babelrc
.eslintignore
/.eslintrc.js
.flowconfig
.prettierignore
babel.config.js
jest.config.js
prettier.config.js
webpack.config.js
*.tsbuildinfo

Expand Down
39 changes: 0 additions & 39 deletions .npmignore

This file was deleted.

20 changes: 20 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
node_modules/
build/
cjs/
coverage/
dist/
dts/
esm/
lib/
mjs/
umd/
CHANGELOG.md

.yarn
*.d.ts

cache/**/*.json
packages/data/**/*.json
packages/generator/src/resources/*.ts
packages/test-utils/*.json
website/.docusaurus
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['moon'],
};
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'jest-preset-moon',
testEnvironment: 'jsdom',
};
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,46 @@
"private": true,
"version": "0.0.0",
"scripts": {
"prepare": "beemo create-config",
"build": "packemon build --addEngines",
"pack": "NODE_ENV=production packemon pack --addEngines --declaration=standard",
"clean": "packemon clean",
"clean:cache": "rm -rf ./cache",
"check": "yarn run type && yarn run test && yarn run lint",
"coverage": "yarn run jest --coverage",
"docs": "cd website && yarn run start",
"lint": "beemo eslint",
"lint": "eslint --cache --color --fix --ext .ts,.tsx ./packages/*/{src,tests} ./website/src",
"generate": "yarn run generate:emojis && yarn run generate:shortcodes && node ./bin/buildFilesizeTable.mjs && yarn run generate:tests",
"generate:emojis": "rm -rf ./cache/final && node ./bin/generateEmoji.mjs",
"generate:po": "node ./bin/generatePo.mjs",
"generate:shortcodes": "node ./bin/generateShortcodes.mjs",
"generate:tests": "cp ./packages/data/en/data.json ./packages/test-utils/test-data.json && cp ./packages/data/en/shortcodes/emojibase.json ./packages/test-utils/test-shortcodes.json && cp ./packages/data/en/messages.json ./packages/test-utils/test-messages.json",
"generate:types": "node ./bin/generateTypes.mjs",
"test": "beemo jest",
"format": "beemo prettier",
"test": "jest --colors --logHeapUsage",
"format": "prettier --write .",
"prerelease": "yarn run clean && yarn run pack && yarn run check",
"release": "yarn prerelease && lerna publish --ignore-changes=emojibase-generator",
"type": "beemo typescript --build"
"type": "tsc --build"
},
"engines": {
"node": ">=12.17.0"
},
"devDependencies": {
"@beemo/cli": "^2.0.6",
"@beemo/core": "^2.1.4",
"@beemo/dev": "^1.7.8",
"@types/jest": "^29.0.3",
"babel-preset-moon": "^1.0.2",
"eslint": "^8.24.0",
"eslint-config-moon": "^1.0.2",
"fetch-mock-jest": "^1.5.1",
"filesize": "^8.0.7",
"glob": "^7.2.0",
"gzip-size": "^7.0.0",
"jest": "^29.0.3",
"jest-preset-moon": "^1.0.2",
"lerna": "^4.0.0",
"packemon": "^1.14.0",
"typescript": "^4.6.2"
"prettier": "^2.7.1",
"prettier-config-moon": "^1.0.1",
"tsconfig-moon": "^1.0.1",
"typescript": "^4.8.3"
},
"workspaces": [
"packages/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['beemo/browser'],
extends: ['moon/browser'],
rules: {
// Overloads
'no-redeclare': 'off',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/joinShortcodesToEmoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function joinShortcodesToEmoji(
}
});

// eslint-disable-next-line no-param-reassign
emoji.shortcodes = [...list];

if (emoji.skins) {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/tests/fetchEmojis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getCompactEmojiWithSkins, getEmojiWithSkins, setupStorage } from './hel

describe('fetchEmojis()', () => {
// Testing overloads
// @ts-expect-error Allow unused
function testOverloads() {
const e1 = fetchEmojis('en', { compact: true, flat: true });
const e2 = fetchEmojis('en', { compact: true, flat: false });
Expand All @@ -16,6 +17,8 @@ describe('fetchEmojis()', () => {
const e7 = fetchEmojis('en', { flat: true });
const e8 = fetchEmojis('en', { shortcodes: ['cldr'] });
const e9 = fetchEmojis('en');

return [e1, e2, e3, e4, e5, e6, e7, e8, e9];
}

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"path": ".."
}
]
}
}
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"../../types/**/*"
],
"references": []
}
}
6 changes: 6 additions & 0 deletions packages/generator/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
rules: {
// Code generation
'no-param-reassign': 'off',
},
};
4 changes: 1 addition & 3 deletions packages/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@types/node-fetch": "^2.6.1",
"chalk": "^5.0.0",
"cheerio": "^1.0.0-rc.10",
"emojibase": "workspace:*",
"fs-extra": "^10.0.1",
"kuroshiro": "^1.2.0",
"kuroshiro-analyzer-kuromoji": "^1.1.0",
Expand All @@ -37,9 +38,6 @@
"regexgen": "^1.3.0",
"transliteration": "^2.2.0"
},
"devDependencies": {
"emojibase": "^6.1.0"
},
"packemon": {
"platform": "node"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/generators/generateData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function createEmoji(
emoji.skins = Object.values(baseEmoji.modifications!).map((mod) => {
const skin = createEmoji(mod, versions, annotations);

skin.label = (annotations[stripHexcode(skin.hexcode)] || {}).annotation || emoji.label || '';
skin.label = annotations[stripHexcode(skin.hexcode)]?.annotation || emoji.label || '';

// Remove any tags
delete skin.tags;
Expand Down
7 changes: 6 additions & 1 deletion packages/generator/src/parsers/verifyTotals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { log } from '../helpers/log';
import { ParsedTotals } from '../types';

export function verifyTotals<T>(type: string, version: string, data: T, totals: ParsedTotals): T {
export function verifyTotals<T extends object>(
type: string,
version: string,
data: T,
totals: ParsedTotals,
): T {
// v1.0 doesnt have totals
if (version === '1.0') {
return data;
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"path": "../core"
}
]
}
}
3 changes: 2 additions & 1 deletion packages/regex/codepoint/emoji-loose.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/regex/codepoint/emoji.js

Large diffs are not rendered by default.

Loading

0 comments on commit 0607d6e

Please sign in to comment.