How to use the rimraf.rimrafSync function in rimraf

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 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 oscar-broman / Prawn / lib / prawn / index.js View on Github external
function _cleanup() {
  if (_info.prePreDir) {
    try {
      rimraf.rimrafSync(_info.prePreDir);
    } catch (e) {}
  }

  if (_info.outputFile) {
    try {
      fs.unlinkSync(_info.outputFile);
    } catch (e) {}
  }
}
github oscar-broman / Prawn / lib / prawn / 1-pre-pre.js View on Github external
exports.process = function(info, fn) {
  var dir;

  try {
    dir = temp.mkdirSync('prawn');
    _process(info, dir);
  } catch (e) {
    if (dir) {
      try {
        rimraf.rimrafSync(dir);
      } catch (e) {}
    }

    fn(e);

    return;
  }

  info.prePreDir = dir;

  pawnc.invokeCompiler(path.resolve(info.entryFile), {
    includeDirectory: info.includePath,
    workingDirectory: dir,
    debugLevel: 2,
    outputLst: true,
    requireSemicolons: true,

rimraf

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

ISC
Latest version published 4 months ago

Package Health Score

83 / 100
Full package analysis