You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 vuosi sitten
123456789101112131415161718192021222324
  1. const ChildProcess = require('child_process');
  2. const Chalk = require('chalk');
  3. function compile(directory) {
  4. return new Promise((resolve, reject) => {
  5. const tscProcess = ChildProcess.exec('tsc', {
  6. cwd: directory,
  7. });
  8. tscProcess.stdout.on('data', data =>
  9. process.stdout.write(Chalk.yellowBright(`[tsc] `) + Chalk.white(data.toString()))
  10. );
  11. tscProcess.on('exit', exitCode => {
  12. if (exitCode > 0) {
  13. reject(exitCode);
  14. } else {
  15. resolve();
  16. }
  17. });
  18. });
  19. }
  20. module.exports = compile;