Merge pull request #130 from nolanlawson/fix-tests

Fix tests
release
Etienne Lemay 2017-10-06 16:50:04 -04:00 committed by GitHub
commit 9e81cc496a
3 changed files with 7 additions and 9 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
dist/ dist/
dist-es/ dist-es/
bundle.js bundle.js
/src/data/data.js

View File

@ -62,12 +62,12 @@
"webpack": "^3.6.0" "webpack": "^3.6.0"
}, },
"scripts": { "scripts": {
"clean": "rm -rf dist/ dist-es/", "clean": "rm -rf dist/ dist-es/ src/data/data.js",
"build:data": "node scripts/build-data", "build:data": "node scripts/build-data",
"build:dist": "npm run clean && npm run build:cjs && npm run build:es", "build:dist": "npm run build:cjs && npm run build:es",
"build:cjs": "BABEL_ENV=cjs babel src --out-dir dist --copy-files --ignore webpack.config.js", "build:cjs": "BABEL_ENV=cjs babel src --out-dir dist --copy-files --ignore webpack.config.js",
"build:es": "babel src --out-dir dist-es --copy-files --ignore webpack.config.js", "build:es": "babel src --out-dir dist-es --copy-files --ignore webpack.config.js",
"build": "npm run build:dist && npm run build:data", "build": "npm run clean && npm run build:data && npm run build:dist",
"watch": "BABEL_ENV=cjs babel src --watch --out-dir dist --copy-files --ignore webpack.config.js", "watch": "BABEL_ENV=cjs babel src --watch --out-dir dist --copy-files --ignore webpack.config.js",
"start": "npm run watch", "start": "npm run watch",
"stats": "webpack --config ./src/webpack.config.js --json > stats.json", "stats": "webpack --config ./src/webpack.config.js --json > stats.json",
@ -75,13 +75,13 @@
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev", "react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14 --save-dev",
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev", "react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15 --save-dev",
"test": "NODE_ENV=test karma start && size-limit", "test": "NODE_ENV=test karma start && size-limit",
"prepublish": "npm run clean && npm run build", "prepublish": "npm run build",
"storybook": "start-storybook -p 6006", "storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook" "build-storybook": "build-storybook"
}, },
"size-limit": [ "size-limit": [
{ {
"path": "dist/index.js", "path": "dist-es/index.js",
"limit": "80 KB" "limit": "80 KB"
} }
] ]

View File

@ -141,9 +141,6 @@ flags.emojis = flags.emojis.filter((flag) => {
}).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('dist/data/data.js', `module.exports = ${stringified}`, (err) => { fs.writeFile('src/data/data.js', `export default ${stringified}`, (err) => {
if (err) throw err if (err) throw err
fs.writeFile('dist-es/data/data.js', `export default ${stringified}`, (err) => {
if (err) throw err
})
}) })