Better win compatibility for bb-server frontent

voting-booth-gui
Tal Moran 2017-07-09 11:09:07 +03:00
parent 252a761005
commit 73619b0c9e
2 changed files with 15 additions and 4 deletions

View File

@ -1,15 +1,26 @@
#!/usr/bin/env node #!/usr/bin/env node
const { execFileSync } = require('child_process'); const { execFileSync } = require('child_process');
const path = require('path');
const isWin = (process.platform === 'win32');
const bundlejs = 'src/app/bundle.js' const bundlejs = 'src/app/bundle.js'
const bundlets = 'src/app/bundle.d.ts' const bundlets = 'src/app/bundle.d.ts'
const npm = isWin ? 'npm.cmd' : 'npm';
var args = process.argv.slice(2).map(function(x) {
return path.normalize(x);
});
var pbjs_args = [ var pbjs_args = [
'-t', 'static-module', '-w', 'commonjs', '-o', bundlejs '-t', 'static-module', '-w', 'commonjs', '-o', bundlejs
].concat(process.argv.slice(2)); ].concat(args);
console.log("Running pbjs " + pbjs_args.join(" ")); console.log("Running pbjs " + pbjs_args.join(" "));
var out = execFileSync('pbjs', pbjs_args); var out = execFileSync(npm, ['run', 'pbjs', '--'].concat(pbjs_args));
console.log("" + out); console.log("" + out);
var pbts_args = [ var pbts_args = [
@ -17,5 +28,5 @@ var pbts_args = [
]; ];
console.log("Running pbts " + pbts_args.join(" ")); console.log("Running pbts " + pbts_args.join(" "));
out = execFileSync('pbts', pbts_args); out = execFileSync(npm, ['run', 'pbts', '--'].concat(pbts_args));
console.log("" + out); console.log("" + out);

View File

@ -10,7 +10,7 @@
"lint": "ng e2e", "lint": "ng e2e",
"pbts": "pbts", "pbts": "pbts",
"pbjs": "pbjs", "pbjs": "pbjs",
"protoc" : "./generate-protobuf.js" "protoc" : "node ./generate-protobuf.js"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {