Last active
April 4, 2019 20:12
-
-
Save krisselden/174747ebcbfe98e3f5ba2e9f51e4df0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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