Skip to content

Commit 8838499

Browse files
committed
Merge pull request kriasoft#526 from whynot123/master
Update tools/copy.js to clean up package.json before copying
2 parents 154c418 + 66d9b43 commit 8838499

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
"react-transform-catch-errors": "^1.0.2",
8282
"react-transform-hmr": "^1.0.4",
8383
"redbox-react": "^1.2.2",
84-
"replace": "^0.3.0",
8584
"stylelint": "^5.0.1",
8685
"stylelint-config-standard": "^4.0.1",
8786
"url-loader": "^0.5.7",

tools/copy.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
import path from 'path';
1111
import gaze from 'gaze';
12-
import replace from 'replace';
1312
import Promise from 'bluebird';
14-
13+
import fs from './lib/fs';
14+
import pkg from '../package.json';
1515
/**
1616
* Copies static files such as robots.txt, favicon.ico to the
1717
* output (build) folder.
@@ -22,16 +22,16 @@ async function copy({ watch } = {}) {
2222
await Promise.all([
2323
ncp('src/public', 'build/public'),
2424
ncp('src/content', 'build/content'),
25-
ncp('package.json', 'build/package.json'),
2625
]);
2726

28-
replace({
29-
regex: '"start".*',
30-
replacement: '"start": "node server.js"',
31-
paths: ['build/package.json'],
32-
recursive: false,
33-
silent: false,
34-
});
27+
await fs.writeFile('./build/package.json', JSON.stringify({
28+
private: true,
29+
engines: pkg.engines,
30+
dependencies: pkg.dependencies,
31+
scripts: {
32+
start: 'node server.js',
33+
},
34+
}, null, 2));
3535

3636
if (watch) {
3737
const watcher = await new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)