本文整理汇总了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();
},
示例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 })
}
示例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));
});
示例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. ')
})
示例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)
})
示例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);
},
示例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']});
});
});
};
示例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)
}
}
示例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;
}