commit 66d9b43c841389fe8302ce054205d9cb1e0c8eac
parent 154c41818f03ce9f1c655e1201d741410dc400ca
Author: whynot123 <xxxxxxxxxxxxxxxxxxxxx@gmail.com>
Date: Tue, 22 Mar 2016 19:42:10 +0300
Update tools/copy.js to clean up package.json before copying
Diffstat:
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/package.json b/package.json
@@ -81,7 +81,6 @@
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.2",
- "replace": "^0.3.0",
"stylelint": "^5.0.1",
"stylelint-config-standard": "^4.0.1",
"url-loader": "^0.5.7",
diff --git a/tools/copy.js b/tools/copy.js
@@ -9,9 +9,9 @@
import path from 'path';
import gaze from 'gaze';
-import replace from 'replace';
import Promise from 'bluebird';
-
+import fs from './lib/fs';
+import pkg from '../package.json';
/**
* Copies static files such as robots.txt, favicon.ico to the
* output (build) folder.
@@ -22,16 +22,16 @@ async function copy({ watch } = {}) {
await Promise.all([
ncp('src/public', 'build/public'),
ncp('src/content', 'build/content'),
- ncp('package.json', 'build/package.json'),
]);
- replace({
- regex: '"start".*',
- replacement: '"start": "node server.js"',
- paths: ['build/package.json'],
- recursive: false,
- silent: false,
- });
+ await fs.writeFile('./build/package.json', JSON.stringify({
+ private: true,
+ engines: pkg.engines,
+ dependencies: pkg.dependencies,
+ scripts: {
+ start: 'node server.js',
+ },
+ }, null, 2));
if (watch) {
const watcher = await new Promise((resolve, reject) => {