@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
60 lines (54 loc) • 2.32 kB
JavaScript
import { init_esm_shims, __name } from './chunk-QH7NXH7H.js';
import { LogLevelLabel } from '@storm-software/config-tools/types';
// src/commands/build/index.ts
init_esm_shims();
// src/commands/build/application/index.ts
init_esm_shims();
async function buildApplication(context, hooks) {
context.log(LogLevelLabel.TRACE, "Executing build process for the Storm Stack application.");
await hooks.callHook("build:application", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while building the Storm Stack application: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while building the Storm Stack application", {
cause: error
});
});
}
__name(buildApplication, "buildApplication");
// src/commands/build/library/index.ts
init_esm_shims();
async function buildLibrary(context, hooks) {
context.log(LogLevelLabel.TRACE, "Executing build process for the Storm Stack library.");
await hooks.callHook("build:library", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while building the Storm Stack library: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while building the Storm Stack library", {
cause: error
});
});
}
__name(buildLibrary, "buildLibrary");
// src/commands/build/index.ts
async function build(context, hooks) {
await hooks.callHook("build:begin", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while starting the build process for the Storm Stack project: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while starting the build process for the Storm Stack project", {
cause: error
});
});
if (context.options.projectType === "application") {
await buildApplication(context, hooks);
} else {
await buildLibrary(context, hooks);
}
await hooks.callHook("build:complete", context).catch((error) => {
context.log(LogLevelLabel.ERROR, `An error occured while finishing the build process for the Storm Stack project: ${error.message}
${error.stack ?? ""}`);
throw new Error("An error occured while finishing the build process for the Storm Stack project", {
cause: error
});
});
}
__name(build, "build");
export { build };