From 1d3fd3eb749c9fd4da688af76567558c27dfaa9c Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Sun, 16 Jun 2019 11:17:34 -0700 Subject: [PATCH] Use ts-node --- .svgrrc.js | 10 ++ package.json | 14 +- .../{copyUsedEmojis.js => copyUsedEmojis.ts} | 17 ++- scripts/generateContentsBundle.js | 84 ----------- scripts/generateContentsBundle.ts | 70 +++++++++ ...mojisBundle.js => generateEmojisBundle.ts} | 35 ++--- scripts/tsconfig.json | 3 + src/components/Content.tsx | 4 +- .../Twemoji/{1f170.js => 1f170.tsx} | 4 +- .../Twemoji/{1f171.js => 1f171.tsx} | 4 +- .../Twemoji/{1f193.js => 1f193.tsx} | 4 +- .../Twemoji/{1f195.js => 1f195.tsx} | 4 +- .../Twemoji/{1f197.js => 1f197.tsx} | 4 +- .../Twemoji/{1f19a.js => 1f19a.tsx} | 4 +- .../{1f1fa-1f1f8.js => 1f1fa-1f1f8.tsx} | 4 +- .../Twemoji/{1f32d.js => 1f32d.tsx} | 4 +- .../Twemoji/{1f33d.js => 1f33d.tsx} | 4 +- .../Twemoji/{1f346.js => 1f346.tsx} | 4 +- .../Twemoji/{1f347.js => 1f347.tsx} | 4 +- .../Twemoji/{1f34a.js => 1f34a.tsx} | 4 +- .../Twemoji/{1f34e.js => 1f34e.tsx} | 4 +- .../Twemoji/{1f354.js => 1f354.tsx} | 4 +- .../Twemoji/{1f355.js => 1f355.tsx} | 4 +- .../Twemoji/{1f357.js => 1f357.tsx} | 4 +- .../Twemoji/{1f35b.js => 1f35b.tsx} | 4 +- .../Twemoji/{1f35d.js => 1f35d.tsx} | 4 +- .../Twemoji/{1f35e.js => 1f35e.tsx} | 4 +- .../Twemoji/{1f35f.js => 1f35f.tsx} | 4 +- .../Twemoji/{1f363.js => 1f363.tsx} | 4 +- .../Twemoji/{1f369.js => 1f369.tsx} | 4 +- .../Twemoji/{1f36a.js => 1f36a.tsx} | 4 +- .../Twemoji/{1f36b.js => 1f36b.tsx} | 4 +- .../Twemoji/{1f36c.js => 1f36c.tsx} | 4 +- .../Twemoji/{1f370.js => 1f370.tsx} | 4 +- .../Twemoji/{1f371.js => 1f371.tsx} | 4 +- .../Twemoji/{1f37f.js => 1f37f.tsx} | 4 +- .../Twemoji/{1f389.js => 1f389.tsx} | 4 +- .../Twemoji/{1f3a4.js => 1f3a4.tsx} | 4 +- .../Twemoji/{1f3b6.js => 1f3b6.tsx} | 4 +- .../Twemoji/{1f3c1.js => 1f3c1.tsx} | 4 +- .../Twemoji/{1f40d.js => 1f40d.tsx} | 4 +- .../Twemoji/{1f44d.js => 1f44d.tsx} | 4 +- .../Twemoji/{1f44e.js => 1f44e.tsx} | 4 +- .../Twemoji/{1f454.js => 1f454.tsx} | 4 +- ...0d-1f4bb.js => 1f468-1f3fb-200d-1f4bb.tsx} | 4 +- .../{1f469-1f3fb.js => 1f469-1f3fb.tsx} | 4 +- .../{1f469-1f3fd.js => 1f469-1f3fd.tsx} | 4 +- .../Twemoji/{1f4a1.js => 1f4a1.tsx} | 4 +- .../Twemoji/{1f4a5.js => 1f4a5.tsx} | 4 +- .../Twemoji/{1f4aa.js => 1f4aa.tsx} | 4 +- .../Twemoji/{1f4ad.js => 1f4ad.tsx} | 4 +- .../Twemoji/{1f4bb.js => 1f4bb.tsx} | 4 +- .../Twemoji/{1f4d5.js => 1f4d5.tsx} | 4 +- .../Twemoji/{1f4d7.js => 1f4d7.tsx} | 4 +- .../Twemoji/{1f4d8.js => 1f4d8.tsx} | 4 +- .../Twemoji/{1f4d9.js => 1f4d9.tsx} | 4 +- .../Twemoji/{1f4dd.js => 1f4dd.tsx} | 4 +- .../Twemoji/{1f4f1.js => 1f4f1.tsx} | 4 +- .../Twemoji/{1f4f7.js => 1f4f7.tsx} | 4 +- .../Twemoji/{1f4fc.js => 1f4fc.tsx} | 4 +- .../Twemoji/{1f501.js => 1f501.tsx} | 4 +- .../Twemoji/{1f50e.js => 1f50e.tsx} | 4 +- .../Twemoji/{1f520.js => 1f520.tsx} | 4 +- .../Twemoji/{1f522.js => 1f522.tsx} | 4 +- .../Twemoji/{1f53d.js => 1f53d.tsx} | 4 +- .../Twemoji/{1f5fa.js => 1f5fa.tsx} | 4 +- .../Twemoji/{1f604.js => 1f604.tsx} | 4 +- .../Twemoji/{1f605.js => 1f605.tsx} | 4 +- .../Twemoji/{1f609.js => 1f609.tsx} | 4 +- .../Twemoji/{1f60b.js => 1f60b.tsx} | 4 +- .../Twemoji/{1f60d.js => 1f60d.tsx} | 4 +- .../Twemoji/{1f60e.js => 1f60e.tsx} | 4 +- .../Twemoji/{1f60f.js => 1f60f.tsx} | 4 +- .../Twemoji/{1f621.js => 1f621.tsx} | 4 +- .../Twemoji/{1f628.js => 1f628.tsx} | 4 +- .../Twemoji/{1f62c.js => 1f62c.tsx} | 4 +- .../Twemoji/{1f62d.js => 1f62d.tsx} | 4 +- .../Twemoji/{1f634.js => 1f634.tsx} | 4 +- .../Twemoji/{1f635.js => 1f635.tsx} | 4 +- .../Twemoji/{1f642.js => 1f642.tsx} | 4 +- .../Twemoji/{1f644.js => 1f644.tsx} | 4 +- .../Twemoji/{1f685.js => 1f685.tsx} | 4 +- .../Twemoji/{1f6a6.js => 1f6a6.tsx} | 4 +- .../Twemoji/{1f914.js => 1f914.tsx} | 4 +- .../Twemoji/{1f916.js => 1f916.tsx} | 4 +- .../Twemoji/{1f917.js => 1f917.tsx} | 4 +- .../Twemoji/{1f924.js => 1f924.tsx} | 4 +- .../Twemoji/{1f928.js => 1f928.tsx} | 4 +- .../Twemoji/{1f929.js => 1f929.tsx} | 4 +- .../Twemoji/{1f92b.js => 1f92b.tsx} | 4 +- .../Twemoji/{1f92f.js => 1f92f.tsx} | 4 +- .../Twemoji/{1f947.js => 1f947.tsx} | 4 +- .../Twemoji/{1f948.js => 1f948.tsx} | 4 +- .../Twemoji/{1f955.js => 1f955.tsx} | 4 +- .../Twemoji/{1f957.js => 1f957.tsx} | 4 +- .../Twemoji/{1f95e.js => 1f95e.tsx} | 4 +- .../Twemoji/{1f966.js => 1f966.tsx} | 4 +- .../Twemoji/{1f96a.js => 1f96a.tsx} | 4 +- .../Twemoji/{1f973.js => 1f973.tsx} | 4 +- .../Twemoji/{1f974.js => 1f974.tsx} | 4 +- .../Twemoji/{1f9c0.js => 1f9c0.tsx} | 4 +- .../Twemoji/{1f9d0.js => 1f9d0.tsx} | 4 +- .../{1f9d1-1f3ff.js => 1f9d1-1f3ff.tsx} | 4 +- .../Twemoji/{1f9d1.js => 1f9d1.tsx} | 4 +- .../{1f9d3-1f3fb.js => 1f9d3-1f3fb.tsx} | 4 +- ...-2640-fe0f.js => 1f9d9-200d-2640-fe0f.tsx} | 4 +- .../Twemoji/{1f9ee.js => 1f9ee.tsx} | 4 +- src/components/Twemoji/{2049.js => 2049.tsx} | 4 +- src/components/Twemoji/{2194.js => 2194.tsx} | 4 +- src/components/Twemoji/{2195.js => 2195.tsx} | 4 +- src/components/Twemoji/{2198.js => 2198.tsx} | 4 +- src/components/Twemoji/{21a9.js => 21a9.tsx} | 4 +- src/components/Twemoji/{23e9.js => 23e9.tsx} | 4 +- src/components/Twemoji/{23ec.js => 23ec.tsx} | 4 +- src/components/Twemoji/{23f8.js => 23f8.tsx} | 4 +- src/components/Twemoji/{25b6.js => 25b6.tsx} | 4 +- src/components/Twemoji/{26a0.js => 26a0.tsx} | 4 +- src/components/Twemoji/{2705.js => 2705.tsx} | 4 +- src/components/Twemoji/{2716.js => 2716.tsx} | 4 +- src/components/Twemoji/{2728.js => 2728.tsx} | 4 +- src/components/Twemoji/{274c.js => 274c.tsx} | 4 +- src/components/Twemoji/{2753.js => 2753.tsx} | 4 +- src/components/Twemoji/{2754.js => 2754.tsx} | 4 +- src/components/Twemoji/{2795.js => 2795.tsx} | 4 +- src/components/Twemoji/{2796.js => 2796.tsx} | 4 +- src/components/Twemoji/{2797.js => 2797.tsx} | 4 +- src/components/Twemoji/{27a1.js => 27a1.tsx} | 4 +- src/components/Twemoji/{2b05.js => 2b05.tsx} | 4 +- src/components/Twemoji/{2b07.js => 2b07.tsx} | 4 +- src/components/Twemoji/{2b55.js => 2b55.tsx} | 4 +- .../Twemoji/{30-20e3.js => 30-20e3.tsx} | 4 +- .../Twemoji/{31-20e3.js => 31-20e3.tsx} | 4 +- .../Twemoji/{32-20e3.js => 32-20e3.tsx} | 4 +- .../Twemoji/{33-20e3.js => 33-20e3.tsx} | 4 +- .../Twemoji/{34-20e3.js => 34-20e3.tsx} | 4 +- .../Twemoji/{35-20e3.js => 35-20e3.tsx} | 4 +- .../Twemoji/{36-20e3.js => 36-20e3.tsx} | 4 +- .../Twemoji/{38-20e3.js => 38-20e3.tsx} | 4 +- src/lib/contentsBundle.tsx | 92 +----------- src/lib/emojisBundle.tsx | 138 +----------------- tsconfig.json | 3 +- tsconfig.scripts.json | 9 ++ yarn.lock | 52 ++++++- 143 files changed, 439 insertions(+), 612 deletions(-) create mode 100644 .svgrrc.js rename scripts/{copyUsedEmojis.js => copyUsedEmojis.ts} (81%) delete mode 100644 scripts/generateContentsBundle.js create mode 100644 scripts/generateContentsBundle.ts rename scripts/{generateEmojisBundle.js => generateEmojisBundle.ts} (65%) create mode 100644 scripts/tsconfig.json rename src/components/Twemoji/{1f170.js => 1f170.tsx} (87%) rename src/components/Twemoji/{1f171.js => 1f171.tsx} (88%) rename src/components/Twemoji/{1f193.js => 1f193.tsx} (94%) rename src/components/Twemoji/{1f195.js => 1f195.tsx} (93%) rename src/components/Twemoji/{1f197.js => 1f197.tsx} (90%) rename src/components/Twemoji/{1f19a.js => 1f19a.tsx} (90%) rename src/components/Twemoji/{1f1fa-1f1f8.js => 1f1fa-1f1f8.tsx} (96%) rename src/components/Twemoji/{1f32d.js => 1f32d.tsx} (94%) rename src/components/Twemoji/{1f33d.js => 1f33d.tsx} (96%) rename src/components/Twemoji/{1f346.js => 1f346.tsx} (84%) rename src/components/Twemoji/{1f347.js => 1f347.tsx} (88%) rename src/components/Twemoji/{1f34a.js => 1f34a.tsx} (88%) rename src/components/Twemoji/{1f34e.js => 1f34e.tsx} (84%) rename src/components/Twemoji/{1f354.js => 1f354.tsx} (96%) rename src/components/Twemoji/{1f355.js => 1f355.tsx} (92%) rename src/components/Twemoji/{1f357.js => 1f357.tsx} (88%) rename src/components/Twemoji/{1f35b.js => 1f35b.tsx} (94%) rename src/components/Twemoji/{1f35d.js => 1f35d.tsx} (97%) rename src/components/Twemoji/{1f35e.js => 1f35e.tsx} (86%) rename src/components/Twemoji/{1f35f.js => 1f35f.tsx} (95%) rename src/components/Twemoji/{1f363.js => 1f363.tsx} (97%) rename src/components/Twemoji/{1f369.js => 1f369.tsx} (97%) rename src/components/Twemoji/{1f36a.js => 1f36a.tsx} (93%) rename src/components/Twemoji/{1f36b.js => 1f36b.tsx} (91%) rename src/components/Twemoji/{1f36c.js => 1f36c.tsx} (94%) rename src/components/Twemoji/{1f370.js => 1f370.tsx} (94%) rename src/components/Twemoji/{1f371.js => 1f371.tsx} (97%) rename src/components/Twemoji/{1f37f.js => 1f37f.tsx} (96%) rename src/components/Twemoji/{1f389.js => 1f389.tsx} (97%) rename src/components/Twemoji/{1f3a4.js => 1f3a4.tsx} (91%) rename src/components/Twemoji/{1f3b6.js => 1f3b6.tsx} (90%) rename src/components/Twemoji/{1f3c1.js => 1f3c1.tsx} (94%) rename src/components/Twemoji/{1f40d.js => 1f40d.tsx} (92%) rename src/components/Twemoji/{1f44d.js => 1f44d.tsx} (94%) rename src/components/Twemoji/{1f44e.js => 1f44e.tsx} (94%) rename src/components/Twemoji/{1f454.js => 1f454.tsx} (93%) rename src/components/Twemoji/{1f468-1f3fb-200d-1f4bb.js => 1f468-1f3fb-200d-1f4bb.tsx} (96%) rename src/components/Twemoji/{1f469-1f3fb.js => 1f469-1f3fb.tsx} (92%) rename src/components/Twemoji/{1f469-1f3fd.js => 1f469-1f3fd.tsx} (92%) rename src/components/Twemoji/{1f4a1.js => 1f4a1.tsx} (92%) rename src/components/Twemoji/{1f4a5.js => 1f4a5.tsx} (90%) rename src/components/Twemoji/{1f4aa.js => 1f4aa.tsx} (87%) rename src/components/Twemoji/{1f4ad.js => 1f4ad.tsx} (85%) rename src/components/Twemoji/{1f4bb.js => 1f4bb.tsx} (93%) rename src/components/Twemoji/{1f4d5.js => 1f4d5.tsx} (91%) rename src/components/Twemoji/{1f4d7.js => 1f4d7.tsx} (91%) rename src/components/Twemoji/{1f4d8.js => 1f4d8.tsx} (91%) rename src/components/Twemoji/{1f4d9.js => 1f4d9.tsx} (91%) rename src/components/Twemoji/{1f4dd.js => 1f4dd.tsx} (96%) rename src/components/Twemoji/{1f4f1.js => 1f4f1.tsx} (70%) rename src/components/Twemoji/{1f4f7.js => 1f4f7.tsx} (86%) rename src/components/Twemoji/{1f4fc.js => 1f4fc.tsx} (92%) rename src/components/Twemoji/{1f501.js => 1f501.tsx} (85%) rename src/components/Twemoji/{1f50e.js => 1f50e.tsx} (84%) rename src/components/Twemoji/{1f520.js => 1f520.tsx} (94%) rename src/components/Twemoji/{1f522.js => 1f522.tsx} (94%) rename src/components/Twemoji/{1f53d.js => 1f53d.tsx} (74%) rename src/components/Twemoji/{1f5fa.js => 1f5fa.tsx} (98%) rename src/components/Twemoji/{1f604.js => 1f604.tsx} (91%) rename src/components/Twemoji/{1f605.js => 1f605.tsx} (92%) rename src/components/Twemoji/{1f609.js => 1f609.tsx} (93%) rename src/components/Twemoji/{1f60b.js => 1f60b.tsx} (93%) rename src/components/Twemoji/{1f60d.js => 1f60d.tsx} (91%) rename src/components/Twemoji/{1f60e.js => 1f60e.tsx} (92%) rename src/components/Twemoji/{1f60f.js => 1f60f.tsx} (94%) rename src/components/Twemoji/{1f621.js => 1f621.tsx} (92%) rename src/components/Twemoji/{1f628.js => 1f628.tsx} (93%) rename src/components/Twemoji/{1f62c.js => 1f62c.tsx} (90%) rename src/components/Twemoji/{1f62d.js => 1f62d.tsx} (93%) rename src/components/Twemoji/{1f634.js => 1f634.tsx} (96%) rename src/components/Twemoji/{1f635.js => 1f635.tsx} (93%) rename src/components/Twemoji/{1f642.js => 1f642.tsx} (86%) rename src/components/Twemoji/{1f644.js => 1f644.tsx} (89%) rename src/components/Twemoji/{1f685.js => 1f685.tsx} (88%) rename src/components/Twemoji/{1f6a6.js => 1f6a6.tsx} (86%) rename src/components/Twemoji/{1f914.js => 1f914.tsx} (94%) rename src/components/Twemoji/{1f916.js => 1f916.tsx} (95%) rename src/components/Twemoji/{1f917.js => 1f917.tsx} (96%) rename src/components/Twemoji/{1f924.js => 1f924.tsx} (93%) rename src/components/Twemoji/{1f928.js => 1f928.tsx} (91%) rename src/components/Twemoji/{1f929.js => 1f929.tsx} (93%) rename src/components/Twemoji/{1f92b.js => 1f92b.tsx} (95%) rename src/components/Twemoji/{1f92f.js => 1f92f.tsx} (97%) rename src/components/Twemoji/{1f947.js => 1f947.tsx} (88%) rename src/components/Twemoji/{1f948.js => 1f948.tsx} (91%) rename src/components/Twemoji/{1f955.js => 1f955.tsx} (92%) rename src/components/Twemoji/{1f957.js => 1f957.tsx} (96%) rename src/components/Twemoji/{1f95e.js => 1f95e.tsx} (96%) rename src/components/Twemoji/{1f966.js => 1f966.tsx} (97%) rename src/components/Twemoji/{1f96a.js => 1f96a.tsx} (96%) rename src/components/Twemoji/{1f973.js => 1f973.tsx} (96%) rename src/components/Twemoji/{1f974.js => 1f974.tsx} (93%) rename src/components/Twemoji/{1f9c0.js => 1f9c0.tsx} (94%) rename src/components/Twemoji/{1f9d0.js => 1f9d0.tsx} (95%) rename src/components/Twemoji/{1f9d1-1f3ff.js => 1f9d1-1f3ff.tsx} (92%) rename src/components/Twemoji/{1f9d1.js => 1f9d1.tsx} (93%) rename src/components/Twemoji/{1f9d3-1f3fb.js => 1f9d3-1f3fb.tsx} (93%) rename src/components/Twemoji/{1f9d9-200d-2640-fe0f.js => 1f9d9-200d-2640-fe0f.tsx} (96%) rename src/components/Twemoji/{1f9ee.js => 1f9ee.tsx} (97%) rename src/components/Twemoji/{2049.js => 2049.tsx} (86%) rename src/components/Twemoji/{2194.js => 2194.tsx} (78%) rename src/components/Twemoji/{2195.js => 2195.tsx} (78%) rename src/components/Twemoji/{2198.js => 2198.tsx} (78%) rename src/components/Twemoji/{21a9.js => 21a9.tsx} (81%) rename src/components/Twemoji/{23e9.js => 23e9.tsx} (76%) rename src/components/Twemoji/{23ec.js => 23ec.tsx} (76%) rename src/components/Twemoji/{23f8.js => 23f8.tsx} (75%) rename src/components/Twemoji/{25b6.js => 25b6.tsx} (74%) rename src/components/Twemoji/{26a0.js => 26a0.tsx} (86%) rename src/components/Twemoji/{2705.js => 2705.tsx} (85%) rename src/components/Twemoji/{2716.js => 2716.tsx} (85%) rename src/components/Twemoji/{2728.js => 2728.tsx} (92%) rename src/components/Twemoji/{274c.js => 274c.tsx} (85%) rename src/components/Twemoji/{2753.js => 2753.tsx} (82%) rename src/components/Twemoji/{2754.js => 2754.tsx} (82%) rename src/components/Twemoji/{2795.js => 2795.tsx} (75%) rename src/components/Twemoji/{2796.js => 2796.tsx} (69%) rename src/components/Twemoji/{2797.js => 2797.tsx} (77%) rename src/components/Twemoji/{27a1.js => 27a1.tsx} (75%) rename src/components/Twemoji/{2b05.js => 2b05.tsx} (75%) rename src/components/Twemoji/{2b07.js => 2b07.tsx} (75%) rename src/components/Twemoji/{2b55.js => 2b55.tsx} (74%) rename src/components/Twemoji/{30-20e3.js => 30-20e3.tsx} (84%) rename src/components/Twemoji/{31-20e3.js => 31-20e3.tsx} (83%) rename src/components/Twemoji/{32-20e3.js => 32-20e3.tsx} (87%) rename src/components/Twemoji/{33-20e3.js => 33-20e3.tsx} (88%) rename src/components/Twemoji/{34-20e3.js => 34-20e3.tsx} (86%) rename src/components/Twemoji/{35-20e3.js => 35-20e3.tsx} (88%) rename src/components/Twemoji/{36-20e3.js => 36-20e3.tsx} (88%) rename src/components/Twemoji/{38-20e3.js => 38-20e3.tsx} (89%) create mode 100644 tsconfig.scripts.json diff --git a/.svgrrc.js b/.svgrrc.js new file mode 100644 index 000000000..a9f02b44c --- /dev/null +++ b/.svgrrc.js @@ -0,0 +1,10 @@ +module.exports = { + template({ template }, _, { componentName, jsx }) { + const typeScriptTpl = template.smart({ plugins: ['typescript'] }) + return typeScriptTpl.ast` + import * as React from 'react'; + const ${componentName} = (props: React.SVGProps) => ${jsx}; + export default ${componentName}; + ` + } +} diff --git a/package.json b/package.json index 7291842d5..4700a0b66 100644 --- a/package.json +++ b/package.json @@ -22,29 +22,30 @@ "en:hide-cards": "DEV_LOCALE=en next -p 9990", "dev": "rm -rf .next && concurrently \"yarn jp\" \"yarn en\" \"yarn contents:watch\" \"yarn twemoji:watch\"", "dev:hide-cards": "rm -rf .next && concurrently \"yarn jp:hide-cards\" \"yarn en:hide-cards\" \"yarn contents:watch\" \"yarn twemoji:watch\"", - "contents": "node ./scripts/generateContentsBundle.js", - "contents:watch": "node ./scripts/generateContentsBundle.js watch", + "contents": "ts-node --project tsconfig.scripts.json ./scripts/generateContentsBundle.ts", + "contents:watch": "ts-node --project tsconfig.scripts.json ./scripts/generateContentsBundle.ts watch", "tsc": "tsc", "eslint": "eslint --ext .js,.ts,.tsx .", "eslint:fix": "eslint --ext .js,.ts,.tsx --fix .", "build:en": "yarn tsc && yarn eslint && PRODUCTION_LOCALE=en next build && PRODUCTION_LOCALE=en next export", "build:jp": "yarn tsc && yarn eslint && PRODUCTION_LOCALE=jp next build && PRODUCTION_LOCALE=jp next export", - "twemoji": "mkdir -p .twemoji && rm -f src/components/Twemoji/* && rm -f .twemoji/* && cp `node ./scripts/copyUsedEmojis.js` .twemoji && svgr --no-svgo --filename-case kebab --no-dimensions -d src/components/Twemoji .twemoji && yarn twemoji:bundle", - "twemoji:bundle": "node ./scripts/generateEmojisBundle.js", - "twemoji:watch": "node ./scripts/generateEmojisBundle.js watch", - "svg": "rm -rf src/components/Svg && svgr -d src/components/Svg static/images/svg", + "twemoji": "mkdir -p .twemoji && rm -f src/components/Twemoji/* && rm -f .twemoji/* && cp `ts-node --project tsconfig.scripts.json ./scripts/copyUsedEmojis.ts` .twemoji && svgr --ext tsx --no-svgo --filename-case kebab --no-dimensions -d src/components/Twemoji .twemoji && eslint --ext .tsx --fix src/components/Twemoji && yarn twemoji:bundle", + "twemoji:bundle": "ts-node --project tsconfig.scripts.json ./scripts/generateEmojisBundle.ts", + "twemoji:watch": "ts-node --project tsconfig.scripts.json ./scripts/generateEmojisBundle.ts watch", "type-check": "tsc -w", "test": "jest" }, "devDependencies": { "@svgr/cli": "^4.3.0", "@types/color": "^3.0.0", + "@types/glob": "^7.1.1", "@types/jest": "^24.0.13", "@types/lodash": "^4.14.134", "@types/luxon": "^1.15.1", "@types/material-ui": "^0.21.6", "@types/next": "^8.0.5", "@types/nprogress": "^0.2.0", + "@types/prettier": "^1.16.4", "@types/react": "^16.8.19", "@types/react-dom": "^16.8.4", "@types/smoothscroll-polyfill": "^0.3.1", @@ -67,6 +68,7 @@ "jest": "^24.8.0", "prettier": "^1.18.2", "ts-jest": "^24.0.2", + "ts-node": "^8.3.0", "typescript": "^3.5.1" } } diff --git a/scripts/copyUsedEmojis.js b/scripts/copyUsedEmojis.ts similarity index 81% rename from scripts/copyUsedEmojis.js rename to scripts/copyUsedEmojis.ts index 3846ebcb7..a73642147 100644 --- a/scripts/copyUsedEmojis.js +++ b/scripts/copyUsedEmojis.ts @@ -1,15 +1,16 @@ -const twemoji = require('twemoji') -const uniq = require('lodash/uniq') -const letterEmojis = Object.values( +import twemoji from 'twemoji' +import uniq from 'lodash/uniq' + +const letterEmojis = Object.values( require('../src/lib/letterEmojiMappingJson.json') ) -const numberEmojis = Object.values( +const numberEmojis = Object.values( require('../src/lib/numberEmojiMappingJson.json') ) // NOTE: Disabling svgo because it's causing // some emojis like 😍 to be rendered incorrectly. -const allUsedEmojis = uniq([ +const allUsedEmojis = uniq([ ...letterEmojis, ...numberEmojis, '🤔', @@ -110,7 +111,7 @@ const allUsedEmojis = uniq([ // Copied from Twemoji const UFE0Fg = /\uFE0F/g const U200D = String.fromCharCode(0x200d) -function grabTheRightIcon(rawText) { +function grabTheRightIcon(rawText: string) { // if variant is present as \uFE0F return twemoji.convert.toCodePoint( rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, '') : rawText @@ -118,5 +119,7 @@ function grabTheRightIcon(rawText) { } console.log( - allUsedEmojis.map(x => `.twemoji_svg/${grabTheRightIcon(x)}.svg`).join(' ') + allUsedEmojis + .map((x: string) => `.twemoji_svg/${grabTheRightIcon(x)}.svg`) + .join(' ') ) diff --git a/scripts/generateContentsBundle.js b/scripts/generateContentsBundle.js deleted file mode 100644 index 85b609aa7..000000000 --- a/scripts/generateContentsBundle.js +++ /dev/null @@ -1,84 +0,0 @@ -const chokidar = require('chokidar') -const glob = require('glob') -const fs = require('fs') -const prettier = require('prettier') - -const regenerate = path => { - glob('./src/contents/**/*.+(en|jp).tsx', (err, files) => { - const uniqueNames = [ - ...new Set( - files.map(x => - x.replace('./src/contents/', '').replace(/\.(en|jp)\.tsx/, '') - ) - ) - ] - - const bundleInterfaceString = uniqueNames - .map( - name => ` - '${name}': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - }` - ) - .join('\n') - - const importString = uniqueNames - .map( - name => - `import Jp${name} from 'src/contents/${name}.jp' - import En${name} from 'src/contents/${name}.en'` - ) - .join('\n') - - const bundleObjectString = uniqueNames - .map( - name => ` - '${name}': { - en: En${name}, - jp: Jp${name} - } - ` - ) - .join(',\n') - - const fileContents = prettier.format( - `// WARNING: Do not modify this file - it's generated automatically. - import React from 'react' - ${importString} - - export interface BundleTypes { - ${bundleInterfaceString} - } - - const bundle: BundleTypes = { - ${bundleObjectString} - } - - export default bundle`, - { semi: false, singleQuote: true, parser: 'typescript' } - ) - - fs.writeFile('./src/lib/contentsBundle.tsx', fileContents, err => { - if (err) { - throw err - } - if (path) { - console.log(`${path} updated; Bundle regenerated`) - } else { - console.log('Bundle regenerated') - } - }) - }) -} - -if (process.argv[2] === 'watch') { - chokidar - .watch('./src/contents/**/*.tsx', { ignoreInitial: true }) - .on('add', path => regenerate(path)) - chokidar - .watch('./src/contents/**/*.tsx') - .on('unlink', path => regenerate(path)) -} else { - regenerate() -} diff --git a/scripts/generateContentsBundle.ts b/scripts/generateContentsBundle.ts new file mode 100644 index 000000000..4aeda092d --- /dev/null +++ b/scripts/generateContentsBundle.ts @@ -0,0 +1,70 @@ +import chokidar from 'chokidar' +import glob from 'glob' +import fs from 'fs' +import prettier from 'prettier' + +const regenerate = (path?: string) => { + glob( + './src/contents/**/*.+(en|jp).tsx', + (_: any, files: readonly string[]) => { + const uniqueNames = [ + ...new Set( + files.map(x => + x.replace('./src/contents/', '').replace(/\.(en|jp)\.tsx/, '') + ) + ) + ] + + const importString = uniqueNames + .map( + name => + `import Jp${name} from 'src/contents/${name}.jp' + import En${name} from 'src/contents/${name}.en'` + ) + .join('\n') + + const bundleObjectString = uniqueNames + .map( + name => ` + '${name}': { + en: En${name}, + jp: Jp${name} + } + ` + ) + .join(',\n') + + const fileContents = prettier.format( + `// WARNING: Do not modify this file - it's generated automatically. + ${importString} + + export default { + ${bundleObjectString} + }`, + { semi: false, singleQuote: true, parser: 'typescript' } + ) + + fs.writeFile('./src/lib/contentsBundle.tsx', fileContents, err => { + if (err) { + throw err + } + if (path) { + console.log(`${path} updated; Bundle regenerated`) + } else { + console.log('Bundle regenerated') + } + }) + } + ) +} + +if (process.argv[2] === 'watch') { + chokidar + .watch('./src/contents/**/*.tsx', { ignoreInitial: true }) + .on('add', path => regenerate(path)) + chokidar + .watch('./src/contents/**/*.tsx') + .on('unlink', path => regenerate(path)) +} else { + regenerate() +} diff --git a/scripts/generateEmojisBundle.js b/scripts/generateEmojisBundle.ts similarity index 65% rename from scripts/generateEmojisBundle.js rename to scripts/generateEmojisBundle.ts index 89ed586e8..b47a3a6ea 100644 --- a/scripts/generateEmojisBundle.js +++ b/scripts/generateEmojisBundle.ts @@ -1,20 +1,20 @@ -const chokidar = require('chokidar') -const glob = require('glob') -const fs = require('fs') -const prettier = require('prettier') -const { exec } = require('child_process') +import chokidar from 'chokidar' +import glob from 'glob' +import fs from 'fs' +import prettier from 'prettier' +import { exec } from 'child_process' const regenerate = () => { - glob('./src/components/Twemoji/*.js', (err, files) => { + glob('./src/components/Twemoji/*.tsx', (_: any, files: readonly string[]) => { const uniqueNames = [ ...new Set( files.map(x => - x.replace('./src/components/Twemoji/', '').replace(/\.js/, '') + x.replace('./src/components/Twemoji/', '').replace(/\.tsx/, '') ) ) ] - const toComponentName = name => `Emoji${name.replace(/-/g, 'ZZ')}` + const toComponentName = (name: string) => `Emoji${name.replace(/-/g, 'ZZ')}` const importString = uniqueNames .map( @@ -29,24 +29,13 @@ const regenerate = () => { .map(name => `'${name}': ${toComponentName(name)}`) .join(',\n') - const bundleInterfaceString = uniqueNames - .map(name => `'${name}': React.ComponentType<{}>`) - .join('\n') - const fileContents = prettier.format( `// WARNING: Do not modify this file - it's generated automatically. - import React from 'react' ${importString} - export interface BundleTypes { - ${bundleInterfaceString} - } - - const bundle: BundleTypes = { + export default { ${bundleObjectString} - } - - export default bundle`, + }`, { semi: false, singleQuote: true, parser: 'typescript' } ) @@ -62,13 +51,13 @@ const regenerate = () => { if (process.argv[2] === 'watch') { chokidar .watch( - ['./src/lib/letterEmojiMappingJson.json', './scripts/copyUsedEmojis.js'], + ['./src/lib/letterEmojiMappingJson.json', './scripts/copyUsedEmojis.ts'], { ignoreInitial: true } ) .on('change', path => { exec('yarn twemoji', err => { if (err) { - throw new Error(err) + throw new Error() } console.log(`${path} updated`) }) diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 000000000..887874a2b --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.scripts.json" +} diff --git a/src/components/Content.tsx b/src/components/Content.tsx index 389d73f7d..5fb865dcc 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -1,9 +1,9 @@ import React from 'react' -import bundle, { BundleTypes } from 'src/lib/contentsBundle' +import bundle from 'src/lib/contentsBundle' import locale from 'src/lib/locale' export interface ContentProps { - name: keyof BundleTypes + name: keyof typeof bundle } const Content = ({ name }: ContentProps) => { diff --git a/src/components/Twemoji/1f170.js b/src/components/Twemoji/1f170.tsx similarity index 87% rename from src/components/Twemoji/1f170.js rename to src/components/Twemoji/1f170.tsx index 85acd5d97..8723e4f19 100644 --- a/src/components/Twemoji/1f170.js +++ b/src/components/Twemoji/1f170.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F170 = props => ( +const Svg1F170 = (props: React.SVGProps) => ( ( +const Svg1F171 = (props: React.SVGProps) => ( ( +const Svg1F193 = (props: React.SVGProps) => ( ( +const Svg1F195 = (props: React.SVGProps) => ( ( +const Svg1F197 = (props: React.SVGProps) => ( ( +const Svg1F19A = (props: React.SVGProps) => ( ( +const Svg1F1Fa1F1F8 = (props: React.SVGProps) => ( ( +const Svg1F32D = (props: React.SVGProps) => ( ( +const Svg1F33D = (props: React.SVGProps) => ( ( +const Svg1F346 = (props: React.SVGProps) => ( ( +const Svg1F347 = (props: React.SVGProps) => ( ( +const Svg1F34A = (props: React.SVGProps) => ( ( +const Svg1F34E = (props: React.SVGProps) => ( ( +const Svg1F354 = (props: React.SVGProps) => ( ( +const Svg1F355 = (props: React.SVGProps) => ( ( +const Svg1F357 = (props: React.SVGProps) => ( ( +const Svg1F35B = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f35d.js b/src/components/Twemoji/1f35d.tsx similarity index 97% rename from src/components/Twemoji/1f35d.js rename to src/components/Twemoji/1f35d.tsx index 0875aee75..4c07f9a78 100644 --- a/src/components/Twemoji/1f35d.js +++ b/src/components/Twemoji/1f35d.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F35D = props => ( +const Svg1F35D = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f35e.js b/src/components/Twemoji/1f35e.tsx similarity index 86% rename from src/components/Twemoji/1f35e.js rename to src/components/Twemoji/1f35e.tsx index d2136adff..658737409 100644 --- a/src/components/Twemoji/1f35e.js +++ b/src/components/Twemoji/1f35e.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F35E = props => ( +const Svg1F35E = (props: React.SVGProps) => ( ( +const Svg1F35F = (props: React.SVGProps) => ( ( +const Svg1F363 = (props: React.SVGProps) => ( ( +const Svg1F369 = (props: React.SVGProps) => ( ( +const Svg1F36A = (props: React.SVGProps) => ( ( +const Svg1F36B = (props: React.SVGProps) => ( ( +const Svg1F36C = (props: React.SVGProps) => ( ( +const Svg1F370 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f371.js b/src/components/Twemoji/1f371.tsx similarity index 97% rename from src/components/Twemoji/1f371.js rename to src/components/Twemoji/1f371.tsx index b9214cd92..c96026f6e 100644 --- a/src/components/Twemoji/1f371.js +++ b/src/components/Twemoji/1f371.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F371 = props => ( +const Svg1F371 = (props: React.SVGProps) => ( ( +const Svg1F37F = (props: React.SVGProps) => ( ( +const Svg1F389 = (props: React.SVGProps) => ( ( +const Svg1F3A4 = (props: React.SVGProps) => ( ( +const Svg1F3B6 = (props: React.SVGProps) => ( ( +const Svg1F3C1 = (props: React.SVGProps) => ( ( +const Svg1F40D = (props: React.SVGProps) => ( ( +const Svg1F44D = (props: React.SVGProps) => ( ( +const Svg1F44E = (props: React.SVGProps) => ( ( +const Svg1F454 = (props: React.SVGProps) => ( ( +const Svg1F4681F3Fb200D1F4Bb = (props: React.SVGProps) => ( ( +const Svg1F4691F3Fb = (props: React.SVGProps) => ( ( +const Svg1F4691F3Fd = (props: React.SVGProps) => ( ( +const Svg1F4A1 = (props: React.SVGProps) => ( ( +const Svg1F4A5 = (props: React.SVGProps) => ( ( +const Svg1F4Aa = (props: React.SVGProps) => ( ( +const Svg1F4Ad = (props: React.SVGProps) => ( ( +const Svg1F4Bb = (props: React.SVGProps) => ( ( +const Svg1F4D5 = (props: React.SVGProps) => ( ( +const Svg1F4D7 = (props: React.SVGProps) => ( ( +const Svg1F4D8 = (props: React.SVGProps) => ( ( +const Svg1F4D9 = (props: React.SVGProps) => ( ( +const Svg1F4Dd = (props: React.SVGProps) => ( ( +const Svg1F4F1 = (props: React.SVGProps) => ( ( +const Svg1F4F7 = (props: React.SVGProps) => ( ( +const Svg1F4Fc = (props: React.SVGProps) => ( ( +const Svg1F501 = (props: React.SVGProps) => ( ( +const Svg1F50E = (props: React.SVGProps) => ( ( +const Svg1F520 = (props: React.SVGProps) => ( ( +const Svg1F522 = (props: React.SVGProps) => ( ( +const Svg1F53D = (props: React.SVGProps) => ( ( +const Svg1F5Fa = (props: React.SVGProps) => ( ( +const Svg1F604 = (props: React.SVGProps) => ( ( +const Svg1F605 = (props: React.SVGProps) => ( ( +const Svg1F609 = (props: React.SVGProps) => ( ( +const Svg1F60B = (props: React.SVGProps) => ( ( +const Svg1F60D = (props: React.SVGProps) => ( ( +const Svg1F60E = (props: React.SVGProps) => ( ( +const Svg1F60F = (props: React.SVGProps) => ( ( +const Svg1F621 = (props: React.SVGProps) => ( ( +const Svg1F628 = (props: React.SVGProps) => ( ( +const Svg1F62C = (props: React.SVGProps) => ( ( +const Svg1F62D = (props: React.SVGProps) => ( ( +const Svg1F634 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f635.js b/src/components/Twemoji/1f635.tsx similarity index 93% rename from src/components/Twemoji/1f635.js rename to src/components/Twemoji/1f635.tsx index 05159b037..3a1c979f4 100644 --- a/src/components/Twemoji/1f635.js +++ b/src/components/Twemoji/1f635.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F635 = props => ( +const Svg1F635 = (props: React.SVGProps) => ( ( +const Svg1F642 = (props: React.SVGProps) => ( ( +const Svg1F644 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f685.js b/src/components/Twemoji/1f685.tsx similarity index 88% rename from src/components/Twemoji/1f685.js rename to src/components/Twemoji/1f685.tsx index 5999bd3d2..fbab3e004 100644 --- a/src/components/Twemoji/1f685.js +++ b/src/components/Twemoji/1f685.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F685 = props => ( +const Svg1F685 = (props: React.SVGProps) => ( ( +const Svg1F6A6 = (props: React.SVGProps) => ( ( +const Svg1F914 = (props: React.SVGProps) => ( ( +const Svg1F916 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f917.js b/src/components/Twemoji/1f917.tsx similarity index 96% rename from src/components/Twemoji/1f917.js rename to src/components/Twemoji/1f917.tsx index b8cc61712..a1b98e391 100644 --- a/src/components/Twemoji/1f917.js +++ b/src/components/Twemoji/1f917.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F917 = props => ( +const Svg1F917 = (props: React.SVGProps) => ( ( +const Svg1F924 = (props: React.SVGProps) => ( ( +const Svg1F928 = (props: React.SVGProps) => ( ( +const Svg1F929 = (props: React.SVGProps) => ( ( +const Svg1F92B = (props: React.SVGProps) => ( ( +const Svg1F92F = (props: React.SVGProps) => ( ( +const Svg1F947 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f948.js b/src/components/Twemoji/1f948.tsx similarity index 91% rename from src/components/Twemoji/1f948.js rename to src/components/Twemoji/1f948.tsx index 81c389518..f9f623e43 100644 --- a/src/components/Twemoji/1f948.js +++ b/src/components/Twemoji/1f948.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F948 = props => ( +const Svg1F948 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f955.js b/src/components/Twemoji/1f955.tsx similarity index 92% rename from src/components/Twemoji/1f955.js rename to src/components/Twemoji/1f955.tsx index 4845b8287..ade69a191 100644 --- a/src/components/Twemoji/1f955.js +++ b/src/components/Twemoji/1f955.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F955 = props => ( +const Svg1F955 = (props: React.SVGProps) => ( ( +const Svg1F957 = (props: React.SVGProps) => ( ( +const Svg1F95E = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f966.js b/src/components/Twemoji/1f966.tsx similarity index 97% rename from src/components/Twemoji/1f966.js rename to src/components/Twemoji/1f966.tsx index cd7cf864c..ca0d8aa1e 100644 --- a/src/components/Twemoji/1f966.js +++ b/src/components/Twemoji/1f966.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F966 = props => ( +const Svg1F966 = (props: React.SVGProps) => ( ( +const Svg1F96A = (props: React.SVGProps) => ( ( +const Svg1F973 = (props: React.SVGProps) => ( diff --git a/src/components/Twemoji/1f974.js b/src/components/Twemoji/1f974.tsx similarity index 93% rename from src/components/Twemoji/1f974.js rename to src/components/Twemoji/1f974.tsx index 92ea155df..66d08406c 100644 --- a/src/components/Twemoji/1f974.js +++ b/src/components/Twemoji/1f974.tsx @@ -1,6 +1,6 @@ -import React from 'react' +import * as React from 'react' -const Svg1F974 = props => ( +const Svg1F974 = (props: React.SVGProps) => ( ( +const Svg1F9C0 = (props: React.SVGProps) => ( ( +const Svg1F9D0 = (props: React.SVGProps) => ( ( +const Svg1F9D11F3Ff = (props: React.SVGProps) => ( ( +const Svg1F9D1 = (props: React.SVGProps) => ( ( +const Svg1F9D31F3Fb = (props: React.SVGProps) => ( ( +const Svg1F9D9200D2640Fe0F = (props: React.SVGProps) => ( ( +const Svg1F9Ee = (props: React.SVGProps) => ( ( +const Svg2049 = (props: React.SVGProps) => ( ( +const Svg2194 = (props: React.SVGProps) => ( ( +const Svg2195 = (props: React.SVGProps) => ( ( +const Svg2198 = (props: React.SVGProps) => ( ( +const Svg21A9 = (props: React.SVGProps) => ( ( +const Svg23E9 = (props: React.SVGProps) => ( ( +const Svg23Ec = (props: React.SVGProps) => ( ( +const Svg23F8 = (props: React.SVGProps) => ( ( +const Svg25B6 = (props: React.SVGProps) => ( ( +const Svg26A0 = (props: React.SVGProps) => ( ( +const Svg2705 = (props: React.SVGProps) => ( ( +const Svg2716 = (props: React.SVGProps) => ( ( +const Svg2728 = (props: React.SVGProps) => ( ( +const Svg274C = (props: React.SVGProps) => ( ( +const Svg2753 = (props: React.SVGProps) => ( ( +const Svg2754 = (props: React.SVGProps) => ( ( +const Svg2795 = (props: React.SVGProps) => ( ( +const Svg2796 = (props: React.SVGProps) => ( ( +const Svg2797 = (props: React.SVGProps) => ( ( +const Svg27A1 = (props: React.SVGProps) => ( ( +const Svg2B05 = (props: React.SVGProps) => ( ( +const Svg2B07 = (props: React.SVGProps) => ( ( +const Svg2B55 = (props: React.SVGProps) => ( ( +const Svg3020E3 = (props: React.SVGProps) => ( ( +const Svg3120E3 = (props: React.SVGProps) => ( ( +const Svg3220E3 = (props: React.SVGProps) => ( ( +const Svg3320E3 = (props: React.SVGProps) => ( ( +const Svg3420E3 = (props: React.SVGProps) => ( ( +const Svg3520E3 = (props: React.SVGProps) => ( ( +const Svg3620E3 = (props: React.SVGProps) => ( ( +const Svg3820E3 = (props: React.SVGProps) => ( - en: React.ComponentType<{}> - } - - '1': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '10': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '11': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '12': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '13': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '14': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '15': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '16': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '2': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '3': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '4': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '5': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '6': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '7': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '8': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } - - '9': { - jp: React.ComponentType<{}> - en: React.ComponentType<{}> - } -} - -const bundle: BundleTypes = { +export default { '0': { en: En0, jp: Jp0 @@ -192,5 +104,3 @@ const bundle: BundleTypes = { jp: Jp9 } } - -export default bundle diff --git a/src/lib/emojisBundle.tsx b/src/lib/emojisBundle.tsx index 95facb1e9..a22727ce0 100644 --- a/src/lib/emojisBundle.tsx +++ b/src/lib/emojisBundle.tsx @@ -1,5 +1,4 @@ // WARNING: Do not modify this file - it's generated automatically. -import React from 'react' import Emoji1f170 from 'src/components/Twemoji/1f170' import Emoji1f171 from 'src/components/Twemoji/1f171' import Emoji1f193 from 'src/components/Twemoji/1f193' @@ -131,140 +130,7 @@ import Emoji35ZZ20e3 from 'src/components/Twemoji/35-20e3' import Emoji36ZZ20e3 from 'src/components/Twemoji/36-20e3' import Emoji38ZZ20e3 from 'src/components/Twemoji/38-20e3' -export interface BundleTypes { - '1f170': React.ComponentType<{}> - '1f171': React.ComponentType<{}> - '1f193': React.ComponentType<{}> - '1f195': React.ComponentType<{}> - '1f197': React.ComponentType<{}> - '1f19a': React.ComponentType<{}> - '1f1fa-1f1f8': React.ComponentType<{}> - '1f32d': React.ComponentType<{}> - '1f33d': React.ComponentType<{}> - '1f346': React.ComponentType<{}> - '1f347': React.ComponentType<{}> - '1f34a': React.ComponentType<{}> - '1f34e': React.ComponentType<{}> - '1f354': React.ComponentType<{}> - '1f355': React.ComponentType<{}> - '1f357': React.ComponentType<{}> - '1f35b': React.ComponentType<{}> - '1f35d': React.ComponentType<{}> - '1f35e': React.ComponentType<{}> - '1f35f': React.ComponentType<{}> - '1f363': React.ComponentType<{}> - '1f369': React.ComponentType<{}> - '1f36a': React.ComponentType<{}> - '1f36b': React.ComponentType<{}> - '1f36c': React.ComponentType<{}> - '1f370': React.ComponentType<{}> - '1f371': React.ComponentType<{}> - '1f37f': React.ComponentType<{}> - '1f389': React.ComponentType<{}> - '1f3a4': React.ComponentType<{}> - '1f3b6': React.ComponentType<{}> - '1f3c1': React.ComponentType<{}> - '1f40d': React.ComponentType<{}> - '1f44d': React.ComponentType<{}> - '1f44e': React.ComponentType<{}> - '1f454': React.ComponentType<{}> - '1f468-1f3fb-200d-1f4bb': React.ComponentType<{}> - '1f469-1f3fb': React.ComponentType<{}> - '1f469-1f3fd': React.ComponentType<{}> - '1f4a1': React.ComponentType<{}> - '1f4a5': React.ComponentType<{}> - '1f4aa': React.ComponentType<{}> - '1f4ad': React.ComponentType<{}> - '1f4bb': React.ComponentType<{}> - '1f4d5': React.ComponentType<{}> - '1f4d7': React.ComponentType<{}> - '1f4d8': React.ComponentType<{}> - '1f4d9': React.ComponentType<{}> - '1f4dd': React.ComponentType<{}> - '1f4f1': React.ComponentType<{}> - '1f4f7': React.ComponentType<{}> - '1f4fc': React.ComponentType<{}> - '1f501': React.ComponentType<{}> - '1f50e': React.ComponentType<{}> - '1f520': React.ComponentType<{}> - '1f522': React.ComponentType<{}> - '1f53d': React.ComponentType<{}> - '1f5fa': React.ComponentType<{}> - '1f604': React.ComponentType<{}> - '1f605': React.ComponentType<{}> - '1f609': React.ComponentType<{}> - '1f60b': React.ComponentType<{}> - '1f60d': React.ComponentType<{}> - '1f60e': React.ComponentType<{}> - '1f60f': React.ComponentType<{}> - '1f621': React.ComponentType<{}> - '1f628': React.ComponentType<{}> - '1f62c': React.ComponentType<{}> - '1f62d': React.ComponentType<{}> - '1f634': React.ComponentType<{}> - '1f635': React.ComponentType<{}> - '1f642': React.ComponentType<{}> - '1f644': React.ComponentType<{}> - '1f685': React.ComponentType<{}> - '1f6a6': React.ComponentType<{}> - '1f914': React.ComponentType<{}> - '1f916': React.ComponentType<{}> - '1f917': React.ComponentType<{}> - '1f924': React.ComponentType<{}> - '1f928': React.ComponentType<{}> - '1f929': React.ComponentType<{}> - '1f92b': React.ComponentType<{}> - '1f92f': React.ComponentType<{}> - '1f947': React.ComponentType<{}> - '1f948': React.ComponentType<{}> - '1f955': React.ComponentType<{}> - '1f957': React.ComponentType<{}> - '1f95e': React.ComponentType<{}> - '1f966': React.ComponentType<{}> - '1f96a': React.ComponentType<{}> - '1f973': React.ComponentType<{}> - '1f974': React.ComponentType<{}> - '1f9c0': React.ComponentType<{}> - '1f9d0': React.ComponentType<{}> - '1f9d1-1f3ff': React.ComponentType<{}> - '1f9d1': React.ComponentType<{}> - '1f9d3-1f3fb': React.ComponentType<{}> - '1f9d9-200d-2640-fe0f': React.ComponentType<{}> - '1f9ee': React.ComponentType<{}> - '2049': React.ComponentType<{}> - '2194': React.ComponentType<{}> - '2195': React.ComponentType<{}> - '2198': React.ComponentType<{}> - '21a9': React.ComponentType<{}> - '23e9': React.ComponentType<{}> - '23ec': React.ComponentType<{}> - '23f8': React.ComponentType<{}> - '25b6': React.ComponentType<{}> - '26a0': React.ComponentType<{}> - '2705': React.ComponentType<{}> - '2716': React.ComponentType<{}> - '2728': React.ComponentType<{}> - '274c': React.ComponentType<{}> - '2753': React.ComponentType<{}> - '2754': React.ComponentType<{}> - '2795': React.ComponentType<{}> - '2796': React.ComponentType<{}> - '2797': React.ComponentType<{}> - '27a1': React.ComponentType<{}> - '2b05': React.ComponentType<{}> - '2b07': React.ComponentType<{}> - '2b55': React.ComponentType<{}> - '30-20e3': React.ComponentType<{}> - '31-20e3': React.ComponentType<{}> - '32-20e3': React.ComponentType<{}> - '33-20e3': React.ComponentType<{}> - '34-20e3': React.ComponentType<{}> - '35-20e3': React.ComponentType<{}> - '36-20e3': React.ComponentType<{}> - '38-20e3': React.ComponentType<{}> -} - -const bundle: BundleTypes = { +export default { '1f170': Emoji1f170, '1f171': Emoji1f171, '1f193': Emoji1f193, @@ -396,5 +262,3 @@ const bundle: BundleTypes = { '36-20e3': Emoji36ZZ20e3, '38-20e3': Emoji38ZZ20e3 } - -export default bundle diff --git a/tsconfig.json b/tsconfig.json index 24d786710..e92ebd91b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,7 +20,8 @@ "lib": ["dom", "esnext"], "paths": { "src/*": ["src/*"], - "test/*": ["test/*"] + "test/*": ["test/*"], + "*": ["node_modules/*", "src/types/*"] } }, "include": ["./src", "./pages"] diff --git a/tsconfig.scripts.json b/tsconfig.scripts.json new file mode 100644 index 000000000..e1430fe1d --- /dev/null +++ b/tsconfig.scripts.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "lib": ["es2017"] + }, + "include": ["./scripts"] +} diff --git a/yarn.lock b/yarn.lock index 3cbfe3c4b..8ed2a227e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1275,6 +1275,20 @@ resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -1325,6 +1339,11 @@ "@types/react" "*" "@types/react-addons-linked-state-mixin" "*" +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + "@types/next-server@*": version "8.1.1" resolved "https://registry.yarnpkg.com/@types/next-server/-/next-server-8.1.1.tgz#1570d5079cf7e82e77f48826024c6e2797cddda7" @@ -1362,6 +1381,11 @@ resolved "https://registry.yarnpkg.com/@types/nprogress/-/nprogress-0.2.0.tgz#86c593682d4199212a0509cc3c4d562bbbd6e45f" integrity sha512-1cYJrqq9GezNFPsWTZpFut/d4CjpZqA0vhqDUPFWYKF1oIyBz5qnoYMzR+0C/T96t3ebLAC1SSnwrVOm5/j74A== +"@types/prettier@^1.16.4": + version "1.16.4" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.16.4.tgz#5e5e97702cb68498aaba7349b941648daaf2385c" + integrity sha512-MG7ExKBo7AQ5UrL1awyYLNinNM/kyXgE4iP4Ul9fB+T7n768Z5Xem8IZeP6Bna0xze8gkDly49Rgge2HOEw4xA== + "@types/prop-types@*": version "15.7.1" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" @@ -1829,6 +1853,11 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +arg@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0" + integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -3156,6 +3185,11 @@ diff-sequences@^24.3.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + diffie-hellman@^5.0.0: version "5.0.3" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" @@ -5387,7 +5421,7 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" -make-error@1.x: +make-error@1.x, make-error@^1.1.1: version "1.3.5" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== @@ -7816,6 +7850,17 @@ ts-jest@^24.0.2: semver "^5.5" yargs-parser "10.x" +ts-node@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.3.0.tgz#e4059618411371924a1fb5f3b125915f324efb57" + integrity sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" @@ -8382,3 +8427,8 @@ yargs@^12.0.1, yargs@^12.0.2: which-module "^2.0.0" y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" + +yn@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.0.tgz#fcbe2db63610361afcc5eb9e0ac91e976d046114" + integrity sha512-kKfnnYkbTfrAdd0xICNFw7Atm8nKpLcLv9AZGEt+kczL/WQVai4e2V6ZN8U/O+iI6WrNuJjNNOyu4zfhl9D3Hg==