Move data in src

So that it’s then compiled into dist
release
Etienne Lemay 2017-09-28 19:24:17 -04:00
parent 3ed6b746bc
commit e8dc29bfaa
8 changed files with 12 additions and 18 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
node_modules/ node_modules/
data/data.js
dist/ dist/
bundle.js bundle.js

View File

@ -61,11 +61,10 @@
"webpack": "^3.6.0" "webpack": "^3.6.0"
}, },
"scripts": { "scripts": {
"clean": "rimraf data/data.js dist/", "clean": "rm -rf dist/",
"clean:dist": "rm -rf dist/",
"build:data": "node scripts/build-data", "build:data": "node scripts/build-data",
"build:dist": "npm run clean:dist && babel src --out-dir dist --copy-files --ignore webpack.config.js", "build:dist": "npm run clean && babel src --out-dir dist --copy-files --ignore webpack.config.js",
"build": "npm run build:data && npm run build:dist", "build": "npm run build:dist && npm run build:data",
"watch": "babel src --watch --out-dir dist --copy-files --ignore webpack.config.js", "watch": "babel src --watch --out-dir dist --copy-files --ignore webpack.config.js",
"start": "npm run storybook", "start": "npm run storybook",
"stats": "webpack --config ./src/webpack.config.js --json > stats.json", "stats": "webpack --config ./src/webpack.config.js --json > stats.json",

View File

@ -136,11 +136,7 @@ emojiData.forEach((datum) => {
var flags = data.categories[categoriesIndex['Flags']] var flags = data.categories[categoriesIndex['Flags']]
flags.emojis.sort() flags.emojis.sort()
mkdirp('data', (err) => { const stringified = JSON.stringify(data).replace(/\"([A-Za-z_]+)\":/g, '$1:')
fs.writeFile('dist/data/data.js', `module.exports = ${stringified}`, (err) => {
if (err) throw err if (err) throw err
const stringified = JSON.stringify(data).replace(/\"([A-Za-z_]+)\":/g, '$1:')
fs.writeFile('data/data.js', `module.exports = ${stringified}`, (err) => {
if (err) throw err
})
}) })

View File

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import data from '../../data' import data from '../data'
import { getData, getSanitizedData, unifiedToNative } from '../utils' import { getData, getSanitizedData, unifiedToNative } from '../utils'

View File

@ -3,7 +3,7 @@ import '../vendor/raf-polyfill'
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import measureScrollbar from 'measure-scrollbar' import measureScrollbar from 'measure-scrollbar'
import data from '../../data' import data from '../data'
import store from '../utils/store' import store from '../utils/store'
import frequently from '../utils/frequently' import frequently from '../utils/frequently'

View File

@ -1,5 +1,5 @@
var buildSearch = require('../src/utils/build-search') import buildSearch from '../utils/build-search'
var data = require('./data') import data from './data'
function uncompress (list) { function uncompress (list) {
for (var short_name in list) { for (var short_name in list) {
@ -29,4 +29,4 @@ function uncompress (list) {
uncompress(data.emojis) uncompress(data.emojis)
uncompress(data.skins) uncompress(data.skins)
module.exports = data export default data

View File

@ -1,4 +1,4 @@
import data from '../../data' import data from '../data'
import { getData, getSanitizedData, uniq } from '.' import { getData, getSanitizedData, uniq } from '.'
var index = {} var index = {}

View File

@ -1,5 +1,5 @@
import buildSearch from './build-search' import buildSearch from './build-search'
import data from '../../data' import data from '../data'
import stringFromCodePoint from '../polyfills/stringFromCodePoint' import stringFromCodePoint from '../polyfills/stringFromCodePoint'
const _JSON = JSON const _JSON = JSON