UNPKG

@storm-software/workspace-tools

Version:

Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.

70 lines (67 loc) 2.13 kB
import { normalizeOptions, typeScriptLibraryGeneratorFn } from "./chunk-YZLAY7R4.mjs"; import { typesNodeVersion } from "./chunk-EK75QNMS.mjs"; import { withRunGenerator } from "./chunk-4LIIIWIV.mjs"; import { joinPaths } from "./chunk-ATIBREWM.mjs"; import { __dirname, __name } from "./chunk-2BPV2XV2.mjs"; // src/generators/node-library/generator.ts import { formatFiles, generateFiles, names, offsetFromRoot } from "@nx/devkit"; async function nodeLibraryGeneratorFn(tree, schema, config) { const filesDir = joinPaths(__dirname, "src", "generators", "node-library", "files"); const tsLibraryGeneratorOptions = { platform: "node", devDependencies: { "@types/node": typesNodeVersion }, buildExecutor: "@storm-software/workspace-tools:unbuild", ...schema, directory: schema.directory, description: schema.description }; const options = await normalizeOptions(tree, tsLibraryGeneratorOptions); const { className, name, propertyName } = names(options.name); generateFiles(tree, filesDir, options.projectRoot, { ...schema, dot: ".", className, name, namespace: process.env.STORM_NAMESPACE ?? "storm-software", description: schema.description ?? "", propertyName, js: !!options.js, cliCommand: "nx", strict: void 0, tmpl: "", offsetFromRoot: offsetFromRoot(options.projectRoot), buildable: options.bundler && options.bundler !== "none", hasUnitTestRunner: options.unitTestRunner !== "none" }); await typeScriptLibraryGeneratorFn(tree, tsLibraryGeneratorOptions, config); await formatFiles(tree); return null; } __name(nodeLibraryGeneratorFn, "nodeLibraryGeneratorFn"); var generator_default = withRunGenerator("TypeScript Library Creator (NodeJs Platform)", nodeLibraryGeneratorFn, { hooks: { applyDefaultOptions: /* @__PURE__ */ __name((options) => { options.description ??= "A library used by Storm Software to support NodeJs applications"; options.platform ??= "node"; return options; }, "applyDefaultOptions") } }); export { nodeLibraryGeneratorFn, generator_default };