@storm-software/workspace-tools
Version:
Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.
51 lines (48 loc) • 1.38 kB
JavaScript
import {
withRunExecutor
} from "./chunk-7P2LGXFI.mjs";
import {
writeInfo
} from "./chunk-NODM27UV.mjs";
import {
__name
} from "./chunk-2BPV2XV2.mjs";
// src/executors/typia/executor.ts
import { removeSync } from "fs-extra";
import { TypiaProgrammer } from "typia/lib/programmers/TypiaProgrammer.js";
async function typiaExecutorFn(options, _, config) {
if (options.clean !== false) {
writeInfo(`\u{1F9F9} Cleaning output path: ${options.outputPath}`, config);
removeSync(options.outputPath);
}
await Promise.all(options.entry.map((entry) => {
writeInfo(`\u{1F680} Running Typia on entry: ${entry}`, config);
return TypiaProgrammer.build({
input: entry,
output: options.outputPath,
project: options.tsconfig
});
}));
return {
success: true
};
}
__name(typiaExecutorFn, "typiaExecutorFn");
var executor_default = withRunExecutor("Typia runtime validation generator", typiaExecutorFn, {
skipReadingConfig: false,
hooks: {
applyDefaultOptions: /* @__PURE__ */ __name((options) => {
options.entry ??= [
"{sourceRoot}/index.ts"
];
options.outputPath ??= "{sourceRoot}/__generated__/typia";
options.tsconfig ??= "{projectRoot}/tsconfig.json";
options.clean ??= true;
return options;
}, "applyDefaultOptions")
}
});
export {
typiaExecutorFn,
executor_default
};