How to use the flex-dev-utils.spawn function in flex-dev-utils

To help you get started, we’ve selected a few flex-dev-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 twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / index.ts View on Github external
markedRender(docPath);
    return process.exit(0);
  }

  const nodeArgs = scriptIndex > 0 ? argv.slice(0, scriptIndex) : [];
  const scriptPath = require.resolve(`./scripts/${script}`);
  const scriptArgs = argv.slice(scriptIndex + 1);
  const processArgs = nodeArgs.concat(scriptPath).concat(scriptArgs);

  // Temp disallow version while we figure this out
  if (script !== 'test') {
    processArgs.push('--disallow-versioning');
  }

  // Run the script
  const { exitCode } = await spawn('node', processArgs);

  // Exit if not an embedded script
  if (argv.includes('--process-exit') || !isRequiredScript()) {
    process.exit(exitCode);
  }
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / index.ts View on Github external
markedRender(docPath);
    return process.exit(0);
  }

  const nodeArgs = scriptIndex > 0 ? argv.slice(0, scriptIndex) : [];
  const scriptPath = require.resolve(`./scripts/${script}`);
  const scriptArgs = argv.slice(scriptIndex + 1);
  const processArgs = nodeArgs.concat(scriptPath).concat(scriptArgs);

  // Temp disallow version while we figure this out
  if (script !== 'test') {
    processArgs.push('--disallow-versioning');
  }

  const { exitCode } = await spawn('node', processArgs);
  exit(exitCode, argv);
};
github twilio / flex-plugin-builder / packages / create-flex-plugin / src / lib / commands.ts View on Github external
export const installDependencies = async (config: FlexPluginArguments): Promise => {
  const shellCmd = config.yarn ? 'yarn' : 'npm';
  const args = ['install'];
  const options = {
    cwd: config.targetDirectory,
    shell: process.env.SHELL,
  };

  const { stdout, exitCode, stderr } = await spawn(shellCmd, args, options);

  if (exitCode === 1) {
    throw new Error(stderr);
  }

  return stdout;
};