@storm-software/workspace-tools 1.270.2 → 1.271.1

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.
Files changed (287) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -1
  3. package/dist/chunk-4QYM3VS4.mjs +282 -0
  4. package/dist/{chunk-ZP76EMBE.js → chunk-FYXWAGK3.js} +97 -27
  5. package/dist/chunk-MJMN2T4N.mjs +166 -0
  6. package/dist/chunk-RZVF4LHT.js +282 -0
  7. package/dist/executors.js +6 -6
  8. package/dist/executors.mjs +6 -6
  9. package/dist/index.d.mts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +6 -6
  12. package/dist/index.mjs +8 -8
  13. package/dist/src/executors/npm-publish/executor.js +3 -3
  14. package/dist/src/executors/npm-publish/executor.mjs +2 -2
  15. package/dist/src/generators/preset/files/LICENSE +201 -0
  16. package/dist/src/utils/index.d.mts +1 -1
  17. package/dist/src/utils/index.d.ts +1 -1
  18. package/dist/src/utils/index.js +2 -2
  19. package/dist/src/utils/index.mjs +3 -3
  20. package/dist/src/utils/pnpm-deps-update.d.mts +3 -3
  21. package/dist/src/utils/pnpm-deps-update.d.ts +3 -3
  22. package/dist/src/utils/pnpm-deps-update.js +2 -2
  23. package/dist/src/utils/pnpm-deps-update.mjs +3 -3
  24. package/docs/api/base/base-executor.schema.md +16 -0
  25. package/docs/api/base/base-generator.schema.md +15 -0
  26. package/docs/api/base/cargo-base-executor.schema.md +90 -0
  27. package/docs/api/base/typescript-build-executor.schema.md +126 -0
  28. package/docs/api/base/typescript-library-generator.schema.md +129 -0
  29. package/docs/api/executors/cargo-build/schema.md +89 -0
  30. package/docs/api/executors/cargo-check/schema.md +90 -0
  31. package/docs/api/executors/cargo-clippy/schema.md +99 -0
  32. package/docs/api/executors/cargo-doc/schema.md +130 -0
  33. package/docs/api/executors/cargo-format/schema.md +90 -0
  34. package/docs/api/executors/cargo-publish/schema.md +117 -0
  35. package/docs/api/executors/clean-package/schema.md +65 -0
  36. package/docs/api/executors/esbuild/schema.md +126 -0
  37. package/docs/api/executors/npm-publish/schema.md +64 -0
  38. package/docs/api/executors/size-limit/schema.md +25 -0
  39. package/docs/api/executors/typia/schema.md +46 -0
  40. package/docs/api/executors/unbuild/schema.md +222 -0
  41. package/docs/api/generators/browser-library/files/README.md +58 -0
  42. package/docs/api/generators/browser-library/schema.md +129 -0
  43. package/docs/api/generators/config-schema/schema.md +25 -0
  44. package/docs/api/generators/init/schema.md +15 -0
  45. package/docs/api/generators/neutral-library/files/README.md +58 -0
  46. package/docs/api/generators/neutral-library/schema.md +129 -0
  47. package/docs/api/generators/node-library/files/README.md +63 -0
  48. package/docs/api/generators/node-library/schema.md +129 -0
  49. package/docs/api/generators/preset/schema.md +110 -0
  50. package/docs/api/generators/release-version/schema.md +160 -0
  51. package/package.json +13 -35
  52. package/dist/chunk-CMH2A42G.js +0 -467
  53. package/dist/chunk-HMJTTE4A.mjs +0 -96
  54. package/dist/chunk-I54IKCIV.mjs +0 -467
  55. package/docs/executors/rollup.md +0 -88
  56. package/executors.ts +0 -23
  57. package/generators.ts +0 -14
  58. package/index.ts +0 -5
  59. package/project.json +0 -58
  60. package/src/base/base-executor.ts +0 -200
  61. package/src/base/base-executor.untyped.ts +0 -18
  62. package/src/base/base-generator.ts +0 -130
  63. package/src/base/base-generator.untyped.ts +0 -16
  64. package/src/base/cargo-base-executor.untyped.ts +0 -73
  65. package/src/base/index.ts +0 -8
  66. package/src/base/typescript-build-executor.untyped.ts +0 -153
  67. package/src/base/typescript-library-generator.ts +0 -415
  68. package/src/base/typescript-library-generator.untyped.ts +0 -106
  69. package/src/executors/cargo-build/executor.spec.ts +0 -18
  70. package/src/executors/cargo-build/executor.ts +0 -28
  71. package/src/executors/cargo-build/untyped.ts +0 -18
  72. package/src/executors/cargo-check/executor.spec.ts +0 -18
  73. package/src/executors/cargo-check/executor.ts +0 -27
  74. package/src/executors/cargo-check/untyped.ts +0 -11
  75. package/src/executors/cargo-clippy/executor.spec.ts +0 -18
  76. package/src/executors/cargo-clippy/executor.ts +0 -28
  77. package/src/executors/cargo-clippy/untyped.ts +0 -18
  78. package/src/executors/cargo-doc/executor.spec.ts +0 -18
  79. package/src/executors/cargo-doc/executor.ts +0 -39
  80. package/src/executors/cargo-doc/untyped.ts +0 -44
  81. package/src/executors/cargo-format/executor.spec.ts +0 -18
  82. package/src/executors/cargo-format/executor.ts +0 -28
  83. package/src/executors/cargo-format/untyped.ts +0 -11
  84. package/src/executors/cargo-publish/executor.spec.ts +0 -11
  85. package/src/executors/cargo-publish/executor.ts +0 -139
  86. package/src/executors/cargo-publish/untyped.ts +0 -33
  87. package/src/executors/clean-package/constants.ts +0 -99
  88. package/src/executors/clean-package/executor.spec.ts +0 -18
  89. package/src/executors/clean-package/executor.ts +0 -214
  90. package/src/executors/clean-package/types.ts +0 -6
  91. package/src/executors/clean-package/untyped.ts +0 -60
  92. package/src/executors/clean-package/utils.ts +0 -85
  93. package/src/executors/esbuild/executor.spec.ts +0 -11
  94. package/src/executors/esbuild/executor.ts +0 -67
  95. package/src/executors/esbuild/untyped.ts +0 -20
  96. package/src/executors/npm-publish/executor.spec.ts +0 -11
  97. package/src/executors/npm-publish/executor.ts +0 -680
  98. package/src/executors/npm-publish/untyped.ts +0 -56
  99. package/src/executors/size-limit/executor.spec.ts +0 -18
  100. package/src/executors/size-limit/executor.ts +0 -88
  101. package/src/executors/size-limit/untyped.ts +0 -22
  102. package/src/executors/typia/executor.ts +0 -54
  103. package/src/executors/typia/untyped.ts +0 -48
  104. package/src/executors/unbuild/executor.spec.ts +0 -11
  105. package/src/executors/unbuild/executor.ts +0 -136
  106. package/src/executors/unbuild/untyped.ts +0 -152
  107. package/src/generators/browser-library/generator.spec.ts +0 -20
  108. package/src/generators/browser-library/generator.ts +0 -109
  109. package/src/generators/browser-library/untyped.ts +0 -29
  110. package/src/generators/config-schema/generator.spec.ts +0 -20
  111. package/src/generators/config-schema/generator.ts +0 -90
  112. package/src/generators/config-schema/untyped.ts +0 -19
  113. package/src/generators/init/init.ts +0 -32
  114. package/src/generators/init/untyped.ts +0 -16
  115. package/src/generators/neutral-library/generator.spec.ts +0 -20
  116. package/src/generators/neutral-library/generator.ts +0 -81
  117. package/src/generators/neutral-library/untyped.ts +0 -29
  118. package/src/generators/node-library/generator.spec.ts +0 -20
  119. package/src/generators/node-library/generator.ts +0 -84
  120. package/src/generators/node-library/untyped.ts +0 -29
  121. package/src/generators/preset/files/.all-contributorsrc.template +0 -48
  122. package/src/generators/preset/files/.editorconfig +0 -454
  123. package/src/generators/preset/files/.env.template +0 -38
  124. package/src/generators/preset/files/.gitattributes +0 -52
  125. package/src/generators/preset/files/.github/.nvmrc +0 -1
  126. package/src/generators/preset/files/.github/CODEOWNERS +0 -3
  127. package/src/generators/preset/files/.github/CODE_OF_CONDUCT.md +0 -125
  128. package/src/generators/preset/files/.github/CONTRIBUTING.md.template +0 -15
  129. package/src/generators/preset/files/.github/FUNDING.yml +0 -3
  130. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/bug-report.yml.template +0 -102
  131. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/documentation.yml.template +0 -56
  132. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/feature-request.yml.template +0 -60
  133. package/src/generators/preset/files/.github/PULL_REQUEST_TEMPLATE.md.template +0 -39
  134. package/src/generators/preset/files/.github/SECURITY.md +0 -9
  135. package/src/generators/preset/files/.github/codecov.yml +0 -29
  136. package/src/generators/preset/files/.github/dependabot.yml +0 -64
  137. package/src/generators/preset/files/.github/labels.yml +0 -84
  138. package/src/generators/preset/files/.github/renovate.json +0 -4
  139. package/src/generators/preset/files/.github/renovate.json.template +0 -63
  140. package/src/generators/preset/files/.github/stale.yml +0 -55
  141. package/src/generators/preset/files/.github/workflows/build-release.yml.template +0 -25
  142. package/src/generators/preset/files/.github/workflows/code-review.yml +0 -18
  143. package/src/generators/preset/files/.github/workflows/codeql.yml +0 -84
  144. package/src/generators/preset/files/.github/workflows/dependabot-update.yml +0 -32
  145. package/src/generators/preset/files/.github/workflows/git-guardian.yml +0 -23
  146. package/src/generators/preset/files/.github/workflows/greetings.yml +0 -31
  147. package/src/generators/preset/files/.github/workflows/labels.yml +0 -31
  148. package/src/generators/preset/files/.github/workflows/lock.yml +0 -26
  149. package/src/generators/preset/files/.log4brains.yml.template +0 -5
  150. package/src/generators/preset/files/.markdownlint.json +0 -155
  151. package/src/generators/preset/files/.verdaccio/config.yml.template +0 -40
  152. package/src/generators/preset/files/.vscode/README.md +0 -32
  153. package/src/generators/preset/files/.vscode/cspell.json +0 -3
  154. package/src/generators/preset/files/.vscode/extensions.json +0 -14
  155. package/src/generators/preset/files/.vscode/launch.json +0 -37
  156. package/src/generators/preset/files/.vscode/settings.json +0 -401
  157. package/src/generators/preset/files/.vscode/tasks.json +0 -4
  158. package/src/generators/preset/files/.whitesource +0 -14
  159. package/src/generators/preset/files/assets/diagrams/.gitkeep +0 -0
  160. package/src/generators/preset/files/assets/icons/dark/.gitkeep +0 -0
  161. package/src/generators/preset/files/assets/icons/light/.gitkeep +0 -0
  162. package/src/generators/preset/files/assets/logos/.gitkeep +0 -0
  163. package/src/generators/preset/files/docs/api-reference/.gitkeep +0 -0
  164. package/src/generators/preset/generator.spec.ts +0 -20
  165. package/src/generators/preset/generator.ts +0 -315
  166. package/src/generators/preset/untyped.ts +0 -88
  167. package/src/generators/release-version/generator.spec.ts +0 -20
  168. package/src/generators/release-version/generator.ts +0 -920
  169. package/src/generators/release-version/untyped.ts +0 -156
  170. package/src/plugins/rust/cargo-toml.ts +0 -434
  171. package/src/plugins/rust/index.ts +0 -1
  172. package/src/plugins/typescript/index.ts +0 -1
  173. package/src/plugins/typescript/project-config.ts +0 -564
  174. package/src/plugins/typescript/tsup.ts +0 -198
  175. package/src/types.ts +0 -130
  176. package/src/utils/apply-workspace-tokens.ts +0 -73
  177. package/src/utils/cargo.ts +0 -219
  178. package/src/utils/create-cli-options.ts +0 -23
  179. package/src/utils/get-project-configurations.ts +0 -27
  180. package/src/utils/index.ts +0 -12
  181. package/src/utils/lock-file.ts +0 -159
  182. package/src/utils/package-helpers.ts +0 -54
  183. package/src/utils/plugin-helpers.ts +0 -112
  184. package/src/utils/pnpm-deps-update.ts +0 -111
  185. package/src/utils/project-tags.ts +0 -162
  186. package/src/utils/toml.ts +0 -204
  187. package/src/utils/typia-transform.ts +0 -8
  188. package/src/utils/versions.ts +0 -19
  189. package/tsconfig.json +0 -30
  190. package/tsup.config.ts +0 -36
  191. /package/{src/generators/preset/files/LICENSE → LICENSE} +0 -0
  192. /package/{src → dist/src}/base/base-executor.schema.d.ts +0 -0
  193. /package/{src → dist/src}/base/base-executor.schema.json +0 -0
  194. /package/{src → dist/src}/base/base-executor.schema.md +0 -0
  195. /package/{src → dist/src}/base/base-generator.schema.d.ts +0 -0
  196. /package/{src → dist/src}/base/base-generator.schema.json +0 -0
  197. /package/{src → dist/src}/base/base-generator.schema.md +0 -0
  198. /package/{src → dist/src}/base/cargo-base-executor.schema.d.ts +0 -0
  199. /package/{src → dist/src}/base/cargo-base-executor.schema.json +0 -0
  200. /package/{src → dist/src}/base/cargo-base-executor.schema.md +0 -0
  201. /package/{src → dist/src}/base/typescript-build-executor.schema.d.ts +0 -0
  202. /package/{src → dist/src}/base/typescript-build-executor.schema.json +0 -0
  203. /package/{src → dist/src}/base/typescript-build-executor.schema.md +0 -0
  204. /package/{src → dist/src}/base/typescript-library-generator.schema.d.ts +0 -0
  205. /package/{src → dist/src}/base/typescript-library-generator.schema.json +0 -0
  206. /package/{src → dist/src}/base/typescript-library-generator.schema.md +0 -0
  207. /package/{src → dist/src}/executors/cargo-build/schema.d.ts +0 -0
  208. /package/{src → dist/src}/executors/cargo-build/schema.json +0 -0
  209. /package/{src → dist/src}/executors/cargo-build/schema.md +0 -0
  210. /package/{src → dist/src}/executors/cargo-check/schema.d.ts +0 -0
  211. /package/{src → dist/src}/executors/cargo-check/schema.json +0 -0
  212. /package/{src → dist/src}/executors/cargo-check/schema.md +0 -0
  213. /package/{src → dist/src}/executors/cargo-clippy/schema.d.ts +0 -0
  214. /package/{src → dist/src}/executors/cargo-clippy/schema.json +0 -0
  215. /package/{src → dist/src}/executors/cargo-clippy/schema.md +0 -0
  216. /package/{src → dist/src}/executors/cargo-doc/schema.d.ts +0 -0
  217. /package/{src → dist/src}/executors/cargo-doc/schema.json +0 -0
  218. /package/{src → dist/src}/executors/cargo-doc/schema.md +0 -0
  219. /package/{src → dist/src}/executors/cargo-format/schema.d.ts +0 -0
  220. /package/{src → dist/src}/executors/cargo-format/schema.json +0 -0
  221. /package/{src → dist/src}/executors/cargo-format/schema.md +0 -0
  222. /package/{src → dist/src}/executors/cargo-publish/schema.d.ts +0 -0
  223. /package/{src → dist/src}/executors/cargo-publish/schema.json +0 -0
  224. /package/{src → dist/src}/executors/cargo-publish/schema.md +0 -0
  225. /package/{src → dist/src}/executors/clean-package/schema.d.ts +0 -0
  226. /package/{src → dist/src}/executors/clean-package/schema.json +0 -0
  227. /package/{src → dist/src}/executors/clean-package/schema.md +0 -0
  228. /package/{src → dist/src}/executors/esbuild/schema.d.ts +0 -0
  229. /package/{src → dist/src}/executors/esbuild/schema.json +0 -0
  230. /package/{src → dist/src}/executors/esbuild/schema.md +0 -0
  231. /package/{src → dist/src}/executors/npm-publish/schema.d.ts +0 -0
  232. /package/{src → dist/src}/executors/npm-publish/schema.json +0 -0
  233. /package/{src → dist/src}/executors/npm-publish/schema.md +0 -0
  234. /package/{src → dist/src}/executors/size-limit/schema.d.ts +0 -0
  235. /package/{src → dist/src}/executors/size-limit/schema.json +0 -0
  236. /package/{src → dist/src}/executors/size-limit/schema.md +0 -0
  237. /package/{src → dist/src}/executors/typia/schema.d.ts +0 -0
  238. /package/{src → dist/src}/executors/typia/schema.json +0 -0
  239. /package/{src → dist/src}/executors/typia/schema.md +0 -0
  240. /package/{src → dist/src}/executors/unbuild/schema.d.ts +0 -0
  241. /package/{src → dist/src}/executors/unbuild/schema.json +0 -0
  242. /package/{src → dist/src}/executors/unbuild/schema.md +0 -0
  243. /package/{src → dist/src}/generators/browser-library/files/README.md +0 -0
  244. /package/{src → dist/src}/generators/browser-library/files/jest.config.ts +0 -0
  245. /package/{src → dist/src}/generators/browser-library/files/src/index.ts.template +0 -0
  246. /package/{src → dist/src}/generators/browser-library/files/tsconfig.spec.json +0 -0
  247. /package/{src → dist/src}/generators/browser-library/schema.d.ts +0 -0
  248. /package/{src → dist/src}/generators/browser-library/schema.json +0 -0
  249. /package/{src → dist/src}/generators/browser-library/schema.md +0 -0
  250. /package/{src → dist/src}/generators/config-schema/schema.d.ts +0 -0
  251. /package/{src → dist/src}/generators/config-schema/schema.json +0 -0
  252. /package/{src → dist/src}/generators/config-schema/schema.md +0 -0
  253. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  254. /package/{src → dist/src}/generators/init/schema.json +0 -0
  255. /package/{src → dist/src}/generators/init/schema.md +0 -0
  256. /package/{src → dist/src}/generators/neutral-library/files/README.md +0 -0
  257. /package/{src → dist/src}/generators/neutral-library/files/jest.config.ts +0 -0
  258. /package/{src → dist/src}/generators/neutral-library/files/src/index.ts.template +0 -0
  259. /package/{src → dist/src}/generators/neutral-library/files/tsconfig.spec.json +0 -0
  260. /package/{src → dist/src}/generators/neutral-library/schema.d.ts +0 -0
  261. /package/{src → dist/src}/generators/neutral-library/schema.json +0 -0
  262. /package/{src → dist/src}/generators/neutral-library/schema.md +0 -0
  263. /package/{src → dist/src}/generators/node-library/files/README.md +0 -0
  264. /package/{src → dist/src}/generators/node-library/files/jest.config.ts +0 -0
  265. /package/{src → dist/src}/generators/node-library/files/src/index.ts.template +0 -0
  266. /package/{src → dist/src}/generators/node-library/files/tsconfig.spec.json +0 -0
  267. /package/{src → dist/src}/generators/node-library/schema.d.ts +0 -0
  268. /package/{src → dist/src}/generators/node-library/schema.json +0 -0
  269. /package/{src → dist/src}/generators/node-library/schema.md +0 -0
  270. /package/{src → dist/src}/generators/preset/files/README.md.template +0 -0
  271. /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.footer.md.template +0 -0
  272. /package/{src → dist/src}/generators/preset/files/docs/readme-templates/README.header.md.template +0 -0
  273. /package/{src → dist/src}/generators/preset/files/eslint.config.js.template +0 -0
  274. /package/{src → dist/src}/generators/preset/files/knip.json +0 -0
  275. /package/{src → dist/src}/generators/preset/files/lefthook.json +0 -0
  276. /package/{src → dist/src}/generators/preset/files/nx.json +0 -0
  277. /package/{src → dist/src}/generators/preset/files/pnpm-workspace.yaml +0 -0
  278. /package/{src → dist/src}/generators/preset/files/socket.yaml +0 -0
  279. /package/{src → dist/src}/generators/preset/files/storm.json.template +0 -0
  280. /package/{src → dist/src}/generators/preset/files/tsconfig.base.json.template +0 -0
  281. /package/{src → dist/src}/generators/preset/schema.d.ts +0 -0
  282. /package/{src → dist/src}/generators/preset/schema.json +0 -0
  283. /package/{src → dist/src}/generators/preset/schema.md +0 -0
  284. /package/{src → dist/src}/generators/release-version/schema.d.ts +0 -0
  285. /package/{src → dist/src}/generators/release-version/schema.json +0 -0
  286. /package/{src → dist/src}/generators/release-version/schema.md +0 -0
  287. /package/{src → dist/src}/plugins/typescript/untyped-schema.ts +0 -0
@@ -1,198 +0,0 @@
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 DELETED
@@ -1,130 +0,0 @@
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
- };
@@ -1,73 +0,0 @@
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
- };
@@ -1,219 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- }
@@ -1,27 +0,0 @@
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];
@@ -1,12 +0,0 @@
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";