Skip to content

Commit 8448fd2

Browse files
committed
Moving package.json copy task to node script
1 parent 8519afa commit 8448fd2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"babel-preset-env": "1.4.0",
3636
"babel-preset-flow": "6.23.0",
3737
"copy-webpack-plugin": "4.0.1",
38+
"copyfiles": "^1.2.0",
3839
"cross-env": "3.1.3",
3940
"csv-streamify": "^3.0.4",
4041
"eslint": "^3.4.0",
@@ -57,7 +58,8 @@
5758
"webpack": "2.5.0"
5859
},
5960
"scripts": {
60-
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./src -d lib --ignore '__tests__' && cd src/ && rsync -Rv **/package.json ../lib",
61+
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./src -d lib --ignore '__tests__'",
62+
"postbuild-cjs": "node scripts/copy.packages.json.js",
6163
"build-umd": "cross-env NODE_ENV=development webpack",
6264
"build-min": "cross-env NODE_ENV=production webpack -p",
6365
"rebuild": "rimraf lib umd && npm run build-cjs && npm run build-umd && npm run build-min",

scripts/copy.packages.json.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const copyfiles = require('copyfiles');
4+
5+
const input = './src/**/package.json';
6+
const outputDir = './lib';
7+
8+
copyfiles([input, outputDir], {
9+
up: 1
10+
}, (err) => {
11+
if (err) {
12+
console.log('Error copying package.json files: ' + err);
13+
process.exit(1);
14+
} else {
15+
console.log('All package.json files copied correctly.');
16+
process.exit(0);
17+
}
18+
});

0 commit comments

Comments
 (0)