Skip to content

Instantly share code, notes, and snippets.

@krisselden
Last active April 4, 2019 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisselden/174747ebcbfe98e3f5ba2e9f51e4df0c to your computer and use it in GitHub Desktop.
Save krisselden/174747ebcbfe98e3f5ba2e9f51e4df0c to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
const path = require('path');
const child_process = require('child_process');
main();
async function main() {
await yarnRun(
'pbjs',
'-t',
'static-module',
'-w',
'commonjs',
'-o',
'proto/index.js',
'proto/index.proto'
);
await yarnRun('pbts', '-o', 'proto/index.d.ts', 'proto/index.js');
await yarnRun('tsc');
}
function yarnRun(...args) {
const child = child_process.spawn('yarn', ['run', ...args], {
cwd: path.resolve(__dirname, '..'),
stdio: 'inherit',
});
return new Promise((resolve, reject) => {
child.on('exit', resolve);
child.on('error', reject);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment