Better cross-platform support for building bb-server frontend

voting-booth-gui
Tal Moran 2017-07-06 12:00:04 +03:00
parent 931bb56378
commit 252a761005
3 changed files with 23 additions and 3 deletions

View File

@ -42,8 +42,7 @@ task generateProtobufBundle(type: NpmTask) {
// We need do this in doFirst since getProtoFiles won't find all subprojects
// until after configuration is complete
def protoFiles = getProtoFiles()
setEnvironment([PROTO_FILES: protoFiles.join(" ")]);
generateProtobufBundle.args = ['run', 'protoc']
generateProtobufBundle.args = ['run', 'protoc', '--' ] + protoFiles;
}
dependsOn npm_install

View File

@ -0,0 +1,21 @@
#!/usr/bin/env node
const { execFileSync } = require('child_process');
const bundlejs = 'src/app/bundle.js'
const bundlets = 'src/app/bundle.d.ts'
var pbjs_args = [
'-t', 'static-module', '-w', 'commonjs', '-o', bundlejs
].concat(process.argv.slice(2));
console.log("Running pbjs " + pbjs_args.join(" "));
var out = execFileSync('pbjs', pbjs_args);
console.log("" + out);
var pbts_args = [
'-o', bundlets, bundlejs
];
console.log("Running pbts " + pbts_args.join(" "));
out = execFileSync('pbts', pbts_args);
console.log("" + out);

View File

@ -10,7 +10,7 @@
"lint": "ng e2e",
"pbts": "pbts",
"pbjs": "pbjs",
"protoc" : "pbjs -t static-module -w commonjs -o src/app/bundle.js $PROTO_FILES && pbts -o src/app/bundle.d.ts src/app/bundle.js"
"protoc" : "./generate-protobuf.js"
},
"private": true,
"dependencies": {