@storm-software/workspace-tools 1.269.0 → 1.270.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +2 -1
- package/dist/chunk-A7JGVU4P.js +468 -0
- package/dist/chunk-SRN4D7WO.mjs +468 -0
- package/dist/executors.js +2 -2
- package/dist/executors.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/src/executors/npm-publish/executor.js +2 -2
- package/dist/src/executors/npm-publish/executor.mjs +1 -1
- package/docs/executors/rollup.md +88 -0
- package/executors.ts +23 -0
- package/generators.ts +14 -0
- package/index.ts +5 -0
- package/package.json +4 -4
- package/project.json +58 -0
- package/src/base/base-executor.ts +200 -0
- package/src/base/base-executor.untyped.ts +18 -0
- package/src/base/base-generator.ts +130 -0
- package/src/base/base-generator.untyped.ts +16 -0
- package/src/base/cargo-base-executor.untyped.ts +73 -0
- package/src/base/index.ts +8 -0
- package/src/base/typescript-build-executor.untyped.ts +153 -0
- package/src/base/typescript-library-generator.ts +415 -0
- package/src/base/typescript-library-generator.untyped.ts +106 -0
- package/src/executors/cargo-build/executor.spec.ts +18 -0
- package/src/executors/cargo-build/executor.ts +28 -0
- package/src/executors/cargo-build/untyped.ts +18 -0
- package/src/executors/cargo-check/executor.spec.ts +18 -0
- package/src/executors/cargo-check/executor.ts +27 -0
- package/src/executors/cargo-check/untyped.ts +11 -0
- package/src/executors/cargo-clippy/executor.spec.ts +18 -0
- package/src/executors/cargo-clippy/executor.ts +28 -0
- package/src/executors/cargo-clippy/untyped.ts +18 -0
- package/src/executors/cargo-doc/executor.spec.ts +18 -0
- package/src/executors/cargo-doc/executor.ts +39 -0
- package/src/executors/cargo-doc/untyped.ts +44 -0
- package/src/executors/cargo-format/executor.spec.ts +18 -0
- package/src/executors/cargo-format/executor.ts +28 -0
- package/src/executors/cargo-format/untyped.ts +11 -0
- package/src/executors/cargo-publish/executor.spec.ts +11 -0
- package/src/executors/cargo-publish/executor.ts +139 -0
- package/src/executors/cargo-publish/untyped.ts +33 -0
- package/src/executors/clean-package/constants.ts +99 -0
- package/src/executors/clean-package/executor.spec.ts +18 -0
- package/src/executors/clean-package/executor.ts +214 -0
- package/src/executors/clean-package/types.ts +6 -0
- package/src/executors/clean-package/untyped.ts +60 -0
- package/src/executors/clean-package/utils.ts +85 -0
- package/src/executors/esbuild/executor.spec.ts +11 -0
- package/src/executors/esbuild/executor.ts +67 -0
- package/src/executors/esbuild/untyped.ts +20 -0
- package/src/executors/npm-publish/executor.spec.ts +11 -0
- package/src/executors/npm-publish/executor.ts +681 -0
- package/src/executors/npm-publish/untyped.ts +56 -0
- package/src/executors/size-limit/executor.spec.ts +18 -0
- package/src/executors/size-limit/executor.ts +88 -0
- package/src/executors/size-limit/untyped.ts +22 -0
- package/src/executors/typia/executor.ts +54 -0
- package/src/executors/typia/untyped.ts +48 -0
- package/src/executors/unbuild/executor.spec.ts +11 -0
- package/src/executors/unbuild/executor.ts +136 -0
- package/src/executors/unbuild/untyped.ts +152 -0
- package/src/generators/browser-library/generator.spec.ts +20 -0
- package/src/generators/browser-library/generator.ts +109 -0
- package/src/generators/browser-library/untyped.ts +29 -0
- package/src/generators/config-schema/generator.spec.ts +20 -0
- package/src/generators/config-schema/generator.ts +90 -0
- package/src/generators/config-schema/untyped.ts +19 -0
- package/src/generators/init/init.ts +32 -0
- package/src/generators/init/untyped.ts +16 -0
- package/src/generators/neutral-library/generator.spec.ts +20 -0
- package/src/generators/neutral-library/generator.ts +81 -0
- package/src/generators/neutral-library/untyped.ts +29 -0
- package/src/generators/node-library/generator.spec.ts +20 -0
- package/src/generators/node-library/generator.ts +84 -0
- package/src/generators/node-library/untyped.ts +29 -0
- package/src/generators/preset/files/.all-contributorsrc.template +48 -0
- package/src/generators/preset/files/.editorconfig +454 -0
- package/src/generators/preset/files/.env.template +38 -0
- package/src/generators/preset/files/.gitattributes +52 -0
- package/src/generators/preset/files/.github/.nvmrc +1 -0
- package/src/generators/preset/files/.github/CODEOWNERS +3 -0
- package/src/generators/preset/files/.github/CODE_OF_CONDUCT.md +125 -0
- package/src/generators/preset/files/.github/CONTRIBUTING.md.template +15 -0
- package/src/generators/preset/files/.github/FUNDING.yml +3 -0
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/bug-report.yml.template +102 -0
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/documentation.yml.template +56 -0
- package/src/generators/preset/files/.github/ISSUE_TEMPLATE/feature-request.yml.template +60 -0
- package/src/generators/preset/files/.github/PULL_REQUEST_TEMPLATE.md.template +39 -0
- package/src/generators/preset/files/.github/SECURITY.md +9 -0
- package/src/generators/preset/files/.github/codecov.yml +29 -0
- package/src/generators/preset/files/.github/dependabot.yml +64 -0
- package/src/generators/preset/files/.github/labels.yml +84 -0
- package/src/generators/preset/files/.github/renovate.json +4 -0
- package/src/generators/preset/files/.github/renovate.json.template +63 -0
- package/src/generators/preset/files/.github/stale.yml +55 -0
- package/src/generators/preset/files/.github/workflows/build-release.yml.template +25 -0
- package/src/generators/preset/files/.github/workflows/code-review.yml +18 -0
- package/src/generators/preset/files/.github/workflows/codeql.yml +84 -0
- package/src/generators/preset/files/.github/workflows/dependabot-update.yml +32 -0
- package/src/generators/preset/files/.github/workflows/git-guardian.yml +23 -0
- package/src/generators/preset/files/.github/workflows/greetings.yml +31 -0
- package/src/generators/preset/files/.github/workflows/labels.yml +31 -0
- package/src/generators/preset/files/.github/workflows/lock.yml +26 -0
- package/src/generators/preset/files/.log4brains.yml.template +5 -0
- package/src/generators/preset/files/.markdownlint.json +155 -0
- package/src/generators/preset/files/.verdaccio/config.yml.template +40 -0
- package/src/generators/preset/files/.vscode/README.md +32 -0
- package/src/generators/preset/files/.vscode/cspell.json +3 -0
- package/src/generators/preset/files/.vscode/extensions.json +14 -0
- package/src/generators/preset/files/.vscode/launch.json +37 -0
- package/src/generators/preset/files/.vscode/settings.json +401 -0
- package/src/generators/preset/files/.vscode/tasks.json +4 -0
- package/src/generators/preset/files/.whitesource +14 -0
- package/src/generators/preset/files/assets/diagrams/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/dark/.gitkeep +0 -0
- package/src/generators/preset/files/assets/icons/light/.gitkeep +0 -0
- package/src/generators/preset/files/assets/logos/.gitkeep +0 -0
- package/src/generators/preset/files/docs/api-reference/.gitkeep +0 -0
- package/src/generators/preset/generator.spec.ts +20 -0
- package/src/generators/preset/generator.ts +315 -0
- package/src/generators/preset/untyped.ts +88 -0
- package/src/generators/release-version/generator.spec.ts +20 -0
- package/src/generators/release-version/generator.ts +920 -0
- package/src/generators/release-version/untyped.ts +156 -0
- package/src/plugins/rust/cargo-toml.ts +434 -0
- package/src/plugins/rust/index.ts +1 -0
- package/src/plugins/typescript/index.ts +1 -0
- package/src/plugins/typescript/project-config.ts +564 -0
- package/src/plugins/typescript/tsup.ts +198 -0
- package/src/types.ts +130 -0
- package/src/utils/apply-workspace-tokens.ts +73 -0
- package/src/utils/cargo.ts +219 -0
- package/src/utils/create-cli-options.ts +23 -0
- package/src/utils/get-project-configurations.ts +27 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/lock-file.ts +159 -0
- package/src/utils/package-helpers.ts +54 -0
- package/src/utils/plugin-helpers.ts +112 -0
- package/src/utils/pnpm-deps-update.ts +111 -0
- package/src/utils/project-tags.ts +162 -0
- package/src/utils/toml.ts +204 -0
- package/src/utils/typia-transform.ts +8 -0
- package/src/utils/versions.ts +19 -0
- package/tsconfig.json +30 -0
- package/tsup.config.ts +36 -0
- package/dist/chunk-62LQXZNY.js +0 -282
- package/dist/chunk-F3VG4R53.mjs +0 -282
- package/dist/src/generators/preset/files/LICENSE +0 -201
- package/docs/api/base/base-executor.schema.md +0 -16
- package/docs/api/base/base-generator.schema.md +0 -15
- package/docs/api/base/cargo-base-executor.schema.md +0 -90
- package/docs/api/base/typescript-build-executor.schema.md +0 -126
- package/docs/api/base/typescript-library-generator.schema.md +0 -129
- package/docs/api/executors/cargo-build/schema.md +0 -89
- package/docs/api/executors/cargo-check/schema.md +0 -90
- package/docs/api/executors/cargo-clippy/schema.md +0 -99
- package/docs/api/executors/cargo-doc/schema.md +0 -130
- package/docs/api/executors/cargo-format/schema.md +0 -90
- package/docs/api/executors/cargo-publish/schema.md +0 -117
- package/docs/api/executors/clean-package/schema.md +0 -65
- package/docs/api/executors/esbuild/schema.md +0 -126
- package/docs/api/executors/npm-publish/schema.md +0 -64
- package/docs/api/executors/size-limit/schema.md +0 -25
- package/docs/api/executors/typia/schema.md +0 -46
- package/docs/api/executors/unbuild/schema.md +0 -222
- package/docs/api/generators/browser-library/files/README.md +0 -58
- package/docs/api/generators/browser-library/schema.md +0 -129
- package/docs/api/generators/config-schema/schema.md +0 -25
- package/docs/api/generators/init/schema.md +0 -15
- package/docs/api/generators/neutral-library/files/README.md +0 -58
- package/docs/api/generators/neutral-library/schema.md +0 -129
- package/docs/api/generators/node-library/files/README.md +0 -63
- package/docs/api/generators/node-library/schema.md +0 -129
- package/docs/api/generators/preset/schema.md +0 -110
- package/docs/api/generators/release-version/schema.md +0 -160
- /package/{dist/src → src}/base/base-executor.schema.d.ts +0 -0
- /package/{dist/src → src}/base/base-executor.schema.json +0 -0
- /package/{dist/src → src}/base/base-executor.schema.md +0 -0
- /package/{dist/src → src}/base/base-generator.schema.d.ts +0 -0
- /package/{dist/src → src}/base/base-generator.schema.json +0 -0
- /package/{dist/src → src}/base/base-generator.schema.md +0 -0
- /package/{dist/src → src}/base/cargo-base-executor.schema.d.ts +0 -0
- /package/{dist/src → src}/base/cargo-base-executor.schema.json +0 -0
- /package/{dist/src → src}/base/cargo-base-executor.schema.md +0 -0
- /package/{dist/src → src}/base/typescript-build-executor.schema.d.ts +0 -0
- /package/{dist/src → src}/base/typescript-build-executor.schema.json +0 -0
- /package/{dist/src → src}/base/typescript-build-executor.schema.md +0 -0
- /package/{dist/src → src}/base/typescript-library-generator.schema.d.ts +0 -0
- /package/{dist/src → src}/base/typescript-library-generator.schema.json +0 -0
- /package/{dist/src → src}/base/typescript-library-generator.schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-build/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-build/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-build/schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-check/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-check/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-check/schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-clippy/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-clippy/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-clippy/schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-doc/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-doc/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-doc/schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-format/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-format/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-format/schema.md +0 -0
- /package/{dist/src → src}/executors/cargo-publish/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/cargo-publish/schema.json +0 -0
- /package/{dist/src → src}/executors/cargo-publish/schema.md +0 -0
- /package/{dist/src → src}/executors/clean-package/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/clean-package/schema.json +0 -0
- /package/{dist/src → src}/executors/clean-package/schema.md +0 -0
- /package/{dist/src → src}/executors/esbuild/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/esbuild/schema.json +0 -0
- /package/{dist/src → src}/executors/esbuild/schema.md +0 -0
- /package/{dist/src → src}/executors/npm-publish/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/npm-publish/schema.json +0 -0
- /package/{dist/src → src}/executors/npm-publish/schema.md +0 -0
- /package/{dist/src → src}/executors/size-limit/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/size-limit/schema.json +0 -0
- /package/{dist/src → src}/executors/size-limit/schema.md +0 -0
- /package/{dist/src → src}/executors/typia/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/typia/schema.json +0 -0
- /package/{dist/src → src}/executors/typia/schema.md +0 -0
- /package/{dist/src → src}/executors/unbuild/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/unbuild/schema.json +0 -0
- /package/{dist/src → src}/executors/unbuild/schema.md +0 -0
- /package/{dist/src → src}/generators/browser-library/files/README.md +0 -0
- /package/{dist/src → src}/generators/browser-library/files/jest.config.ts +0 -0
- /package/{dist/src → src}/generators/browser-library/files/src/index.ts.template +0 -0
- /package/{dist/src → src}/generators/browser-library/files/tsconfig.spec.json +0 -0
- /package/{dist/src → src}/generators/browser-library/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/browser-library/schema.json +0 -0
- /package/{dist/src → src}/generators/browser-library/schema.md +0 -0
- /package/{dist/src → src}/generators/config-schema/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/config-schema/schema.json +0 -0
- /package/{dist/src → src}/generators/config-schema/schema.md +0 -0
- /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/init/schema.json +0 -0
- /package/{dist/src → src}/generators/init/schema.md +0 -0
- /package/{dist/src → src}/generators/neutral-library/files/README.md +0 -0
- /package/{dist/src → src}/generators/neutral-library/files/jest.config.ts +0 -0
- /package/{dist/src → src}/generators/neutral-library/files/src/index.ts.template +0 -0
- /package/{dist/src → src}/generators/neutral-library/files/tsconfig.spec.json +0 -0
- /package/{dist/src → src}/generators/neutral-library/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/neutral-library/schema.json +0 -0
- /package/{dist/src → src}/generators/neutral-library/schema.md +0 -0
- /package/{dist/src → src}/generators/node-library/files/README.md +0 -0
- /package/{dist/src → src}/generators/node-library/files/jest.config.ts +0 -0
- /package/{dist/src → src}/generators/node-library/files/src/index.ts.template +0 -0
- /package/{dist/src → src}/generators/node-library/files/tsconfig.spec.json +0 -0
- /package/{dist/src → src}/generators/node-library/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/node-library/schema.json +0 -0
- /package/{dist/src → src}/generators/node-library/schema.md +0 -0
- /package/{LICENSE → src/generators/preset/files/LICENSE} +0 -0
- /package/{dist/src → src}/generators/preset/files/README.md.template +0 -0
- /package/{dist/src → src}/generators/preset/files/docs/readme-templates/README.footer.md.template +0 -0
- /package/{dist/src → src}/generators/preset/files/docs/readme-templates/README.header.md.template +0 -0
- /package/{dist/src → src}/generators/preset/files/eslint.config.js.template +0 -0
- /package/{dist/src → src}/generators/preset/files/knip.json +0 -0
- /package/{dist/src → src}/generators/preset/files/lefthook.json +0 -0
- /package/{dist/src → src}/generators/preset/files/nx.json +0 -0
- /package/{dist/src → src}/generators/preset/files/pnpm-workspace.yaml +0 -0
- /package/{dist/src → src}/generators/preset/files/socket.yaml +0 -0
- /package/{dist/src → src}/generators/preset/files/storm.json.template +0 -0
- /package/{dist/src → src}/generators/preset/files/tsconfig.base.json.template +0 -0
- /package/{dist/src → src}/generators/preset/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/preset/schema.json +0 -0
- /package/{dist/src → src}/generators/preset/schema.md +0 -0
- /package/{dist/src → src}/generators/release-version/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/release-version/schema.json +0 -0
- /package/{dist/src → src}/generators/release-version/schema.md +0 -0
- /package/{dist/src → src}/plugins/typescript/untyped-schema.ts +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createNodesFromFiles,
|
|
3
|
+
CreateNodesResultV2,
|
|
4
|
+
CreateNodesV2,
|
|
5
|
+
readJsonFile
|
|
6
|
+
} from "@nx/devkit";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
import { readNxJson } from "nx/src/config/nx-json.js";
|
|
10
|
+
import type { ProjectConfiguration } from "nx/src/config/workspace-json-project-json";
|
|
11
|
+
import { readTargetsFromPackageJson } from "nx/src/utils/package-json";
|
|
12
|
+
import type { PackageJson } from "pkg-types";
|
|
13
|
+
import { setDefaultProjectTags } from "../../utils/project-tags";
|
|
14
|
+
|
|
15
|
+
export const name = "storm-software/typescript/tsup";
|
|
16
|
+
|
|
17
|
+
export type TsupPluginOptions = object;
|
|
18
|
+
|
|
19
|
+
export const createNodesV2: CreateNodesV2<TsupPluginOptions> = [
|
|
20
|
+
"**/tsup.config.ts",
|
|
21
|
+
async (configFiles, options, context): Promise<CreateNodesResultV2> => {
|
|
22
|
+
return await createNodesFromFiles(
|
|
23
|
+
(configFile, options, context) => {
|
|
24
|
+
try {
|
|
25
|
+
console.log(`Processing tsup.config.ts file: ${configFile}`);
|
|
26
|
+
|
|
27
|
+
const projectRoot = createProjectRoot(
|
|
28
|
+
configFile,
|
|
29
|
+
context.workspaceRoot
|
|
30
|
+
);
|
|
31
|
+
if (!projectRoot) {
|
|
32
|
+
console.error(
|
|
33
|
+
`tsup.config.ts file must be location in the project root directory: ${configFile}`
|
|
34
|
+
);
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const packageJson = readJsonFile(join(projectRoot, "package.json"));
|
|
39
|
+
if (!packageJson) {
|
|
40
|
+
console.error(
|
|
41
|
+
`No package.json found in project root: ${projectRoot}`
|
|
42
|
+
);
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
!packageJson.devDependencies?.tsup &&
|
|
48
|
+
!packageJson.dependencies?.tsup
|
|
49
|
+
) {
|
|
50
|
+
console.warn(
|
|
51
|
+
`No "tsup" dependency or devDependency found in package.json: ${configFile}
|
|
52
|
+
Please add it to your dependencies by running "pnpm add tsup -D --filter="${packageJson.name}"`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const project = createProjectFromPackageJsonNextToProjectJson(
|
|
57
|
+
join(projectRoot, "project.json"),
|
|
58
|
+
packageJson
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const nxJson = readNxJson(context.workspaceRoot);
|
|
62
|
+
const targets: ProjectConfiguration["targets"] =
|
|
63
|
+
readTargetsFromPackageJson(packageJson, nxJson);
|
|
64
|
+
|
|
65
|
+
let relativeRoot = projectRoot
|
|
66
|
+
.replaceAll("\\", "/")
|
|
67
|
+
.replace(context.workspaceRoot.replaceAll("\\", "/"), "");
|
|
68
|
+
if (relativeRoot.startsWith("/")) {
|
|
69
|
+
relativeRoot = relativeRoot.slice(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let relativeConfig = configFile.replaceAll(relativeRoot, "");
|
|
73
|
+
while (relativeConfig.startsWith(".")) {
|
|
74
|
+
relativeConfig = relativeConfig.slice(1);
|
|
75
|
+
}
|
|
76
|
+
while (relativeConfig.startsWith("/")) {
|
|
77
|
+
relativeConfig = relativeConfig.slice(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
targets["build-base"] ??= {
|
|
81
|
+
cache: true,
|
|
82
|
+
inputs: [
|
|
83
|
+
`{workspaceRoot}/${configFile}`,
|
|
84
|
+
"typescript",
|
|
85
|
+
"^production"
|
|
86
|
+
],
|
|
87
|
+
outputs: ["{projectRoot}/dist"],
|
|
88
|
+
executor: "nx:run-commands",
|
|
89
|
+
dependsOn: ["build-untyped", "^build"],
|
|
90
|
+
options: {
|
|
91
|
+
command: `tsup --config="${relativeConfig}"`,
|
|
92
|
+
cwd: relativeRoot
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
targets.build ??= {
|
|
97
|
+
cache: true,
|
|
98
|
+
inputs: [
|
|
99
|
+
"{workspaceRoot}/LICENSE",
|
|
100
|
+
"{projectRoot}/dist",
|
|
101
|
+
"{projectRoot}/*.md",
|
|
102
|
+
"{projectRoot}/package.json"
|
|
103
|
+
],
|
|
104
|
+
outputs: ["{workspaceRoot}/dist/{projectRoot}"],
|
|
105
|
+
executor: "nx:run-commands",
|
|
106
|
+
dependsOn: ["build-base", "build-untyped", "^build"],
|
|
107
|
+
options: {
|
|
108
|
+
commands: [
|
|
109
|
+
`pnpm copyfiles LICENSE dist/${relativeRoot}`,
|
|
110
|
+
`pnpm copyfiles --up=2 ./${relativeRoot}/*.md ./${relativeRoot}/package.json dist/${relativeRoot}`,
|
|
111
|
+
`pnpm copyfiles --up=3 "./${relativeRoot}/dist/**/*" dist/${relativeRoot}/dist`
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
targets.clean = {
|
|
117
|
+
executor: "nx:run-commands",
|
|
118
|
+
inputs: [
|
|
119
|
+
`{workspaceRoot}/${configFile}`,
|
|
120
|
+
"typescript",
|
|
121
|
+
"^production"
|
|
122
|
+
],
|
|
123
|
+
options: {
|
|
124
|
+
commands: [
|
|
125
|
+
`pnpm exec rimraf dist/${relativeRoot}`,
|
|
126
|
+
`pnpm exec rimraf ${relativeRoot}/dist`
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
setDefaultProjectTags(project, name);
|
|
132
|
+
|
|
133
|
+
const result = project?.name
|
|
134
|
+
? {
|
|
135
|
+
projects: {
|
|
136
|
+
[project.name]: {
|
|
137
|
+
...project,
|
|
138
|
+
root: relativeRoot,
|
|
139
|
+
targets
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
: {};
|
|
144
|
+
console.log(`Writing Results for ${project?.name ?? "missing name"}`);
|
|
145
|
+
console.log(result);
|
|
146
|
+
|
|
147
|
+
return result;
|
|
148
|
+
} catch (e) {
|
|
149
|
+
console.error(e);
|
|
150
|
+
return {};
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
configFiles,
|
|
154
|
+
options,
|
|
155
|
+
context
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
function createProjectFromPackageJsonNextToProjectJson(
|
|
161
|
+
projectJsonPath: string,
|
|
162
|
+
packageJson: PackageJson
|
|
163
|
+
): ProjectConfiguration {
|
|
164
|
+
const { nx, name } = packageJson;
|
|
165
|
+
const root = dirname(projectJsonPath);
|
|
166
|
+
const projectJson = readJsonFile(projectJsonPath);
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
targets: {},
|
|
170
|
+
tags: [],
|
|
171
|
+
name,
|
|
172
|
+
...nx,
|
|
173
|
+
...projectJson,
|
|
174
|
+
root
|
|
175
|
+
} as ProjectConfiguration;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function createProjectRoot(
|
|
179
|
+
configPath: string,
|
|
180
|
+
workspaceRoot: string
|
|
181
|
+
): string | null {
|
|
182
|
+
try {
|
|
183
|
+
const root = dirname(configPath);
|
|
184
|
+
const projectRoot = join(workspaceRoot, root);
|
|
185
|
+
|
|
186
|
+
if (
|
|
187
|
+
!existsSync(join(projectRoot, "package.json")) &&
|
|
188
|
+
!existsSync(join(projectRoot, "project.json"))
|
|
189
|
+
) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return projectRoot;
|
|
194
|
+
} catch (e) {
|
|
195
|
+
console.error(e);
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { StormWorkspaceConfig } from "@storm-software/config";
|
|
2
|
+
import type { Options } from "tsup";
|
|
3
|
+
import { BaseExecutorSchema } from "./base/base-executor.schema.d";
|
|
4
|
+
import { BaseGeneratorSchema } from "./base/base-generator.schema.d";
|
|
5
|
+
|
|
6
|
+
export interface TsupContext {
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
sourceRoot: string;
|
|
9
|
+
projectName: string;
|
|
10
|
+
main: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type BuildOptions = Options;
|
|
14
|
+
export type Entry = string | string[] | Record<string, string>;
|
|
15
|
+
|
|
16
|
+
export interface WorkspaceToolHooks<TSchema = any> {
|
|
17
|
+
applyDefaultOptions?: (
|
|
18
|
+
options: Partial<TSchema>,
|
|
19
|
+
config?: StormWorkspaceConfig
|
|
20
|
+
) => Promise<TSchema> | TSchema;
|
|
21
|
+
preProcess?: (
|
|
22
|
+
options: TSchema,
|
|
23
|
+
config?: StormWorkspaceConfig
|
|
24
|
+
) => Promise<void> | void;
|
|
25
|
+
postProcess?: (config?: StormWorkspaceConfig) => Promise<void> | void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BaseWorkspaceToolOptions<TSchema = any> {
|
|
29
|
+
skipReadingConfig?: boolean;
|
|
30
|
+
hooks?: WorkspaceToolHooks<TSchema>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type BaseExecutorOptions<
|
|
34
|
+
TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema
|
|
35
|
+
> = BaseWorkspaceToolOptions<TExecutorSchema>;
|
|
36
|
+
|
|
37
|
+
export interface BaseExecutorResult {
|
|
38
|
+
error?: Error;
|
|
39
|
+
success?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type BaseGeneratorOptions<
|
|
43
|
+
TGeneratorSchema extends BaseGeneratorSchema = BaseGeneratorSchema
|
|
44
|
+
> = BaseWorkspaceToolOptions<TGeneratorSchema>;
|
|
45
|
+
|
|
46
|
+
export interface BaseGeneratorResult extends Record<string, any> {
|
|
47
|
+
error?: Error;
|
|
48
|
+
success?: boolean;
|
|
49
|
+
data?: any;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// export type TypeScriptLibraryGeneratorSchema = Omit<
|
|
53
|
+
// LibraryGeneratorSchema,
|
|
54
|
+
// | "js"
|
|
55
|
+
// | "pascalCaseFiles"
|
|
56
|
+
// | "skipFormat"
|
|
57
|
+
// | "skipTsConfig"
|
|
58
|
+
// | "skipPackageJson"
|
|
59
|
+
// | "includeBabelRc"
|
|
60
|
+
// | "unitTestRunner"
|
|
61
|
+
// | "platform"
|
|
62
|
+
// | "linter"
|
|
63
|
+
// | "testEnvironment"
|
|
64
|
+
// | "config"
|
|
65
|
+
// | "compiler"
|
|
66
|
+
// | "bundler"
|
|
67
|
+
// | "skipTypeCheck"
|
|
68
|
+
// | "minimal"
|
|
69
|
+
// > & {
|
|
70
|
+
// name: string;
|
|
71
|
+
// description: string;
|
|
72
|
+
// buildExecutor: string;
|
|
73
|
+
// platform?: "neutral" | "node" | "browser" | "worker";
|
|
74
|
+
// devDependencies?: Record<string, string>;
|
|
75
|
+
// peerDependencies?: Record<string, string>;
|
|
76
|
+
// peerDependenciesMeta?: Record<string, any>;
|
|
77
|
+
// tsConfigOptions?: Record<string, any>;
|
|
78
|
+
// };
|
|
79
|
+
|
|
80
|
+
export type ProjectTagVariant =
|
|
81
|
+
| "language"
|
|
82
|
+
| "type"
|
|
83
|
+
| "dist-style"
|
|
84
|
+
| "provider"
|
|
85
|
+
| "platform"
|
|
86
|
+
| "registry"
|
|
87
|
+
| "plugin";
|
|
88
|
+
export const ProjectTagVariant = {
|
|
89
|
+
LANGUAGE: "language" as ProjectTagVariant,
|
|
90
|
+
TYPE: "type" as ProjectTagVariant,
|
|
91
|
+
DIST_STYLE: "dist-style" as ProjectTagVariant,
|
|
92
|
+
PROVIDER: "provider" as ProjectTagVariant,
|
|
93
|
+
PLATFORM: "platform" as ProjectTagVariant,
|
|
94
|
+
REGISTRY: "registry" as ProjectTagVariant,
|
|
95
|
+
PLUGIN: "plugin" as ProjectTagVariant
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type ProjectTagLanguageValue = "typescript" | "rust";
|
|
99
|
+
export const ProjectTagLanguageValue = {
|
|
100
|
+
TYPESCRIPT: "typescript" as ProjectTagLanguageValue,
|
|
101
|
+
RUST: "rust" as ProjectTagLanguageValue
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export type ProjectTagTypeValue = "library" | "application";
|
|
105
|
+
export const ProjectTagTypeValue = {
|
|
106
|
+
LIBRARY: "library" as ProjectTagTypeValue,
|
|
107
|
+
APPLICATION: "application" as ProjectTagTypeValue
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type ProjectTagDistStyleValue = "normal" | "clean";
|
|
111
|
+
export const ProjectTagDistStyleValue = {
|
|
112
|
+
NORMAL: "normal" as ProjectTagDistStyleValue,
|
|
113
|
+
CLEAN: "clean" as ProjectTagDistStyleValue
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type ProjectTagPlatformValue = "node" | "browser" | "neutral" | "worker";
|
|
117
|
+
export const ProjectTagPlatformValue = {
|
|
118
|
+
NODE: "node" as ProjectTagPlatformValue,
|
|
119
|
+
BROWSER: "browser" as ProjectTagPlatformValue,
|
|
120
|
+
NEUTRAL: "neutral" as ProjectTagPlatformValue,
|
|
121
|
+
WORKER: "worker" as ProjectTagPlatformValue
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type ProjectTagRegistryValue = "cargo" | "npm" | "container" | "cyclone";
|
|
125
|
+
export const ProjectTagRegistryValue = {
|
|
126
|
+
CARGO: "cargo" as ProjectTagRegistryValue,
|
|
127
|
+
NPM: "npm" as ProjectTagRegistryValue,
|
|
128
|
+
CONTAINER: "container" as ProjectTagRegistryValue,
|
|
129
|
+
CYCLONE: "cyclone" as ProjectTagRegistryValue
|
|
130
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ProjectConfiguration } from "@nx/devkit";
|
|
2
|
+
import {
|
|
3
|
+
findWorkspaceRoot,
|
|
4
|
+
type BaseTokenizerOptions,
|
|
5
|
+
} from "@storm-software/config-tools";
|
|
6
|
+
|
|
7
|
+
export type ExecutorTokenizerOptions = BaseTokenizerOptions &
|
|
8
|
+
ProjectConfiguration & {
|
|
9
|
+
projectName: string;
|
|
10
|
+
projectRoot: string;
|
|
11
|
+
sourceRoot: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const applyWorkspaceExecutorTokens = async (
|
|
15
|
+
option: string,
|
|
16
|
+
tokenizerOptions: ExecutorTokenizerOptions,
|
|
17
|
+
): Promise<string> => {
|
|
18
|
+
let result = option;
|
|
19
|
+
if (!result) {
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let projectName!: string;
|
|
24
|
+
let projectRoot!: string;
|
|
25
|
+
let sourceRoot!: string;
|
|
26
|
+
if ((tokenizerOptions as ExecutorTokenizerOptions)?.projectName) {
|
|
27
|
+
const context = tokenizerOptions as ExecutorTokenizerOptions;
|
|
28
|
+
projectName = context.projectName;
|
|
29
|
+
projectRoot = context.root;
|
|
30
|
+
sourceRoot = context.sourceRoot;
|
|
31
|
+
} else {
|
|
32
|
+
const projectConfig = tokenizerOptions as ProjectConfiguration;
|
|
33
|
+
projectRoot = projectConfig.root;
|
|
34
|
+
|
|
35
|
+
if (projectConfig.name) {
|
|
36
|
+
projectName = projectConfig.name;
|
|
37
|
+
}
|
|
38
|
+
if (projectConfig.sourceRoot) {
|
|
39
|
+
sourceRoot = projectConfig.sourceRoot;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (tokenizerOptions.config) {
|
|
44
|
+
const configKeys = Object.keys(tokenizerOptions.config);
|
|
45
|
+
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
46
|
+
for (const configKey of configKeys) {
|
|
47
|
+
if (result.includes(`{${configKey}}`)) {
|
|
48
|
+
result = result.replaceAll(
|
|
49
|
+
`{${configKey}}`,
|
|
50
|
+
tokenizerOptions.config[configKey],
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (result.includes("{projectName}")) {
|
|
57
|
+
result = result.replaceAll("{projectName}", projectName);
|
|
58
|
+
}
|
|
59
|
+
if (result.includes("{projectRoot}")) {
|
|
60
|
+
result = result.replaceAll("{projectRoot}", projectRoot);
|
|
61
|
+
}
|
|
62
|
+
if (result.includes("{sourceRoot}")) {
|
|
63
|
+
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
64
|
+
}
|
|
65
|
+
if (result.includes("{workspaceRoot}")) {
|
|
66
|
+
result = result.replaceAll(
|
|
67
|
+
"{workspaceRoot}",
|
|
68
|
+
tokenizerOptions.workspaceRoot ?? findWorkspaceRoot(),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return result;
|
|
73
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ExecutorContext, joinPathFragments, workspaceRoot } from "@nx/devkit";
|
|
2
|
+
import {
|
|
3
|
+
type ChildProcess,
|
|
4
|
+
execSync,
|
|
5
|
+
spawn,
|
|
6
|
+
type StdioOptions,
|
|
7
|
+
} from "node:child_process";
|
|
8
|
+
import { relative } from "node:path";
|
|
9
|
+
import { CargoBaseExecutorSchema } from "../base/cargo-base-executor.schema.d";
|
|
10
|
+
import type { CargoMetadata, Dependency, Package } from "./toml";
|
|
11
|
+
|
|
12
|
+
interface CargoRun {
|
|
13
|
+
success: boolean;
|
|
14
|
+
output: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface RunCargoOptions {
|
|
18
|
+
stdio: StdioOptions;
|
|
19
|
+
env: NodeJS.ProcessEnv | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const INVALID_CARGO_ARGS = [
|
|
23
|
+
"allFeatures",
|
|
24
|
+
"allTargets",
|
|
25
|
+
"main",
|
|
26
|
+
"outputPath",
|
|
27
|
+
"package",
|
|
28
|
+
"tsConfig",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export let childProcess: ChildProcess | null;
|
|
32
|
+
|
|
33
|
+
export const buildCargoCommand = (
|
|
34
|
+
baseCommand: string,
|
|
35
|
+
options: CargoBaseExecutorSchema,
|
|
36
|
+
context: ExecutorContext,
|
|
37
|
+
): string[] => {
|
|
38
|
+
const args = [] as string[];
|
|
39
|
+
|
|
40
|
+
if (options.toolchain && options.toolchain !== "stable") {
|
|
41
|
+
args.push(`+${options.toolchain}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
args.push(baseCommand);
|
|
45
|
+
|
|
46
|
+
for (const [key, value] of Object.entries(options)) {
|
|
47
|
+
if (
|
|
48
|
+
key === "toolchain" ||
|
|
49
|
+
key === "release" ||
|
|
50
|
+
INVALID_CARGO_ARGS.includes(key)
|
|
51
|
+
) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (typeof value === "boolean") {
|
|
56
|
+
// false flags should not be added to the cargo args
|
|
57
|
+
if (value) {
|
|
58
|
+
args.push(`--${key}`);
|
|
59
|
+
}
|
|
60
|
+
} else if (Array.isArray(value)) {
|
|
61
|
+
for (const item of value) {
|
|
62
|
+
args.push(`--${key}`, item);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
args.push(`--${key}`, String(value));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (context.projectName) {
|
|
70
|
+
args.push("-p", context.projectName);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (options.allFeatures && !args.includes("--all-features")) {
|
|
74
|
+
args.push("--all-features");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.allTargets && !args.includes("--all-targets")) {
|
|
78
|
+
args.push("--all-targets");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (options.release && !args.includes("--profile")) {
|
|
82
|
+
args.push("--release");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (options.outputPath && !args.includes("--target-dir")) {
|
|
86
|
+
args.push("--target-dir", options.outputPath);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return args;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export async function cargoCommand(
|
|
93
|
+
...args: string[]
|
|
94
|
+
): Promise<{ success: boolean }> {
|
|
95
|
+
console.log(`> cargo ${args.join(" ")}`);
|
|
96
|
+
args.push("--color", "always");
|
|
97
|
+
|
|
98
|
+
return await Promise.resolve(runProcess("cargo", ...args));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function cargoRunCommand(
|
|
102
|
+
...args: string[]
|
|
103
|
+
): Promise<{ success: boolean }> {
|
|
104
|
+
console.log(`> cargo ${args.join(" ")}`);
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
childProcess = spawn("cargo", [...args, "--color", "always"], {
|
|
107
|
+
cwd: process.cwd(),
|
|
108
|
+
windowsHide: true,
|
|
109
|
+
detached: true,
|
|
110
|
+
shell: false,
|
|
111
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Ensure the child process is killed when the parent exits
|
|
115
|
+
process.on("exit", () => childProcess?.kill());
|
|
116
|
+
process.on("SIGTERM", () => childProcess?.kill());
|
|
117
|
+
process.on("SIGINT", () => childProcess?.kill());
|
|
118
|
+
|
|
119
|
+
childProcess.on("error", (_err) => {
|
|
120
|
+
reject({ success: false });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
childProcess.on("exit", (code) => {
|
|
124
|
+
childProcess = null;
|
|
125
|
+
if (code === 0) {
|
|
126
|
+
resolve({ success: true });
|
|
127
|
+
} else {
|
|
128
|
+
reject({ success: false });
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function cargoCommandSync(
|
|
135
|
+
args = "",
|
|
136
|
+
options?: Partial<RunCargoOptions>,
|
|
137
|
+
): CargoRun {
|
|
138
|
+
const normalizedOptions: RunCargoOptions = {
|
|
139
|
+
stdio: options?.stdio ?? "inherit",
|
|
140
|
+
env: {
|
|
141
|
+
...process.env,
|
|
142
|
+
...options?.env,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
try {
|
|
147
|
+
return {
|
|
148
|
+
output: execSync(`cargo ${args}`, {
|
|
149
|
+
encoding: "utf8",
|
|
150
|
+
windowsHide: true,
|
|
151
|
+
stdio: normalizedOptions.stdio,
|
|
152
|
+
env: normalizedOptions.env,
|
|
153
|
+
maxBuffer: 1024 * 1024 * 10,
|
|
154
|
+
}),
|
|
155
|
+
success: true,
|
|
156
|
+
};
|
|
157
|
+
} catch (e) {
|
|
158
|
+
return {
|
|
159
|
+
output: e as string,
|
|
160
|
+
success: false,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function cargoMetadata(): CargoMetadata | null {
|
|
166
|
+
const output = cargoCommandSync("metadata --format-version=1", {
|
|
167
|
+
stdio: "pipe",
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (!output.success) {
|
|
171
|
+
console.error("Failed to get cargo metadata");
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return JSON.parse(output.output) as CargoMetadata;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function isExternal(
|
|
179
|
+
packageOrDep: Package | Dependency,
|
|
180
|
+
workspaceRoot: string,
|
|
181
|
+
) {
|
|
182
|
+
const isRegistry = packageOrDep.source?.startsWith("registry+") ?? false;
|
|
183
|
+
const isGit = packageOrDep.source?.startsWith("git+") ?? false;
|
|
184
|
+
const isOutsideWorkspace =
|
|
185
|
+
"path" in packageOrDep &&
|
|
186
|
+
relative(workspaceRoot, packageOrDep.path).startsWith("..");
|
|
187
|
+
|
|
188
|
+
return isRegistry || isGit || isOutsideWorkspace;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function runProcess(
|
|
192
|
+
processCmd: string,
|
|
193
|
+
...args: string[]
|
|
194
|
+
): { success: boolean } | PromiseLike<{ success: boolean }> {
|
|
195
|
+
const metadata = cargoMetadata();
|
|
196
|
+
const targetDir =
|
|
197
|
+
metadata?.target_directory ??
|
|
198
|
+
joinPathFragments(workspaceRoot, "dist", "cargo");
|
|
199
|
+
|
|
200
|
+
return new Promise((resolve) => {
|
|
201
|
+
if (process.env.VERCEL) {
|
|
202
|
+
// Vercel doesnt have support for cargo atm, so auto success builds
|
|
203
|
+
return resolve({ success: true });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
execSync(`${processCmd} ${args.join(" ")}`, {
|
|
207
|
+
cwd: process.cwd(),
|
|
208
|
+
env: {
|
|
209
|
+
...process.env,
|
|
210
|
+
RUSTC_WRAPPER: "",
|
|
211
|
+
CARGO_TARGET_DIR: targetDir,
|
|
212
|
+
CARGO_BUILD_TARGET_DIR: targetDir,
|
|
213
|
+
},
|
|
214
|
+
windowsHide: true,
|
|
215
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
216
|
+
});
|
|
217
|
+
resolve({ success: true });
|
|
218
|
+
});
|
|
219
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { names } from "@nx/devkit";
|
|
2
|
+
|
|
3
|
+
export function createCliOptions<
|
|
4
|
+
T extends Record<string, string | number | boolean | string[]>,
|
|
5
|
+
>(obj: T): string[] {
|
|
6
|
+
const args: string[] = [];
|
|
7
|
+
|
|
8
|
+
for (const key in obj) {
|
|
9
|
+
const value = obj[key];
|
|
10
|
+
if (value) {
|
|
11
|
+
const arg = names(key).fileName;
|
|
12
|
+
if (Array.isArray(value)) {
|
|
13
|
+
args.push(
|
|
14
|
+
`--${arg.toLowerCase()}=${value.map((v) => v.trim()).join(",")}`,
|
|
15
|
+
);
|
|
16
|
+
} else {
|
|
17
|
+
args.push(`--${arg.toLowerCase()}=${value}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return args;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ProjectConfiguration } from "@nx/devkit";
|
|
2
|
+
import { findWorkspaceRoot } from "@storm-software/config-tools/utilities/find-workspace-root";
|
|
3
|
+
import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve the project configurations from the workspace.
|
|
7
|
+
*
|
|
8
|
+
* @returns The project configurations.
|
|
9
|
+
*/
|
|
10
|
+
export const getProjectConfigurations = async <
|
|
11
|
+
TConfig extends ProjectConfiguration = ProjectConfiguration,
|
|
12
|
+
>(): Promise<Record<string, TConfig>> => {
|
|
13
|
+
return retrieveProjectConfigurationsWithoutPluginInference(
|
|
14
|
+
findWorkspaceRoot(),
|
|
15
|
+
) as Promise<Record<string, TConfig>>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve the project configurations from the workspace.
|
|
20
|
+
*
|
|
21
|
+
* @returns The project configurations.
|
|
22
|
+
*/
|
|
23
|
+
export const getProjectConfiguration = <
|
|
24
|
+
TConfig extends ProjectConfiguration = ProjectConfiguration,
|
|
25
|
+
>(
|
|
26
|
+
projectName: string,
|
|
27
|
+
): TConfig | undefined => getProjectConfigurations<TConfig>()?.[projectName];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./apply-workspace-tokens";
|
|
2
|
+
export * from "./cargo";
|
|
3
|
+
export * from "./create-cli-options";
|
|
4
|
+
export * from "./get-project-configurations";
|
|
5
|
+
export * from "./lock-file";
|
|
6
|
+
export * from "./package-helpers";
|
|
7
|
+
export * from "./plugin-helpers";
|
|
8
|
+
export * from "./pnpm-deps-update";
|
|
9
|
+
export * from "./project-tags";
|
|
10
|
+
export * from "./toml";
|
|
11
|
+
export * from "./typia-transform";
|
|
12
|
+
export * from "./versions";
|