How to use the execa.command function in execa

To help you get started, we’ve selected a few execa 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 apache / cordova-lib / src / plugman / install.js View on Github external
if (dep.url === '.') {
        // Look up the parent plugin's fetch metadata and determine the correct URL.
        var fetchdata = require('./util/metadata').get_fetch_metadata(install.plugins_dir, install.top_plugin_id);
        if (!fetchdata || !(fetchdata.source && fetchdata.source.type)) {
            relativePath = dep.subdir || dep.id;

            events.emit('warn', 'No fetch metadata found for plugin ' + install.top_plugin_id + '. checking for ' + relativePath + ' in ' + options.searchpath.join(','));

            return Promise.resolve(relativePath);
        }

        // Now there are two cases here: local directory, and git URL.
        if (fetchdata.source.type === 'local') {
            dep.url = fetchdata.source.path;

            return execa.command('git rev-parse --show-toplevel', { cwd: dep.url })
                .catch(err => {
                    if (err.exitCode === 128) {
                        throw new Error('Plugin ' + dep.id + ' is not in git repository. All plugins must be in a git repository.');
                    } else {
                        throw new Error('Failed to locate git repository for ' + dep.id + ' plugin.');
                    }
                })
                .then(({ stdout: git_repo }) => {
                    // Clear out the subdir since the url now contains it
                    var url = path.join(git_repo, dep.subdir);
                    dep.subdir = '';
                    return Promise.resolve(url);
                }).catch(function () {
                    return Promise.resolve(dep.url);
                });
        } else if (fetchdata.source.type === 'git') {
github ashmind / mirrorsharp / WebAssets / build.js View on Github external
task('ts', async () => {
    await execa.command('eslint ./ts --max-warnings 0 --ext .js,.jsx,.ts,.tsx', {
        preferLocal: true,
        stdout: process.stdout,
        stderr: process.stderr
    });

    await execa.command('tsc --project ./ts/tsconfig.json --module ES2015 --noEmit false --outDir ./dist --declaration true', {
        preferLocal: true,
        stdout: process.stdout,
        stderr: process.stderr
    });

    // Add .js extension to all imports.
    // Technically TypeScript already resolves .js to .ts, but it's a hack.
    await Promise.all((await fg(['dist/**/*.js'])).map(async path => {
        const content = await jetpack.readAsync(path);
        const replaced = content.replace(/from '(\.[^']+)';/g, "from '$1.js';");
github netlify / build / packages / netlify-plugin-monorepo / index.js View on Github external
async function gitBranchName() {
  try {
    const { stdout } = await execa.command('git rev-parse --abbrev-ref HEAD')
    return stdout.trim()
  } catch (e) {
    console.log(`gitBranchName Error`, e)
  }
}
github ovh / manager / scripts / common / repository.js View on Github external
deleteSmokeTag() {
    return execa.command(`git tag -d ${this.name}@${this.version}`, {
      shell: true,
    });
  }
github madlabsinc / mevn-cli / src / commands / serve / launch.js View on Github external
installDepsSpinner.fail(
      `Something went wrong. Couldn't install the dependencies!`,
    );
    throw err;
  }
  installDepsSpinner.succeed(`You're all set`);

  if (templateDir === 'server' && projectTemplate === 'Nuxt-js')
    process.chdir('server');

  const launchSpinner = new Spinner(
    'The default browser will open up in a while',
  );

  launchSpinner.start();
  Promise.all([execa.command('npm run dev'), open(`${rootPath}:${port}`)]);
  launchSpinner.info(`Available on ${rootPath}:${port}`);
};
github netlify / build / packages / run-utils / src / main.js View on Github external
const runCommand = function(command, options) {
  const optionsA = { ...DEFAULT_OPTIONS, ...options }
  const childProcess = execa.command(command, optionsA)
  redirectOutput(childProcess, optionsA)
  return childProcess
}
github ovh / manager / scripts / build.js View on Github external
_modules.map((pck) =>
      execa
        .command(
          `lerna list -alp --include-filtered-dependencies --json --scope="${pck.name}"`,
          { shell: true },
        )
        .then(({ stdout }) => {
          const dependents = JSON.parse(stdout).filter(
            (p) => p.name !== pck.name,
          );
          return Object.assign(pck, { dependents });
        }),
    ),
github intraxia / wp-gistpen / commands / E2ECommand.tsx View on Github external
async startup() {
    await execa.command('wp-scripts env start');
    return 'Started!';
  },
github prisma / prisma2 / cli / introspection / src / prompt / screens / Step60DownloadExample.tsx View on Github external
async function isYarnInstalled(): Promise {
  try {
    const result = await execa.command(`yarn --version`, { stdio: `ignore` })
    debug('result', result)
    return true
  } catch (err) {
    debug('failed', err)
    return false
  }
}
github getholo / dashboard / src / variables / backend.ts View on Github external
async function migrate() {
  await ensureFile(path);
  await execa.command('npm run up');
  migrated = true;
}