How to use the fs-extra.removeSync function in fs-extra

To help you get started, we’ve selected a few fs-extra 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 wane / wane / src / compiler / compile.ts View on Github external
export function getProjectAnalyzer (waneCompilerOptions: Partial = {}): ProjectAnalyzer {

  // console.log(`Compiling a Wane app with the following options:`)
  // console.log(JSON.stringify(options, null, 2))

  /**
   * Setting up phase. We copy all files from the source to destination directory.
   * Then we manipulate the copies of files.
   */

  const { srcDir, distDir } = getDirs(waneCompilerOptions)

  fs.removeSync(distDir)
  fs.mkdirpSync(distDir)
  fs.copySync(srcDir, distDir)

  /**
   * We load the project (from the desination folder) into a new ts-simple-ast Project.
   */

  const projectOptions = {
    compilerOptions: {
      outDir: distDir,
      experimentalDecorators: true,
      target: ScriptTarget.ES2017,
      module: ModuleKind.ES2015,
      strict: true,
      noFallthroughCasesInSwitch: true,
      noImplicitReturns: true,
github zapier / zapier-platform-cli / scripts / test-convert.js View on Github external
});
    })
    .then(() => {
      console.log(`${appToConvert.name} converted successfully`);
      return null;
    })
    .catch(() => {
      console.error(`${appToConvert.name} conversion failed. See ${logFile}.`);
      return appToConvert.name;
    });
};

global.argOpts = {};

const rootTmpDir = tmp.tmpNameSync();
fse.removeSync(rootTmpDir);
fse.ensureDirSync(rootTmpDir);

const tasks = _.map(appsToConvert, template =>
  testConvertedApp(template, rootTmpDir)
);

Promise.all(tasks).then(results => {
  const failures = _.filter(results, result => result !== null);
  if (failures.length) {
    console.error('these apps failed conversion:', failures.join(', '));
  } else {
    console.log('apps converted successfully');
  }
});
github mustardamus / lehm / test / generator_spec.js View on Github external
it('should transform and generate or copy the files', () => {
    let distFile1 = path.join(distPath, 'boolean.txt')
    let fixFile1 = path.join(__dirname, 'fixtures/generator/compare/boolean.txt')
    let distFile2 = path.join(distPath, 'number.txt')
    let fixFile2 = path.join(__dirname, 'fixtures/generator/compare/number.txt')
    let distFile3 = path.join(distPath, 'some-module-name/some-module-name.txt')
    let fixFile3 = path.join(__dirname, 'fixtures/generator/compare/some-module-name/some-module-name.txt')
    let distFile4 = path.join(distPath, 'favicon.png')

    fs.removeSync(distPath)
    assert.equal(fs.existsSync(distPath), false)

    generator.run()

    assert.equal(fs.existsSync(distPath), true)
    assert.equal(fs.existsSync(distFile1), true)
    assert.equal(fs.existsSync(distFile2), true)
    assert.equal(fs.existsSync(distFile3), true)
    assert.equal(fs.readFileSync(distFile1, 'utf8'), fs.readFileSync(fixFile1, 'utf8'))
    assert.equal(fs.readFileSync(distFile2, 'utf8'), fs.readFileSync(fixFile2, 'utf8'))
    assert.equal(fs.readFileSync(distFile3, 'utf8'), fs.readFileSync(fixFile3, 'utf8'))
    assert.equal(fs.existsSync(distFile4), true)
  })
github LimeChain / etherlime / test / cli-commands / shape / shape.js View on Github external
afterEach(async function () {
        fs.removeSync('./contracts')
        fs.removeSync('./deployment')
        fs.removeSync('./test')
        fs.removeSync('./web')
        fs.removeSync('./node_modules')
        fs.removeSync('./package.json')
        fs.removeSync('./package-lock.json');
        fs.removeSync('./README.md');
        fs.removeSync('./.git');
        fs.removeSync('./.etherlime-store')
        fs.removeSync('./.gitignore')
        process.chdir(currentDir);
    });
github abecms / abecms / test / operations.js View on Github external
try {
          var stat = fse.statSync(json)
        }catch(e) {
          chai.expect(stat).to.be.undefined;
        }
        try {
          var stat = fse.statSync(html)
        }catch(e) {
          chai.expect(stat).to.be.undefined;
        }
        json = path.join(config.root, config.data.url, resSave2.json.abe_meta.latest.abeUrl.replace('.html', '.json'))
        var stat = fse.statSync(json)
        if (stat) {
          chai.expect(stat).to.not.be.undefined;
        }
        fse.removeSync(json)
        done()
      }.bind(this));
    }.bind(this));
github PortalNetwork / kaizen-cli / src / components / Create / index.js View on Github external
switch (template) {
      case 'vue':
        await cloneProjectFromGithub('https://github.com/PortalNetwork/vue-truffle.git', projectName);
        break;
      case 'react-near':
        await cloneProjectFromGithub('https://github.com/PortalNetwork/react-near.git', projectName);
        break;
      case 'plain-near':
        await cloneProjectFromGithub('https://github.com/PortalNetwork/plain-near.git', projectName);
        break;
      case 'react':
      default:
        await cloneProjectFromGithub('https://github.com/PortalNetwork/react-truffle.git', projectName);
        break;
    }
    fsx.removeSync(`./${projectName}/.git`);
    Spinner.stop();
    Log.SuccessLog(`\nCreate ${projectName} Successfully`);
    Log.NormalLog('Now you can use ' + `'cd ${projectName}'`.yellow + ' to the project folder.');
    Log.NormalLog('After you get into the folder, you can install the node packages by using ' + '\'npm install\''.yellow);
    Log.NormalLog('Let\'s start BUIDL!'.green);
  } catch (error) {
    Spinner.stop();
    Log.ErrorLog('something went wrong!');
    console.error(error);
  }
}
github unfoldingWord / translationCore / src / js / helpers / ProjectAPI.js View on Github external
deleteDataFileSync(filePath) {
    const fullPath = path.join(this._dataPath, filePath);
    fs.removeSync(fullPath);
  }
}
github palmerhq / changecast / scripts / getReleases.js View on Github external
async function getReleases() {
  fs.removeSync('./releases')
  fs.mkdirSync('./releases')

  let hasNext = true
  let after

  while (hasNext) {
    const {
      data: {
        data: {
          repository: {
            releases: {
              pageInfo: { hasNextPage, endCursor },
              nodes,
            },
          },
        },
github ef4 / ember-auto-import / packages / ember-auto-import / ts / broccoli-append.ts View on Github external
private handleAppend(relativePath: string) {
    let upstreamPath = join(this.upstreamDir, relativePath);
    let outputPath = join(this.outputPath, relativePath);
    let ext = extname(relativePath);

    if (!existsSync(upstreamPath)) {
      removeSync(outputPath);
      return;
    }

    let sourceDir = join(this.appendedDir, this.reverseMappings.get(relativePath)!);
    if (!existsSync(sourceDir)) {
      symlinkOrCopy.sync(upstreamPath, outputPath);
      return;
    }

    const separator = (ext === '.js') ? ';\n' : '\n';

    let appendedContent = readdirSync(sourceDir).map(name => {
      if (name.endsWith(ext)) {
        return readFileSync(join(sourceDir, name), 'utf8');
      }
    }).filter(Boolean).join(separator);
github embroider-build / embroider / packages / compat / src / compat-adapters / ember-composable-helpers.ts View on Github external
async build() {
    await super.build();
    let appHelpersDir = join(this.outputPath, '_app_', 'helpers');
    let addonHelpersDir = join(this.inputPaths[0], 'helpers');

    for (let filename of readdirSync(appHelpersDir)) {
      if (!pathExistsSync(join(addonHelpersDir, filename))) {
        removeSync(join(appHelpersDir, filename));
      }
    }
    let src = readFileSync(join(this.inputPaths[0], 'index.js'), 'utf8');
    let plugins = [stripBadReexportsPlugin({ resolveBase: this.outputPath })];
    writeFileSync(join(this.outputPath, 'index.js'), transform(src, { plugins })!.code);
  }
}