How to use the execa.commandSync 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 flow-typed / flow-typed / definitions / npm / execa_v2.x.x / test_execa_v2.x.x.js View on Github external
it('should accept options', () => {
    execa.commandSync('ls pipe', { stderr: 'pipe' }).then(printStdout);
    execa.commandSync('ls pipe', { stderr: 10 }).then(printStdout);
    execa.commandSync('ls pipe', { input: 'foobar' });
    execa.commandSync('ls pipe', { input: new Buffer('foobar') });
    execa.commandSync('ls pipe', { input: process.stdin });
    // $ExpectError
    execa.commandSync('ls pipe', { foo: 666 });
    // $ExpectError
    execa.commandSync('ls pipe', { input: 42 });
  });
  it('should not accept args', () => {
github SAP / generator-easy-ui5 / test / basic.js View on Github external
it('should create an buildable project', function () {
				return execa.commandSync('npm run build:mta');
			});
		}
github tulios / kafkajs / scripts / pipeline / updatePackageJsonForPreRelease.js View on Github external
console.log(`${env}=${process.env[env]}`)
}

const PRE_RELEASE_VERSION = process.env.PRE_RELEASE_VERSION || process.env.BASH2_PRE_RELEASE_VERSION

if (!PRE_RELEASE_VERSION) {
  throw new Error('Missing PRE_RELEASE_VERSION env variable')
}

if (!/\d+\.\d+\.\d+-beta\.\d+/.test(PRE_RELEASE_VERSION)) {
  throw new Error(`Invalid PRE_RELEASE_VERSION: ${PRE_RELEASE_VERSION}`)
}

console.log('Update package.json')
const packageJson = require('../../package.json')
const commitSha = execa
  .commandSync('git rev-parse --verify HEAD', { shell: true })
  .stdout.toString('utf-8')
  .trim()

getCurrentVersion().then(({ latest }) => {
  packageJson.version = PRE_RELEASE_VERSION
  packageJson.kafkajs = {
    sha: commitSha,
    compare: `https://github.com/tulios/kafkajs/compare/v${latest}...${commitSha}`,
  }

  console.log(packageJson.kafkajs)
  const filePath = path.resolve(__dirname, '../../package.json')
  fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2))
  console.log(`Package.json updated with pre-release version ${PRE_RELEASE_VERSION}`)
})
github ecomfe / santd / scripts / release.js View on Github external
async function getReleaseVersion(current = '0.1.0') {
    try {
        current = execa.commandSync('npm view santd version --registry http://registry.npmjs.com').stdout.trim();
    }
    catch (e) {
        if (!~e.toString().indexOf('404 no such package available')) {
            console.log(e);
            process.exit(1);
        }
        else {
            return current;
        }
    }

    console.log('Santd current version is: ' + current);

    const bumps = ['patch', 'minor', 'major', 'prerelease'];
    const versions = {};
    bumps.forEach(b => {
github tulios / kafkajs / scripts / pipeline / checkBetaEligibility.js View on Github external
#!/usr/bin/env node

const execa = require('execa')
const { SKIP_BETA_ELIGIBILITY } = process.env

const changedFiles = execa
  .commandSync('git diff --name-only HEAD^1...HEAD', { shell: true })
  .stdout.toString('utf-8')
  .trim()
  .split('\n')

console.log('Env:')
for (const env of Object.keys(process.env)) {
  console.log(`${env}=${process.env[env]}`)
}

console.log(`SKIP_BETA_ELIGIBILITY: "${SKIP_BETA_ELIGIBILITY}"`)

const eligible = filePath =>
  ['index.js', 'package.json'].includes(filePath) || /^(src|types)\//.test(filePath)

if (SKIP_BETA_ELIGIBILITY) {
github tulios / kafkajs / scripts / waitForKafka.js View on Github external
const waitForNode = containerId => {
  const cmd = `
    docker exec \
      ${containerId} \
      bash -c "JMX_PORT=9998 kafka-topics --zookeeper zookeeper:2181 --list 2> /dev/null"
    sleep 5
  `

  execa.commandSync(cmd, { shell: true })
  console.log(`Kafka container ${containerId} is running`)
}
github tulios / kafkajs / scripts / waitForKafka.js View on Github external
const findContainerId = node => {
  const cmd = `
    docker ps \
      --filter "status=running" \
      --filter "label=custom.project=kafkajs" \
      --filter "label=custom.service=${node}" \
      --no-trunc \
      -q
  `
  const containerId = execa.commandSync(cmd, { shell: true }).stdout.toString('utf-8')
  console.log(`${node}: ${containerId}`)
  return containerId
}
github pomber / code-surfer / sites / build.js View on Github external
const siteBuilds = siteDirNames.map(async siteDirName => {
    console.log(`

    --- building ${siteDirName} ---

    `);
    const cwd = join(__dirname, siteDirName);
    const { stdout, stderr } = process;

    execa.commandSync("yarn", { cwd, stdout, stderr });
    execa.commandSync("yarn build", { cwd, stdout, stderr });

    if (fs.existsSync(join(cwd, "dist"))) {
      await fs.copy(join(cwd, "dist"), join(__dirname, "dist", siteDirName));
    } else if (fs.existsSync(join(cwd, "build"))) {
      await fs.copy(join(cwd, "build"), join(__dirname, "dist", siteDirName));
    } else {
      await fs.copy(join(cwd, "public"), join(__dirname, "dist", siteDirName));
    }
  });
github ant-design / ant-design-pro-cli / src / fetch-blocks / index.js View on Github external
const execCmd = (shell, cwd) => {
  const debug = process.env.DEBUG === 'pro-cli';
  return execa.commandSync(shell, {
    encoding: 'utf8',
    cwd,
    env: {
      ...process.env,
      PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true,
    },
    stderr: debug ? 'inherit' : 'pipe',
    stdout: debug ? 'inherit' : 'pipe',
  });
};