當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。