runner.js 582 B

123456789101112131415161718
  1. const path = require('path')
  2. const childProcess = require('child_process')
  3. const typeCheck = () => {
  4. const tscExec = path.resolve(require.resolve('typescript'), '../../bin/tsc')
  5. const tscChild = childProcess.spawn(process.execPath, [tscExec, '--project', './ts-smoke/tsconfig.json'], {
  6. cwd: path.resolve(__dirname, '../')
  7. })
  8. tscChild.stdout.on('data', d => console.log(d.toString()))
  9. tscChild.stderr.on('data', d => console.error(d.toString()))
  10. tscChild.on('exit', (tscStatus) => {
  11. if (tscStatus !== 0) {
  12. process.exit(tscStatus)
  13. }
  14. })
  15. }
  16. typeCheck()