当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fs-extra.removeSync函数代码示例

本文整理汇总了TypeScript中fs-extra.removeSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript removeSync函数的具体用法?TypeScript removeSync怎么用?TypeScript removeSync使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了removeSync函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: expect

 Promise.then(function(
   result: Either.Either<Error.Error, FileFinder.FilesAndDirectories>,
 ) {
   const expectedResult = Either.Left<
     Error.Error,
     FileFinder.FilesAndDirectories
   >(Error.Error(__dirname + '/tmp/test.value does not exist'));
   expect(result).toEqualJSON(expectedResult);
   fsExtra.removeSync(__dirname + '/tmp');
   finished();
 },
开发者ID:facebook,项目名称:remodel,代码行数:11,代码来源:file-finder-test.ts

示例2: copyStaticResources

function copyStaticResources() {
  const dirName = process.platform
  const platformSpecific = path.join(projectRoot, 'app', 'static', dirName)
  const common = path.join(projectRoot, 'app', 'static', 'common')
  const destination = path.join(outRoot, 'static')
  fs.removeSync(destination)
  if (fs.existsSync(platformSpecific)) {
    fs.copySync(platformSpecific, destination)
  }
  fs.copySync(common, destination, { clobber: false })
}
开发者ID:tamdao,项目名称:desktop,代码行数:11,代码来源:build.ts

示例3: promiseSpawn

    promiseSpawn('node', tsc, '-p', exampleInput).then(() => {
        const filePath = resolve(compileOutput, example);
        const files = fs.readdirSync(filePath);

        if (fs.pathExistsSync(exampleOutput)) {
            fs.removeSync(exampleOutput);
        }

        fs.mkdirpSync(exampleOutput);

        for (const file of files) {
            const { data } = require(join(filePath, file));
            const base = basename(file, '.js');
            const dataString = JSON.stringify(data);

            fs.writeFileSync(join(exampleOutput, `${base}.json`), dataString);
        }

        fs.removeSync(resolve(compileOutput));
    });
开发者ID:rectification,项目名称:circuitlab,代码行数:20,代码来源:ts-json.ts

示例4: xit

 xit('pruduct download updates log', async() => {
   fsExtra.removeSync('./test.temp')
   await s.login('goodUser', 'goodPwd')
   await s.loadProducts()
   s.toggleSelectAll()
   s.suspendOnEach = false
   await s.backupSelection()
   //logging has changed
   //const log = s.log.map((x) => x.props.children).join(' / ')
   //expect(log).to.eql('Getting authorId / Loading all products / Reading up to 50 products / ...read 3 items / Completed loading all products / start: ,hey kot / start: ,with some / start: ,kot comes / Backup job completed. Open folder. ')
 })
开发者ID:tes,项目名称:resource-backup-tool,代码行数:11,代码来源:tes.tests.ts

示例5: it

 it('downloaded yamls and binaries are as expected', async() => {
   fsExtra.removeSync('./test.temp')
   await s.login('goodUser', 'goodPwd')
   await s.loadProducts()
   s.selection.add(s.products[0])
   s.suspendOnEach = false
   await s.backupSelection()
   const prod1Yaml = await yamlLoader('./test.temp/ResourceBackup/TPT/resources/2632990/resource.info')
   expect(prod1Yaml).to.eql(tptMocks.prod1Yaml)
   expect(fsExtra.statSync('./test.temp/ResourceBackup/TPT/resources/2632990/primary-download').size).to.eql(318923)
   expect(fsExtra.statSync('./test.temp/ResourceBackup/TPT/resources/2632990/coverImage.jpg').size).to.eql(35445)
 })
开发者ID:tes,项目名称:resource-backup-tool,代码行数:12,代码来源:tpt.tests.ts

示例6: function

 function(finished) {
   fsExtra.removeSync(__dirname + '/tmp');
   fs.mkdirSync(__dirname + '/tmp');
   fs.writeFileSync(__dirname + '/tmp/README', '');
   fs.writeFileSync(__dirname + '/tmp/test.value', '');
   fs.writeFileSync(__dirname + '/tmp/test2.value', '');
   fs.mkdirSync(__dirname + '/tmp/tmp2');
   fs.writeFileSync(__dirname + '/tmp/tmp2/test.value', '');
   fs.writeFileSync(__dirname + '/tmp/tmp2/test2.enum', '');
   fs.mkdirSync(__dirname + '/tmp/tmp3');
   fs.writeFileSync(__dirname + '/tmp/tmp3/test.value', '');
   fs.mkdirSync(__dirname + '/tmp/tmp3/tmp4');
   fs.writeFileSync(__dirname + '/tmp/tmp3/tmp4/test2.value', '');
   const sequence: LazySequence.Sequence<
     File.AbsoluteFilePath
   > = ParallelProcessQueue.findFiles(
     File.getAbsoluteFilePath(__dirname + '/tmp'),
     'value',
   );
   const future: Promise.Future<
     File.AbsoluteFilePath[]
   > = LazySequence.evaluate(sequence);
   Promise.then(function(fileLocations: File.AbsoluteFilePath[]) {
     expect(fileLocations).toContain({
       absolutePath: __dirname + '/tmp/test.value',
     });
     expect(fileLocations).toContain({
       absolutePath: __dirname + '/tmp/test2.value',
     });
     expect(fileLocations).toContain({
       absolutePath: __dirname + '/tmp/tmp2/test.value',
     });
     expect(fileLocations).toContain({
       absolutePath: __dirname + '/tmp/tmp3/test.value',
     });
     expect(fileLocations).toContain({
       absolutePath: __dirname + '/tmp/tmp3/tmp4/test2.value',
     });
     fs.unlinkSync(__dirname + '/tmp/tmp3/tmp4/test2.value');
     fs.rmdirSync(__dirname + '/tmp/tmp3/tmp4');
     fs.unlinkSync(__dirname + '/tmp/tmp3/test.value');
     fs.rmdirSync(__dirname + '/tmp/tmp3');
     fs.unlinkSync(__dirname + '/tmp/tmp2/test2.enum');
     fs.unlinkSync(__dirname + '/tmp/tmp2/test.value');
     fs.rmdirSync(__dirname + '/tmp/tmp2');
     fs.unlinkSync(__dirname + '/tmp/test2.value');
     fs.unlinkSync(__dirname + '/tmp/test.value');
     fs.unlinkSync(__dirname + '/tmp/README');
     fs.rmdirSync(__dirname + '/tmp');
     finished();
   }, future);
 },
开发者ID:facebook,项目名称:remodel,代码行数:52,代码来源:parallel-process-queue-test.ts

示例7: zipdir

export const exportForWeb = (event, params) => {
  fsExtra.removeSync(`${WEB_PATH[process.platform]}`);

  Object.keys(params.model).forEach(key => {
    if ((key === 'data' || key.indexOf('data_') === 0) && typeof params.model[key] === 'object') {
      const pathKeys = params.model[key].path.split(path.sep);
      const pathKey = pathKeys[pathKeys.length - 1];

      fsExtra.copySync(params.model[key].path, `${WEB_PATH[process.platform]}/data/${pathKey}`);

      params.model[key].path = `./data/${pathKey}`;
      params.model[key].ddfPath = `./data/${pathKey}`;

      if (params.model[key].reader === 'ddf1-csv-ext') {
        params.model[key].reader = 'ddf';
      }
    }
  });

  params.model.chartType = params.chartType;
  params.model.locale.filePath = 'assets/translation/';

  const config = `var CONFIG = ${JSON.stringify(params.model, null, ' ')};`;

  fsExtra.copySync(`${WEB_RESOURCE_PATH[process.platform]}`, `${WEB_PATH[process.platform]}`);
  fsExtra.outputFileSync(`${WEB_PATH[process.platform]}/config.js`, config);

  let indexContent = fs.readFileSync(`${WEB_RESOURCE_PATH[process.platform]}/index.html`).toString();

  indexContent = indexContent.replace(/#chartType#/, params.chartType);

  fs.writeFileSync(`${WEB_PATH[process.platform]}/index.html`, indexContent, 'utf8');

  dialog.showSaveDialog({
    title: 'Export current chart as ...',
    filters: [{name: 'ZIP', extensions: ['zip']}]
  }, fileName => {
    if (!fileName) {
      return;
    }

    zipdir(`${WEB_PATH[process.platform]}`, {saveTo: fileName}, err => {
      if (err) {
        dialog.showMessageBox({message: 'This chart has NOT been exported.', buttons: ['OK']});
        ga.error('Export for Web was NOT completed: ' + err.toString());
        return;
      }

      dialog.showMessageBox({message: 'This chart has been exported.', buttons: ['OK']});
    });
  });
};
开发者ID:VS-work,项目名称:gapminder-offline,代码行数:52,代码来源:file-management.ts

示例8: logError

function logError(err: Error) {
  let p = path.join(cacheDir, 'weather.log')
  let log = fs.createWriteStream(p)
  log.write(new Date() + '\n')
  log.write(err.stack + '\n')
  console.log(`#[fg=red]${p.replace(os.homedir(), '~')}`)
  try {
    fs.removeSync(path.join(cacheDir, 'weather.json'))
  } catch (err) {
    console.error(err)
    notify(err.stack)
  }
}
开发者ID:dickeyxxx,项目名称:tmux-weather,代码行数:13,代码来源:tmux-weather.ts

示例9: exportSolution

	async exportSolution(name: string, _targetOptions: any, defines: Array<string>): Promise<any> {
		this.addSourceDirectory(path.join(this.options.kha, 'Backends', this.backend()));

		fs.ensureDirSync(path.join(this.options.to, this.sysdir()));
		
		let haxeOptions = this.haxeOptions(name, _targetOptions, defines);
		writeHaxeProject(this.options.to, haxeOptions);

		fs.removeSync(path.join(this.options.to, this.sysdir(), 'Sources'));

		this.exportEclipseProject();

		return haxeOptions;
	}
开发者ID:hammeron-art,项目名称:khamake,代码行数:14,代码来源:JavaExporter.ts


注:本文中的fs-extra.removeSync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。