How to use the shelljs.pwd 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 arboleya / electrify / bin / cli.js View on Github external
if(program.output && !fs.existsSync(program.output)) {
    console.error('output folder doesn\'t exist\n  ' + program.output);
    process.exit();
  }

  // if electrify folder doesn't exist
  if(create) {

    // get list of meteor installed packages
    var list = fs.readFileSync(join(input, '.meteor', 'packages'), 'utf-8');

    // check if electrify is installed
    if(!/^\s*arboleya:electrify\s*$/gm.test(list)) {

      // if its not installed, install it
      var pwd = shell.pwd();
      
      shell.cd(input);
      shell.exec('meteor add arboleya:electrify');
      shell.cd(pwd);
    }
  }

  return require('..')(
    join(input, '.electrify'),
    program.output,
    parse_meteor_settings(),
    true
  );
}
github icfnext / iron / dist / operations / create-project.js View on Github external
module.exports = function (program) {

    var currentDir = shell.pwd().stdout.split("/")[shell.pwd().stdout.split("/").length - 1];

    var config = {
        name: program.args[0],
        // default_components  : [],
        iron_build_root: program.args[0] + '-iron-fe',
        style_language: 'scss',
        templateConfigs: customTemplatesConfig
    };

    config.clientlib_base_category = createClientLibBaseCat(config.name);

    try {
        var parentPom = fs.readFileSync('pom.xml').toString();

        pomBuilder(config.name, parentPom, config.iron_build_root);
    } catch (err) {
github AgoraIO / Electron-SDK / scripts / debug.js View on Github external
builder.on('close', code => {
    if (code !== 0) {
      // Failed to build
      spinner.fail(chalk.red('Build failed'));
      shell.echo('A complete log of this run can be found in:');
      shell.echo('    ' + shell.pwd() + '/error-log.txt\n');
    } else {
      spinner.succeed(chalk.green('Build complete'));
      if (platform === 'mac') {
        // Generate xcode project file
        let anotherSpinner = ora('Generating project file...').start();
        if (shell.exec('node-gyp configure -- -f xcode', { silent: true }).code !== 0) {
          anotherSpinner.fail(chalk.red('Generate failed'));
        } else {
          anotherSpinner.succeed(chalk.green('Generate complete'));
          shell.echo(
            chalk.green(
              'Now you can find binding.xcodeproj and sdk for debug env under ./build\n'
            )
          );
        }
      } else {
github axlemax / sfdx / config / config.js View on Github external
const joinPath = require('path').join
const fs = require('fs')
const shell = require('shelljs')

const localConfigPath = joinPath(shell.pwd().stdout, 'config')

// Load default config
const config = require('./default')

// Load all local files
let externalConfigFileList = []
if (fs.existsSync(localConfigPath)) {
  externalConfigFileList = fs.readdirSync(localConfigPath)
  externalConfigFileList = externalConfigFileList.filter(fileName => {
    return fileName.includes('sfdx')
  })
}

for (let file of externalConfigFileList) {
  const configFile = require(joinPath(localConfigPath, file))
  for (let prop in configFile) {
github erbridge / itchy-electron / bin / itchy.js View on Github external
function invoke(env) {
    if (shell.pwd() !== env.cwd) {
      shell.cd(env.cwd);
    }

    let appPackage;
    let config;

    try {
      appPackage = require(path.join(env.cwd, 'package'));  // eslint-disable-line global-require
    } catch (err) {
      appPackage = {};
    }

    if (env.configPath) {
      config = require(env.configPath);  // eslint-disable-line global-require
    } else {
      config = appPackage.itchyElectron || {};
github jonycheung / deadsimple-less-watch-compiler / tests / lessWatchCompilerUtils.js View on Github external
var assert = require("assert"),
    lessWatchCompilerUtils = require('../dist/lib/lessWatchCompilerUtils.js'),
    sh = require('shelljs'),
    cwd = sh.pwd().toString(),
    testroot = cwd+'/tests/less/',
    testRelative = './tests/less';

describe('lessWatchCompilerUtils Module API', function () {
    describe('Should have the following API\'s', function () {
        describe('walk()', function () {
            it('walk() function should be there', function () {
                assert.equal("function", typeof (lessWatchCompilerUtils.walk));
            });
            it('walk() function should return an object of files ', function (done) {
                var timeout;
                lessWatchCompilerUtils.walk(testroot, {}, function (err, files) {
                    for (var i in files) {
                        assert.equal("object", typeof (files[i]));
                    }
                }, function () {});
github thinktecture / boardz-cross-platform-sample / gulpTasks / cordova.js View on Github external
gulp.task('[private-cordova]:copy-source', function () {
            console.log('COPY-SOURCE', sh.pwd());

            return gulp.src(path.join(config.targets.buildFolder, '**', '*.*'))
                .pipe(gulp.dest(path.join(config.targets.cordovaFolder, 'www')));
        });
github icfnext / iron / lib / utils / getClientLibs.js View on Github external
function findClientLibs( cb ){

    pathToProjectRoot();
    shell.cd( '..' );

    var dir             = shell.pwd();

    var recursive       = require('recursive-readdir');
    var fs              = require('fs');
    var libs            = [];

    recursive(dir.stdout,
        [
            'node_modules',
            '*.js',
            '*.jsp',
            '*.png',
            '*.gif',
            '*.java',
            '*.groovy',
            '*.jpeg',
            '*.class',
github gabrielmoreira / riot-router / examples / node_modules / riot / lib / server / cli.js View on Github external
function toRelative(path) {
  return path.replace(sh.pwd() + '/', '')
}
github binci / binci / src / lib / config.js View on Github external
const parsers = require('./parsers')
const pkg = require('./../../package.json')

const config = {
  /**
   * Generate random instance string
   */
  instance: Date.now(),
  /**
   * Object to contain runtime opts
   */
  manifest: {},
  /**
   * Current working directory
   */
  cwd: shelljs.pwd(),
  /**
   * Get arguments
   */
  args: min(process.argv.slice(process.argv[0] === 'node' ? 1 : 2)),
  /**
   * Help message template
   */
  helpMsg: `
    ${pkg.name} v.${pkg.version}\n
    Usage: ${pkg.name} task [options]\n
      -h   Show this help message
      -v   Show current version
      -i   Run container with STDIN support
      -e   Run custom command(s): -e "some command"
      -f   Set FROM (Docker image): -f "container:tag"
      -c   Set config to load (YAML): -c "/path/to/config.yml