How to use the shelljs.rm 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 kickstarts / kickstarts / init / bp-ngbs.js View on Github external
var error = cli.red.bold,
    info  = cli.cyan,
    done  = cli.green;

// Check
var nodeCheck = sh.which('node');


// Welcome Message
sh.echo(info('→ Initializing...'));

// Create
sh.echo(info('→ Creating Structure'));
sh.rm('-rf', ['./node_modules', './.git', '.gitignore', '.editorconfig', '.travis.yml', 'newproject.js', 'package.json', 'README.md', 'logo-bp.jpg']);
sh.mv('./init/templates/webapp/ng-app/*', './');
sh.rm('-rf', ['./init', './lib']);

// Setup
sh.echo(info('→ Setting up project'));

sh.cd('./src');

if (!nodeCheck) {
    sh.echo(error('✖ This task requires NodeJS to run.'));
    process.exit(1);
} else {
    sh.exec('sudo npm install');
    sh.exec('npm run build');
}

sh.echo(done('✔ All Done!'));
github livepeer / LivepeerDesktop / app / main.js View on Github external
// log.transports.file.file = __dirname + '/log.txt';
  log.transports.file.file = homeDir + '/Livepeer/log.txt';
  
  // fs.createWriteStream options, must be set before first logging 
  log.transports.file.streamConfig = { flags: 'w' };
  
  // set existed file stream 
  if (!fs.existsSync(homeDir+"/Livepeer/")) {
    console.log("Making Logging Dir")
    shell.mkdir('-p', homeDir+"/Livepeer/");
  }
  //Remove log file if it's too big
  if (fs.existsSync(homeDir+"/Livepeer/log.txt")) {
    var stats = fs.statSync(homeDir+"/Livepeer/log.txt")
    if (stats.size > 10*1000*1000) { 
      shell.rm(homeDir+"/Livepeer/log.txt")
    }
  }
  log.transports.file.stream = fs.createWriteStream(homeDir + '/Livepeer/log.txt', {'flags': 'a'});

  log.transports.file.appName = 'LivepeerDesktop';
}
github wojtkowiak / meteor-desktop / lib / electronApp.js View on Github external
extractModules(extract) {
        const ext = ['.js', '.bat', '.sh', '.cmd', ''];

        if (extract.length > 0) {
            if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModules)) {
                shell.rm('-rf', this.$.env.paths.electronApp.extractedNodeModules);
            }
            fs.mkdirSync(this.$.env.paths.electronApp.extractedNodeModules);
            fs.mkdirSync(this.$.env.paths.electronApp.extractedNodeModulesBin);

            extract.forEach((module) => {
                fs.renameSync(
                    path.join(this.$.env.paths.electronApp.appRoot, 'node_modules', module),
                    path.join(this.$.env.paths.electronApp.extractedNodeModules, module),
                );
                // Move bins.
                this.extractBin(module, ext);
            });

            return true;
        }
        return false;
github Gyumeijie / github-files-fetcher / src / index.js View on Github external
function cleanUpOutputDirectory() {
  if (rootDirectoryForCleanUp !== undefined) {
    shell.rm('-rf', rootDirectoryForCleanUp);
    return;
  }

  if (fileStats.doesDownloadDirectory) {
    shell.rm('-rf', localRootDirectory);
  } else {
    // Mainly for remove .zip file, when download a whole repo
    shell.rm('-f', localRootDirectory + currentDownloadingFile);
  }
}
github kickstarts / kickstarts / init / bp-webbs.js View on Github external
// Messages
var error = cli.red.bold,
    info  = cli.cyan,
    done  = cli.green;

// Check
var nodeCheck = sh.which('node');


// Scaffolding
// ----------------------------------

sh.echo(info('→ Initializing...'));

sh.rm('-rf', ['./node_modules', './.git', '.gitignore', '.editorconfig', '.travis.yml', 'newproject.js', 'package.json', 'README.md', 'logo-bp.jpg']);

sh.echo(info('→ Creating Structure...'));
sh.mv('./init/templates/general/web-bs/*', './');
sh.rm('-rf', ['./init']);
sh.echo(done('✔ Created!'));


// Setup
// ----------------------------------

sh.echo(info('→ Setting up project...'));

// Move on to "./src" folder
sh.cd('./src');

// Check if NodeJS exists and install dependencies
github electrode-io / electrode-native / system-tests / regen-fixtures.js View on Github external
function regenApiImplNativeFixture() {
  logHeader('Regenerating Native API Implementation Fixture')
  shell.rm('-rf', pathsToFixtures['api-impl-native'])
  shell.exec(
    `ern create-api-impl ${f.movieApiPkgName} -p ${
      f.movieApiImplPkgName
    } --skipNpmCheck --nativeOnly --outputDirectory ${
      pathsToFixtures['api-impl-native']
    } --force`
  )
}
github yfinkelstein / node-zookeeper / scripts / prepublish.js View on Github external
function clearPath() {
    if (!shell.test('-d', env.sourceFolder)) {
        return;
    }

    shell.rm('-rf', env.sourceFolder);
}
github angular / components / scripts / build-packages-dist.js View on Github external
packageNames.forEach(pkgName => {
    const outputPath = getOutputPath(pkgName);
    if (test('-d', outputPath)) {
      chmod('-R', 'u+w', outputPath);
      rm('-rf', outputPath);
    }
  });
github weexteam / xtoolkit-for-Apache-Weex / src / xtoolkit.js View on Github external
}
    for (const key in this._commands) {
      const command = this._commands[key];
      if (key === nameOrAlias || command.package.name === nameOrAlias) {
        packagePath = command.package.path;
        packageName = command.package.name;
        break;
      }
    }
    if (packageName || packagePath) {
      if (!packagePath) {
        packagePath = path.join(utils.homePath(), 'node_modules', packageName);
      }
      if (fs.existsSync(packagePath)) {
        try {
          shell.rm('-rf', packagePath);
          logger.success(`Remove package \`${packageName}\` successful...`);
        }
        catch (e) {
          logger.error(e);
        }
      }
    }
    else {
      logger.error(`Cannot found the \`${nameOrAlias}\` as alias or package name, please check`);
    }
  }
github gautamsi / ews-javascript-api / scripts / build.js View on Github external
function cleanupDef() {
  rm(typingSource);
}
function copyFiles() {