@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
60 lines (54 loc) • 2.51 kB
JavaScript
import { init_esm_shims, __name } from './chunk-QH7NXH7H.js';
import { LogLevelLabel } from '@storm-software/config-tools/types';
import { joinPaths } from '@stryke/path/join-paths';
// src/commands/clean/index.ts
init_esm_shims();
// src/commands/clean/docs/index.ts
init_esm_shims();
async function cleanDocs(context, hooks) {
context.log(LogLevelLabel.TRACE, `Cleaning the Storm Stack project generated documentation.`);
await context.vfs.rm(joinPaths(context.options.workspaceRoot, context.options.output.outputPath || "dist/docs"));
await hooks.callHook("clean:docs", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while cleaning the Storm Stack project generated documentation: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while cleaning the Storm Stack project generated documentation", {
cause: error
});
});
}
__name(cleanDocs, "cleanDocs");
// src/commands/clean/output/index.ts
init_esm_shims();
async function cleanOutput(context, hooks) {
context.log(LogLevelLabel.TRACE, `Cleaning the Storm Stack project output.`);
await context.vfs.rm(joinPaths(context.options.workspaceRoot, context.options.output.outputPath));
await hooks.callHook("clean:output", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while cleaning the Storm Stack project output: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while cleaning the Storm Stack project output", {
cause: error
});
});
}
__name(cleanOutput, "cleanOutput");
// src/commands/clean/index.ts
async function clean(context, hooks) {
await hooks.callHook("clean:begin", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while starting the clean process for the Storm Stack project: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while starting the clean process for the Storm Stack project", {
cause: error
});
});
await cleanOutput(context, hooks);
await cleanDocs(context, hooks);
await hooks.callHook("clean:complete", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while finishing the clean process for the Storm Stack project: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while finishing the clean process for the Storm Stack project", {
cause: error
});
});
}
__name(clean, "clean");
export { clean };