How to use the cross-spawn.default.sync function in cross-spawn

To help you get started, we’ve selected a few cross-spawn 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 spotify / web-scripts / packages / web-scripts / src / Tasks / TestTask.ts View on Github external
export function testTask(task: TestTaskDesc): SpawnSyncReturns {
  // `coverageDirectory` is necessary because the root is `src`
  const cmd = 'npx';
  const config = task.config || getJestConfig();

  const args = [
    '--no-install',
    'jest',
    ...(config ? ['--config', config] : []),
    ...task.restOptions,
  ];
  dbg('npx args %o', args);
  return spawn.sync(cmd, args, { stdio: 'inherit' });
}
github spotify / web-scripts / packages / web-scripts / src / Tasks / CommitTasks.ts View on Github external
export function commitMsgTask(
  task: CommitMsgTaskDesc,
): SpawnSyncReturns {
  const cmd = 'npx';
  const args = [
    '--no-install',
    'commitlint',
    `--config=${task.config}`,
    `--edit=${process.env.HUSKY_GIT_PARAMS}`,
    ...task.restOptions,
  ];
  dbg('npx args %o', args);
  return spawn.sync(cmd, args, { stdio: 'inherit' });
}
github spotify / web-scripts / packages / web-scripts / src / Tasks / CommitTasks.ts View on Github external
export function releaseTask(task: ReleaseTaskDesc): SpawnSyncReturns {
  const cmd = 'npx';
  const args = ['--no-install', 'semantic-release', ...task.restOptions];
  dbg('npx args %o', args);
  return spawn.sync(cmd, args, { stdio: 'inherit' });
}
github spotify / web-scripts / packages / web-scripts / src / Tasks / CommitTasks.ts View on Github external
...process.env,
    WEB_SCRIPTS_SHOULD_FIX: task.fix.toString(),
    WEB_SCRIPTS_RUN_TESTS: task.tests.toString(),
  };

  if (task.eslintConfig) {
    env.WEB_SCRIPTS_ESLINT_CONFIG = task.eslintConfig;
  }
  if (task.jestConfig) {
    env.WEB_SCRIPTS_JEST_CONFIG = task.jestConfig;
  }
  if (task.prettierConfig) {
    env.WEB_SCRIPTS_PRETTIER_CONFIG = task.prettierConfig;
  }

  return spawn.sync(cmd, args, {
    stdio: 'inherit',
    env,
  });
}
github spotify / web-scripts / packages / web-scripts / src / Tasks / FormatTask.ts View on Github external
export function formatTask(task: FormatTaskDesc): SpawnSyncReturns {
  const cmd = 'npx';
  const config = task.config || getPrettierConfig();

  const args = [
    '--no-install',
    'prettier',
    ...(config ? ['--config', config] : []),
    ...task.restOptions,
  ];
  dbg('npx args %o', args);
  return spawn.sync(cmd, args, { stdio: 'inherit' });
}