Browse Source

optimize deploy

pull/44/head
yiminghe 9 years ago
parent
commit
0ef8cd410f
  1. 2
      package.json
  2. 23
      scripts/install.js

2
package.json

@ -58,7 +58,7 @@
"pack": "npm run clean && webpack --optimize-minimize && nico build",
"start": "npm run clean && nico server --watch",
"clean": "rm -rf _site",
"deploy": "npm run pack && node scripts/deploy.js",
"deploy": "rm -rf node_modules && node scripts/install.js && npm run pack && node scripts/deploy.js",
"lint": "eslint components index.js --ext '.js,.jsx'",
"test": "webpack && npm run lint",
"prepublish": "npm run babel"

23
scripts/install.js

@ -0,0 +1,23 @@
function runCmd(cmd, args, fn) {
args = args || [];
var runner = require('child_process').spawn(cmd, args, {
// keep color
stdio: "inherit"
});
runner.on('close', function (code) {
if (fn) {
fn(code);
}
});
}
runCmd('which', ['tnpm'], function (code) {
var npm = 'npm';
if (!code) {
npm = 'tnpm';
}
console.log(npm + ' installing');
runCmd(npm, ['install'], function () {
console.log(npm + ' install end');
});
});
Loading…
Cancel
Save