How to use rimraf - 10 common examples

To help you get started, we’ve selected a few rimraf 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 sebpiq / rhizome / test / browser / websocket-server.js View on Github external
var config = req.body
        , asyncOps = [
          wsServer.stop.bind(wsServer)
        ]
      
      if (connections.manager)
        asyncOps.push(connections.manager.stop.bind(connections.manager))
      
      // See https://github.com/websockets/ws/pull/605
      if (wsServer._wsServer) {
        wsServer._wsServer._server.removeAllListeners('upgrade')
        wsServer._wsServer._server.removeAllListeners('error')
        wsServer._wsServer._server.removeAllListeners('listening')
      }
      
      if (config.store) asyncOps.push(rimraf.bind(rimraf, config.store))
      
      async.series(asyncOps, (err) => {
        if (err) throw err
        setTimeout(() => res.end(), 10)
      })
    })
github RisingStack / anchor / src / chart.js View on Github external
name = 'my-chart',
  description = '',
  version = '0.1.0'
}) {
  const outputTemplatePath = path.join(outputPath, 'templates')
  const filePath = path.join(outputPath, 'Chart.yaml')
  const chart = {
    apiVersion: 'v1',
    description,
    name,
    version
  }

  // Recreate folder
  if (overwrite) {
    rimraf.sync(outputPath)
    mkdirp.sync(outputPath)
  }
  mkdirp.sync(outputTemplatePath)

  return saveToYAMLFile(filePath, chart)
}
github oscar-broman / Prawn / lib / prawn / 2-post-pre.js View on Github external
}, function(err, result) {
    try {
      rimraf.rimrafSync(dir);
    } catch (e) {}

    var errCount = 0;

    // Put the correct filenames in any error messages
    if (result.errors) {
      result.errors.forEach(function(error) {
        var match = error.file.match(/(\d+)\.inc/);

        if (match) {
          var index = +match[1];

          index = info.postFileIndexes[index];

          error.file = info.prePreTree.allFiles[index].realFile;
        }
github oscar-broman / Prawn / lib / prawn / 2-post-pre.js View on Github external
try {
    var dir = temp.mkdirSync('prawn');

    // Remove #file and #endinput directives
    info.ppScript = info.ppScript.replace(/^#(file|endinput).*?$/gm, '');

    // Build a tree from the flat lst-file
    info.fileTree = _buildFileTree(info.ppScript, 0, info.ppScript.indexOf('START_OF_@0();') + 14);

    // Save that tree in a folder. postFileIndexes will help keeping track
    // of the original filenames
    info.postFileIndexes = _saveFileTree(info.fileTree, dir, info);
  } catch (e) {
    if (dir) {
      try {
        rimraf.rimrafSync(dir);
      } catch (e) {}
    }

    return fn(e);
  }

  pawnc.invokeCompiler('0.inc', {
    includeDirectory: info.includePath,
    workingDirectory: dir,
    debugLevel: 2,
    requireSemicolons: true,
    requireParentheses: true,

    PRAWN: true
  }, function(err, result) {
    try {
github oscar-broman / Prawn / lib / prawn / 1-pre-pre.js View on Github external
}, function(err, result) {
    try {
      rimraf.rimrafSync(dir);
    } catch (e) {}

    var errCount = 0;

    // Put the correct filenames in any error messages
    if (result && result.errors) {
      result.errors.forEach(function(error) {
        var match = error.file.match(/\b(\d+)[\/\\][^\/\\]+\.inc$/);

        if (match) {
          var index = +match[1];

          error.file = info.prePreTree.allFiles[index].realFile;
        }

        if (error.type !== 'warning') {
github uber-archive / idl / test / lib / test-cluster.js View on Github external
function updateRemote(name, files, callback) {
    var self = this;

    var remoteDir = path.join(self.remotesDir, name);

    series([
        rimraf.bind(null, path.join(remoteDir, 'idl')),
        createFixtures.bind(null, remoteDir, files),
        git('add --all .', {
            cwd: remoteDir
        }),
        git('commit -am "update files"', {
            cwd: remoteDir
        })
    ], callback);
};
github gulpjs / gulp / test / dest.js View on Github external
describe('gulp.dest()', function() {
  beforeEach(rimraf.bind(null, outpath));
  afterEach(rimraf.bind(null, outpath));

  it('should return a stream', function(done) {
    var stream = gulp.dest(path.join(__dirname, './fixtures/'));
    expect(stream).toExist();
    expect(stream.on).toExist();
    done();
  });

  it('should return a output stream that writes files', function(done) {
    var instream = gulp.src('./fixtures/**/*.txt', { cwd: __dirname });
    var outstream = gulp.dest(outpath);
    instream.pipe(outstream);

    outstream.on('error', done);
    outstream.on('data', function(file) {
github gulpjs / gulp / test / watch.js View on Github external
describe('gulp.watch()', function() {
  beforeEach(rimraf.bind(null, outpath));
  beforeEach(mkdirp.bind(null, outpath));
  afterEach(rimraf.bind(null, outpath));

  it('should call the function when file changes: no options', function(done) {
    var tempFile = path.join(outpath, 'watch-func.txt');

    createTempFile(tempFile);

    var watcher = gulp.watch('watch-func.txt', { cwd: outpath }, function(cb) {
      watcher.close();
      cb();
      done();
    });

    updateTempFile(tempFile);
  });
github componentjs / resolver.js / test / installs.js View on Github external
it('should fetch master for * when no tags available', co(function* () {
    yield rimraf.bind(null, components);

    var tree = yield* resolve({
      dependencies: {
        'timaschew/component-asterisk-no-tags': '*'
      }
    }, {
      install: true,
    })

    var out = join(components, 'timaschew', 'component-asterisk-no-tags', 'master')
    fs.statSync(join(out, 'index.js'))
    var json = require(join(out, 'component.json'))
    json.version.should.eql('0.0.2')
  }))
github mystorp / http-mock-middleware / tests / utils.js View on Github external
afterAll(function(){
        rimraf.sync(dir);
    });
    return mockFile.bind(this, dir);

rimraf

A deep deletion module for node (like `rm -rf`)

ISC
Latest version published 5 months ago

Package Health Score

80 / 100
Full package analysis