fs-extra#emptydir TypeScript Examples
The following examples show how to use
fs-extra#emptydir.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: dev.ts From gdmod with MIT License | 6 votes |
async execute() {
console.log(chalk`{bold {cyan Launching production build}}`);
const spinner: ora.Ora = ora(chalk.blueBright`Clean "dist"`).start();
await emptyDir(`./dist`);
spinner.succeed().start(chalk.magenta`Building bundle`);
await buildBundle(`./dist/bundle.js`);
spinner.succeed().start(chalk.magenta`Building mod file`);
await buildMod();
spinner.succeed().start(chalk.blueBright`Clean up temporary files`);
await rm(`./dist/bundle.js`);
spinner.succeed();
console.info(
chalk`{green {bold ✅ Success! You can now release the file {grey "{italic ./dist/mod.zip}"} and load it via a GDMod loader.}}`
);
}
Example #2
Source File: DownloadedUpdateHelper.ts From electron-differential-updater with MIT License | 6 votes |
private async cleanCacheDirForPendingUpdate(): Promise<void> {
try {
// remove stale data
await emptyDir(this.cacheDirForPendingUpdate)
}
catch (ignore) {
// ignore
}
}
Example #3
Source File: generate-packages.ts From DefinitelyTyped-tools with MIT License | 6 votes |
export default async function generatePackages(
dt: FS,
allPackages: AllPackages,
changedPackages: ChangedPackages,
tgz = false
): Promise<void> {
const [log, logResult] = logger();
log("\n## Generating packages");
await mkdirp(outputDirPath);
await emptyDir(outputDirPath);
for (const { pkg, version } of changedPackages.changedTypings) {
await generateTypingPackage(pkg, allPackages, version, dt);
if (tgz) {
await writeTgz(outputDirectory(pkg), `${outputDirectory(pkg)}.tgz`);
}
log(` * ${pkg.desc}`);
}
log("## Generating deprecated packages");
await withNpmCache(
new UncachedNpmInfoClient(),
async (client) => {
for (const pkg of changedPackages.changedNotNeededPackages) {
log(` * ${pkg.libraryName}`);
await generateNotNeededPackage(pkg, client, log);
}
},
cacheDirPath
);
await writeLog("package-generator.md", logResult());
}
Example #4
Source File: publish-registry.ts From DefinitelyTyped-tools with MIT License | 6 votes |
async function generate(registry: string, packageJson: {}): Promise<void> {
await emptyDir(registryOutputPath);
await writeOutputJson("package.json", packageJson);
await writeOutputFile("index.json", registry);
await writeOutputFile("README.md", readme);
function writeOutputJson(filename: string, content: object): Promise<void> {
return writeJson(outputPath(filename), content);
}
function writeOutputFile(filename: string, content: string): Promise<void> {
return writeFile(outputPath(filename), content);
}
function outputPath(filename: string): string {
return joinPaths(registryOutputPath, filename);
}
}
Example #5
Source File: publish-registry.ts From DefinitelyTyped-tools with MIT License | 6 votes |
async function installForValidate(log: Logger): Promise<void> {
await emptyDir(validateOutputPath);
await writeJson(joinPaths(validateOutputPath, "package.json"), {
name: "validate",
version: "0.0.0",
description: "description",
readme: "",
license: "",
repository: {},
});
const cmd = `npm install types-registry@next ${npmInstallFlags}`;
log(cmd);
const err = (await execAndThrowErrors(cmd, validateOutputPath)).trim();
if (err) {
console.error(err);
}
}
Example #6
Source File: TestProject.ts From yarn-plugins with MIT License | 5 votes |
public async cleanup(): Promise<void> {
await emptyDir(this.tmpDir.path);
await this.tmpDir.cleanup();
}
Example #7
Source File: Application.ts From joplin-utils with MIT License | 5 votes |
async clean() {
await Promise.all([emptydir(this.handler.notePath), emptydir(this.handler.resourcePath)])
await cacheCommanderProgram.init()
}