💄 Prettier

release
Etienne Lemay 2018-04-26 16:07:22 -04:00
parent 446fdf9544
commit 253ef4de89
No known key found for this signature in database
GPG Key ID: EE7CF89146BB28E9
3 changed files with 22 additions and 17 deletions

View File

@ -77,7 +77,7 @@
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",
"storybook": "start-storybook -p 6006", "storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook", "build-storybook": "build-storybook",
"prettier": "prettier --write \"{src,spec}/**/*.js\"" "prettier": "prettier --write \"{src,scripts,spec}/**/*.js\""
}, },
"size-limit": [ "size-limit": [
{ {

View File

@ -64,11 +64,14 @@ emojiData.forEach((datum) => {
} }
datum.short_names.forEach((short_name, i) => { datum.short_names.forEach((short_name, i) => {
if (i == 0) { return } if (i == 0) {
return
}
data.short_names[short_name] = datum.short_name data.short_names[short_name] = datum.short_name
}) })
datum.short_names = datum.short_names.filter(i => i !== datum.short_name) datum.short_names = datum.short_names.filter((i) => i !== datum.short_name)
datum.sheet = [datum.sheet_x, datum.sheet_y] datum.sheet = [datum.sheet_x, datum.sheet_y]
if (datum.text === '') delete datum.text if (datum.text === '') delete datum.text
@ -95,11 +98,13 @@ emojiData.forEach((datum) => {
}) })
var flags = data.categories[categoriesIndex['Flags']] var flags = data.categories[categoriesIndex['Flags']]
flags.emojis = flags.emojis.filter((flag) => { flags.emojis = flags.emojis
.filter((flag) => {
// Until browsers support Flag UN // Until browsers support Flag UN
if (flag == 'flag-un') return if (flag == 'flag-un') return
return true return true
}).sort() })
.sort()
const stringified = JSON.stringify(data).replace(/\"([A-Za-z_]+)\":/g, '$1:') const stringified = JSON.stringify(data).replace(/\"([A-Za-z_]+)\":/g, '$1:')
fs.writeFile('src/data/data.js', `export default ${stringified}`, (err) => { fs.writeFile('src/data/data.js', `export default ${stringified}`, (err) => {

View File

@ -2,5 +2,5 @@ var pack = require('../package.json')
module.exports = { module.exports = {
'process.env.NODE_ENV': 'production', 'process.env.NODE_ENV': 'production',
EMOJI_DATASOURCE_VERSION: pack.devDependencies['emoji-datasource'] EMOJI_DATASOURCE_VERSION: pack.devDependencies['emoji-datasource'],
} }