chore: reduce dependencies by own json generator

This commit is contained in:
Jakub Grzywacz 2021-07-10 15:21:47 +02:00
parent d5a17ddfeb
commit 9c121bfd34
No known key found for this signature in database
GPG Key ID: 5BBB685871FF63C4
5 changed files with 30 additions and 9078 deletions

View File

@ -29,7 +29,8 @@
"release": "release-it", "release": "release-it",
"example": "yarn --cwd example", "example": "yarn --cwd example",
"pods": "cd example && pod-install --quiet", "pods": "cd example && pod-install --quiet",
"bootstrap": "yarn example && yarn && yarn pods" "bootstrap": "yarn example && yarn && yarn pods",
"generateIcons": "node ./scripts/generateIcons.js"
}, },
"keywords": [ "keywords": [
"react-native", "react-native",
@ -64,8 +65,11 @@
"react": "16.13.1", "react": "16.13.1",
"react-native": "0.63.4", "react-native": "0.63.4",
"react-native-builder-bob": "^0.18.0", "react-native-builder-bob": "^0.18.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-svg": "^12.1.1",
"release-it": "^14.2.2", "release-it": "^14.2.2",
"typescript": "^4.1.3" "typescript": "^4.1.3",
"unicode-emoji-json": "^0.2.1"
}, },
"peerDependencies": { "peerDependencies": {
"react": "*", "react": "*",
@ -152,7 +156,5 @@
] ]
] ]
}, },
"dependencies": { "dependencies": {}
"unicode-emoji-json": "^0.2.1"
}
} }

21
scripts/generateIcons.js Normal file
View File

@ -0,0 +1,21 @@
const json = require('unicode-emoji-json/data-by-group.json');
const fs = require('fs');
const newArray = [];
for (const [key, value] of Object.entries(json)) {
const newData = value.map((emoji) => ({
emoji: emoji.emoji,
name: emoji.name,
slug: emoji.slug,
}));
newArray.push({ title: key, data: newData });
}
fs.writeFile(
'./src/assets/emojis.json',
JSON.stringify(newArray),
function (err) {
if (err) return console.log(err);
console.log('emojis.json successfully saved to assets folder');
}
);

View File

@ -11,7 +11,7 @@ import type { CategoryTypes, EmojisByCategory } from './types';
import { EmojiCategory } from './components/EmojiCategory'; import { EmojiCategory } from './components/EmojiCategory';
import { KeyboardContext } from './KeyboardContext'; import { KeyboardContext } from './KeyboardContext';
import { Categories } from './components/Categories'; import { Categories } from './components/Categories';
import emojisByGroup from './assets/data-by-group.json'; import emojisByGroup from './assets/emojis.json';
export const EmojiKeyboard = () => { export const EmojiKeyboard = () => {
const { width } = useWindowDimensions(); const { width } = useWindowDimensions();

File diff suppressed because it is too large Load Diff

1
src/assets/emojis.json Normal file

File diff suppressed because one or more lines are too long