How to use the shelljs.exit function in shelljs

To help you get started, we’ve selected a few shelljs 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 spencermountain / compromise / scripts / testAll.js View on Github external
// run each plugin's tests:
let plugins = ['adjectives', 'dates', 'ngrams', 'numbers', 'output', 'paragraphs', 'sentences', 'syllables']
plugins.forEach(dir => {
  code = sh.exec(`tape "./plugins/${dir}/tests/**/*.test.js" | tap-dancer --color always`).code
  if (code !== 0) {
    console.log(dir)
    fail = true
  }
})

// return proper exit-code:
if (fail) {
  sh.exit(1)
} else {
  sh.exit(0)
}
github AgoraIO / Electron-SDK / scripts / build.js View on Github external
const install = () => {
  let platform = getPlatform();
  let electronArgs =
    argv.runtime === 'electron'
      ? ' --target=1.8.3 --dist-url=https://atom.io/download/electron'
      : '';
  let spinner = ora(`Building for production in ${argv.runtime} runtime`);
  let sh = '';

  if (platform === 'mac') {
    sh = 'node-gyp rebuild' + electronArgs;
  } else if (platform === 'win') {
    sh = 'node-gyp rebuild --arch=ia32 --msvs_version=2015' + electronArgs;
  } else {
    shell.echo(chalk.red('Sorry, this sdk only provide win32 and mac version.\n'));
    shell.exit(1);
    return false;
  }

  shell.echo('\n');
  spinner.start();

  let builder = shell.exec(sh, { silent: false, async: true });
  builder.stdout.on('data', data => {
    spinner.text = data;
  });
  builder.stderr.on('data', data => {
    shell.ShellString(data).to('error-log.txt');
  });
  builder.on('close', code => {
    if (code !== 0) {
      // Failed to build
github senntyou / lila / cmd / forever.js View on Github external
newContent = createMockExpressFile({dataPath: buildRoot + '/data', webRootPath: webRootPath, port: serverPort});
}
else {
    newContent = createStaticFile({path: webRootPath, port: serverPort});
}

// make server file
if (existContent != newContent) {
    fsExtra.outputFileSync(serverFilePath, newContent);
    serverFileExist && logger.info('Server config file changed');
}

var shellResult = shell.exec('forever ' + process.argv[3] + ' ' + serverFilePath + ' ' +  process.argv.slice(specifiedServerType ? 5 : 4).join(' '));
if (shellResult.code !== 0) {
    shell.echo(`Lila handle server failed for action [${process.argv[3]}], please try again`);
    shell.exit(1);
}

logger.success(`Lila ${process.argv[3]} ${serverType} server success for port[${serverPort}]`);
github standard / standard-demo / prep-eslint.js View on Github external
#!/usr/bin/env node
var fs = require('fs')
var path = require('path')
var sh = require('shelljs')

if (!sh.which('git')) {
  sh.echo('Sorry, this script requires git')
  sh.exit(1)
}

cloneOrPull('https://github.com/eslint/eslint', 'eslint')
cloneOrPull('https://github.com/xjamundx/eslint-plugin-standard', 'eslint-plugin-standard')

// This process is emulating parts of eslint's "browserify" makefile function
// https://github.com/eslint/eslint/blob/master/Makefile.js#L543

// remove load-rules.js
sh.rm('eslint/lib/load-rules.js')

// copy standard-plugin rules into the eslint rules
sh.cp('-f', 'eslint-plugin-standard/rules/*.js', 'eslint/lib/rules')

// create a new load-rules.js!
generateRulesIndex('eslint/lib/')
github cerner / terra-dev-site / scripts / release / release.js View on Github external
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
const shell = require('shelljs');

const releaseType = process.argv[2] || 'patch';

if (shell.exec(`npm run compile && npm run lint && npm version ${releaseType} -m "Released version %s" && npm publish && git push`).code !== 0) {
  shell.exit(1);
}

shell.exit(0);
github stream-labs / streamlabs-obs / bin / release.js View on Github external
const bar = new ProgressBar(`${name} [:bar] :percent :etas`, {
    total: 100,
    clear: true
  });

  upload.on('httpUploadProgress', progress => {
    bar.update(progress.loaded / progress.total);
  });

  try {
    await upload.promise();
  } catch (err) {
    error(`Upload of ${name} failed`);
    sh.echo(err);
    sh.exit(1);
  }
}
github AmnisIO / AmnisIO / bin / index.js View on Github external
})).then(() => {
            shell.echo('All done, thanks!\n');
            shell.exit(0);
          });
        });
github AdobeXD / xdpm / commands / bootstrap.js View on Github external
if (cdResult.code === 0) {
    shell.exec(
      `git filter-branch --subdirectory-filter "${sampleRepoDirname}"`,
      { silent: true }
    );
    shell.rm("-rf", `.git`);

    shell.echo(`Plugin was sucessfully bootstrapped in ${localDirname}`);
    shell.echo(
      `Be sure to get your unique plugin ID at ${consoleLink} and include it in manifest.json`
    );
  } else {
    shell.echo(`Unable to find bootstrapped plugin directory ${localDirname}`);

    shell.exit(1);
  }
}
github d3plus / d3plus-react / bin / build.js View on Github external
shell.exec(`rm -f build/${name}.zip && zip -j -q build/${name}.zip -- ${files.join(" ")}`, (code, stdout) => {
          if (code) kill(code, stdout);

          log.exit();
          shell.exit(0);

        });
github xiaomuzhu / create-component / src / cli / Init / init-command.ts View on Github external
private async gitInit() {
    const { proPath } = this.options

    if (!shell.which('git')) {
      shell.echo('Sorry, this script requires git')
      shell.exit(1)
    }
    await exec('git', ['init'], true, {
      cwd: proPath,
    })
  }
}