本文整理汇总了TypeScript中del.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: pipelineFunction
export default function pipelineFunction(event?: gulp.WatchEvent) {
if (event !== undefined) {
if (event.type !== 'deleted') {
return q();
}
const files: string[] = [
event.path.replace(/\\/g, '/').replace('.ts', '.js'),
event.path.replace(/\\/g, '/').replace('.ts', '.js.map'),
event.path.replace(/\\/g, '/').replace('.jade', '.html'),
event.path.replace(/\\/g, '/').replace('.sass', '.css')
];
return del(files, { force: true });
} else {
const files: string[] = [
new FilePath(root.application.path(), '/**/*.js').toString(),
new FilePath(root.application.path(), '/**/*.js.map').toString(),
root.application.views.files().toString(),
new FilePath(root.application.path(), '/**/*.css').toString()
];
return del(files, { force: true });
}
};
示例2: function
/**
* Deletes all generated files.
*/
export default function (): any {
"use strict";
const del = require("del");
return del([
`${Constants.folders.dist}/**/*`,
`${Constants.folders.docs}/${Constants.folders.docsGenerated}/**/*`,
`${Constants.folders.lib}/**/*`,
`${Constants.folders.src}/**/*.js`,
`${Constants.folders.src}/**/*.d.ts`,
`${Constants.folders.test}/**/*.d.ts`,
`${Constants.folders.test}/**/*.js`
]);
}
示例3: reset
public async reset() {
this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset');
// start by deleting the state file to lower the
// amount of time that another process might be able to
// successfully read it once we decide to delete it
await del(this.statePath);
// delete everything in optimize/.cache directory
// except ts-node
await del(
await globby(
[
normalizePosixPath(this.cachePath),
`${normalizePosixPath(`!${this.cachePath}/ts-node/**`)}`,
],
{ dot: true }
)
);
// delete some empty folder that could be left
// from the previous cache path reset action
await deleteEmpty(this.cachePath);
// delete dlls
await del(this.dllsPath);
// re-write new cache state file
await this.write();
this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset');
}
示例4: copyDTSTypings
function copyDTSTypings(tsFileName: string, srcFolderPath: string, destFolderPath: string): void {
var srcDTSFilePath: string = path.join(srcFolderPath, tsFileName + ".d.ts");
var srcJSFilePath: string = path.join(srcFolderPath, tsFileName + ".js");
var destDTSFilePath: string = path.join(destFolderPath, tsFileName + ".d.ts");
console.log("copying: " + srcDTSFilePath + " to :" + destDTSFilePath);
fs.writeFileSync(destDTSFilePath, fs.readFileSync(srcDTSFilePath));
del([srcDTSFilePath], { force: true });
del([srcJSFilePath], { force: true });
}
示例5: deleteTarget
async function deleteTarget(project: Project) {
const targetDir = project.targetLocation;
if (await isDirectory(targetDir)) {
await del(targetDir, { force: true });
}
}
示例6: del
beforeEach(async () => {
await del(TMP);
await mkdirp(resolve(TMP, 'foo/bar/baz'));
await mkdirp(resolve(TMP, 'foo/bar/box'));
await mkdirp(resolve(TMP, 'a/b/c/d/e'));
await write(resolve(TMP, 'a/bar'), 'foo');
});
示例7: del
export async function ScreenshotsProvider({ getService }: FtrProviderContext) {
const log = getService('log');
const config = getService('config');
const browser = getService('browser');
const SESSION_DIRECTORY = resolve(config.get('screenshots.directory'), 'session');
const FAILURE_DIRECTORY = resolve(config.get('screenshots.directory'), 'failure');
const BASELINE_DIRECTORY = resolve(config.get('screenshots.directory'), 'baseline');
await del([SESSION_DIRECTORY, FAILURE_DIRECTORY]);
class Screenshots {
/**
*
* @param name {string} name of the file to use for comparison
* @param updateBaselines {boolean} optional, pass true to update the baseline snapshot.
* @return {Promise.<number>} Percentage difference between the baseline and the current snapshot.
*/
async compareAgainstBaseline(name: string, updateBaselines: boolean, el: WebElementWrapper) {
log.debug('compareAgainstBaseline');
const sessionPath = resolve(SESSION_DIRECTORY, `${name}.png`);
await this._take(sessionPath, el);
const baselinePath = resolve(BASELINE_DIRECTORY, `${name}.png`);
const failurePath = resolve(FAILURE_DIRECTORY, `${name}.png`);
if (updateBaselines) {
log.debug('Updating baseline snapshot');
await writeFileAsync(baselinePath, readFileSync(sessionPath));
return 0;
} else {
await mkdirAsync(FAILURE_DIRECTORY);
return await comparePngs(sessionPath, baselinePath, failurePath, SESSION_DIRECTORY, log);
}
}
async take(name: string, el: WebElementWrapper) {
return await this._take(resolve(SESSION_DIRECTORY, `${name}.png`), el);
}
async takeForFailure(name: string, el: WebElementWrapper) {
await this._take(resolve(FAILURE_DIRECTORY, `${name}.png`), el);
}
async _take(path: string, el: WebElementWrapper) {
try {
log.info(`Taking screenshot "${path}"`);
const screenshot = await (el ? el.takeScreenshot() : browser.takeScreenshot());
await fcb(cb => mkdirp(dirname(path), cb));
await fcb(cb => writeFile(path, screenshot, 'base64', cb));
} catch (err) {
log.error('SCREENSHOT FAILED');
log.error(err);
}
}
}
return new Screenshots();
}
示例8: Promise
return new Promise(function (resolve, reject) {
del(['.build/'], function (err) {
if (err) {
reject(err);
} else {
resolve();
}
});
});
示例9: del
// -------------------------------------------------------------------------
// General tasks
// -------------------------------------------------------------------------
/**
* Cleans build folder.
*/
@Task()
clean(cb: Function) {
return del([
"build/**",
"!build",
"!build/package",
"!build/package/node_modules",
"!build/package/node_modules/**"
], cb);
}
示例10: remove
public async remove(uri: string): Promise<DeleteWorkerResult> {
const localPath = RepositoryUtils.repositoryLocalPath(this.repoVolPath, uri);
try {
// For now, just `rm -rf`
await del([localPath], { force: true });
this.log.info(`Remove local repository ${uri} done.`);
return {
uri,
res: true,
};
} catch (error) {
this.log.error(`Remove local repository ${uri} error: ${error}.`);
throw error;
}
}