How to use the just-scripts-utils.spawn function in just-scripts-utils

To help you get started, we’ve selected a few just-scripts-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / just / packages / just-scripts / src / tasks / eslintTask.ts View on Github external
const eslintArgs = [
        eslintCmd,
        ...(files ? files : ['.']),
        ...['--ext', extensions ? extensions : '.js,.jsx,.ts,.tsx'],
        ...(noEslintRc ? '--no-eslintrc' : []),
        ...(eslintConfigPath ? ['--config', eslintConfigPath] : []),
        ...(eslintIgnorePath ? ['--ignore-path', eslintIgnorePath] : []),
        ...(resolvePluginsPath ? ['--resolve-plugins-relative-to', resolvePluginsPath] : []),
        ...(fix ? ['--fix'] : []),
        ...(maxWarnings !== undefined ? ['--max-warnings', `${maxWarnings}`] : []),
        '--color'
      ];

      logger.info(encodeArgs(eslintArgs).join(' '));
      return spawn(process.execPath, eslintArgs, { stdio: 'inherit' });
    } else {
      return Promise.resolve();
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / webpackTask.ts View on Github external
return function webpackDevServer() {
    if (devServerCmd && configPath && fs.existsSync(configPath)) {
      const mode = options.mode || 'development';
      const args = [...(options.nodeArgs || []), devServerCmd, '--config', configPath, '--open', '--mode', mode];

      logger.info(devServerCmd, encodeArgs(args).join(' '));
      return spawn(process.execPath, args, { stdio: 'inherit' });
    } else {
      logger.warn('no webpack.serve.config.js configuration found, skipping');
      return Promise.resolve();
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / jestTask.ts View on Github external
...(options.nodeArgs || []),
        jestCmd,
        '--config',
        configFile,
        ...(options.passWithNoTests ? ['--passWithNoTests'] : []),
        ...(options.colors !== false && supportsColor.stdout ? ['--colors'] : []),
        ...(options.runInBand ? ['--runInBand'] : []),
        ...(options.coverage ? ['--coverage'] : []),
        ...(options.watch ? ['--watch'] : []),
        ...(options.u || options.updateSnapshot ? ['--updateSnapshot'] : ['']),
        ...(options._ || [])
      ].filter(arg => !!arg) as Array;

      logger.info(cmd, encodeArgs(args).join(' '));

      return spawn(cmd, args, { stdio: 'inherit', env: options.env });
    } else {
      logger.warn('no jest configuration found, skipping jest');
      return Promise.resolve();
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / tscTask.ts View on Github external
const args = Object.keys(options).reduce(
        (args, option) => {
          if (typeof options[option] === 'string') {
            return args.concat(['--' + option, options[option] as string]);
          } else if (typeof options[option] === 'boolean') {
            return args.concat(['--' + option]);
          }

          return args;
        },
        [tscCmd]
      );

      const cmd = [...args, '--watch'];
      logger.info(encodeArgs(cmd).join(' '));
      return spawn(process.execPath, cmd, { stdio: 'inherit' });
    } else {
      Promise.resolve();
    }
  };
}