@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.
Files changed (274) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +2 -1
  3. package/dist/chunk-A7JGVU4P.js +468 -0
  4. package/dist/chunk-SRN4D7WO.mjs +468 -0
  5. package/dist/executors.js +2 -2
  6. package/dist/executors.mjs +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/src/executors/npm-publish/executor.js +2 -2
  10. package/dist/src/executors/npm-publish/executor.mjs +1 -1
  11. package/docs/executors/rollup.md +88 -0
  12. package/executors.ts +23 -0
  13. package/generators.ts +14 -0
  14. package/index.ts +5 -0
  15. package/package.json +4 -4
  16. package/project.json +58 -0
  17. package/src/base/base-executor.ts +200 -0
  18. package/src/base/base-executor.untyped.ts +18 -0
  19. package/src/base/base-generator.ts +130 -0
  20. package/src/base/base-generator.untyped.ts +16 -0
  21. package/src/base/cargo-base-executor.untyped.ts +73 -0
  22. package/src/base/index.ts +8 -0
  23. package/src/base/typescript-build-executor.untyped.ts +153 -0
  24. package/src/base/typescript-library-generator.ts +415 -0
  25. package/src/base/typescript-library-generator.untyped.ts +106 -0
  26. package/src/executors/cargo-build/executor.spec.ts +18 -0
  27. package/src/executors/cargo-build/executor.ts +28 -0
  28. package/src/executors/cargo-build/untyped.ts +18 -0
  29. package/src/executors/cargo-check/executor.spec.ts +18 -0
  30. package/src/executors/cargo-check/executor.ts +27 -0
  31. package/src/executors/cargo-check/untyped.ts +11 -0
  32. package/src/executors/cargo-clippy/executor.spec.ts +18 -0
  33. package/src/executors/cargo-clippy/executor.ts +28 -0
  34. package/src/executors/cargo-clippy/untyped.ts +18 -0
  35. package/src/executors/cargo-doc/executor.spec.ts +18 -0
  36. package/src/executors/cargo-doc/executor.ts +39 -0
  37. package/src/executors/cargo-doc/untyped.ts +44 -0
  38. package/src/executors/cargo-format/executor.spec.ts +18 -0
  39. package/src/executors/cargo-format/executor.ts +28 -0
  40. package/src/executors/cargo-format/untyped.ts +11 -0
  41. package/src/executors/cargo-publish/executor.spec.ts +11 -0
  42. package/src/executors/cargo-publish/executor.ts +139 -0
  43. package/src/executors/cargo-publish/untyped.ts +33 -0
  44. package/src/executors/clean-package/constants.ts +99 -0
  45. package/src/executors/clean-package/executor.spec.ts +18 -0
  46. package/src/executors/clean-package/executor.ts +214 -0
  47. package/src/executors/clean-package/types.ts +6 -0
  48. package/src/executors/clean-package/untyped.ts +60 -0
  49. package/src/executors/clean-package/utils.ts +85 -0
  50. package/src/executors/esbuild/executor.spec.ts +11 -0
  51. package/src/executors/esbuild/executor.ts +67 -0
  52. package/src/executors/esbuild/untyped.ts +20 -0
  53. package/src/executors/npm-publish/executor.spec.ts +11 -0
  54. package/src/executors/npm-publish/executor.ts +681 -0
  55. package/src/executors/npm-publish/untyped.ts +56 -0
  56. package/src/executors/size-limit/executor.spec.ts +18 -0
  57. package/src/executors/size-limit/executor.ts +88 -0
  58. package/src/executors/size-limit/untyped.ts +22 -0
  59. package/src/executors/typia/executor.ts +54 -0
  60. package/src/executors/typia/untyped.ts +48 -0
  61. package/src/executors/unbuild/executor.spec.ts +11 -0
  62. package/src/executors/unbuild/executor.ts +136 -0
  63. package/src/executors/unbuild/untyped.ts +152 -0
  64. package/src/generators/browser-library/generator.spec.ts +20 -0
  65. package/src/generators/browser-library/generator.ts +109 -0
  66. package/src/generators/browser-library/untyped.ts +29 -0
  67. package/src/generators/config-schema/generator.spec.ts +20 -0
  68. package/src/generators/config-schema/generator.ts +90 -0
  69. package/src/generators/config-schema/untyped.ts +19 -0
  70. package/src/generators/init/init.ts +32 -0
  71. package/src/generators/init/untyped.ts +16 -0
  72. package/src/generators/neutral-library/generator.spec.ts +20 -0
  73. package/src/generators/neutral-library/generator.ts +81 -0
  74. package/src/generators/neutral-library/untyped.ts +29 -0
  75. package/src/generators/node-library/generator.spec.ts +20 -0
  76. package/src/generators/node-library/generator.ts +84 -0
  77. package/src/generators/node-library/untyped.ts +29 -0
  78. package/src/generators/preset/files/.all-contributorsrc.template +48 -0
  79. package/src/generators/preset/files/.editorconfig +454 -0
  80. package/src/generators/preset/files/.env.template +38 -0
  81. package/src/generators/preset/files/.gitattributes +52 -0
  82. package/src/generators/preset/files/.github/.nvmrc +1 -0
  83. package/src/generators/preset/files/.github/CODEOWNERS +3 -0
  84. package/src/generators/preset/files/.github/CODE_OF_CONDUCT.md +125 -0
  85. package/src/generators/preset/files/.github/CONTRIBUTING.md.template +15 -0
  86. package/src/generators/preset/files/.github/FUNDING.yml +3 -0
  87. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/bug-report.yml.template +102 -0
  88. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/documentation.yml.template +56 -0
  89. package/src/generators/preset/files/.github/ISSUE_TEMPLATE/feature-request.yml.template +60 -0
  90. package/src/generators/preset/files/.github/PULL_REQUEST_TEMPLATE.md.template +39 -0
  91. package/src/generators/preset/files/.github/SECURITY.md +9 -0
  92. package/src/generators/preset/files/.github/codecov.yml +29 -0
  93. package/src/generators/preset/files/.github/dependabot.yml +64 -0
  94. package/src/generators/preset/files/.github/labels.yml +84 -0
  95. package/src/generators/preset/files/.github/renovate.json +4 -0
  96. package/src/generators/preset/files/.github/renovate.json.template +63 -0
  97. package/src/generators/preset/files/.github/stale.yml +55 -0
  98. package/src/generators/preset/files/.github/workflows/build-release.yml.template +25 -0
  99. package/src/generators/preset/files/.github/workflows/code-review.yml +18 -0
  100. package/src/generators/preset/files/.github/workflows/codeql.yml +84 -0
  101. package/src/generators/preset/files/.github/workflows/dependabot-update.yml +32 -0
  102. package/src/generators/preset/files/.github/workflows/git-guardian.yml +23 -0
  103. package/src/generators/preset/files/.github/workflows/greetings.yml +31 -0
  104. package/src/generators/preset/files/.github/workflows/labels.yml +31 -0
  105. package/src/generators/preset/files/.github/workflows/lock.yml +26 -0
  106. package/src/generators/preset/files/.log4brains.yml.template +5 -0
  107. package/src/generators/preset/files/.markdownlint.json +155 -0
  108. package/src/generators/preset/files/.verdaccio/config.yml.template +40 -0
  109. package/src/generators/preset/files/.vscode/README.md +32 -0
  110. package/src/generators/preset/files/.vscode/cspell.json +3 -0
  111. package/src/generators/preset/files/.vscode/extensions.json +14 -0
  112. package/src/generators/preset/files/.vscode/launch.json +37 -0
  113. package/src/generators/preset/files/.vscode/settings.json +401 -0
  114. package/src/generators/preset/files/.vscode/tasks.json +4 -0
  115. package/src/generators/preset/files/.whitesource +14 -0
  116. package/src/generators/preset/files/assets/diagrams/.gitkeep +0 -0
  117. package/src/generators/preset/files/assets/icons/dark/.gitkeep +0 -0
  118. package/src/generators/preset/files/assets/icons/light/.gitkeep +0 -0
  119. package/src/generators/preset/files/assets/logos/.gitkeep +0 -0
  120. package/src/generators/preset/files/docs/api-reference/.gitkeep +0 -0
  121. package/src/generators/preset/generator.spec.ts +20 -0
  122. package/src/generators/preset/generator.ts +315 -0
  123. package/src/generators/preset/untyped.ts +88 -0
  124. package/src/generators/release-version/generator.spec.ts +20 -0
  125. package/src/generators/release-version/generator.ts +920 -0
  126. package/src/generators/release-version/untyped.ts +156 -0
  127. package/src/plugins/rust/cargo-toml.ts +434 -0
  128. package/src/plugins/rust/index.ts +1 -0
  129. package/src/plugins/typescript/index.ts +1 -0
  130. package/src/plugins/typescript/project-config.ts +564 -0
  131. package/src/plugins/typescript/tsup.ts +198 -0
  132. package/src/types.ts +130 -0
  133. package/src/utils/apply-workspace-tokens.ts +73 -0
  134. package/src/utils/cargo.ts +219 -0
  135. package/src/utils/create-cli-options.ts +23 -0
  136. package/src/utils/get-project-configurations.ts +27 -0
  137. package/src/utils/index.ts +12 -0
  138. package/src/utils/lock-file.ts +159 -0
  139. package/src/utils/package-helpers.ts +54 -0
  140. package/src/utils/plugin-helpers.ts +112 -0
  141. package/src/utils/pnpm-deps-update.ts +111 -0
  142. package/src/utils/project-tags.ts +162 -0
  143. package/src/utils/toml.ts +204 -0
  144. package/src/utils/typia-transform.ts +8 -0
  145. package/src/utils/versions.ts +19 -0
  146. package/tsconfig.json +30 -0
  147. package/tsup.config.ts +36 -0
  148. package/dist/chunk-62LQXZNY.js +0 -282
  149. package/dist/chunk-F3VG4R53.mjs +0 -282
  150. package/dist/src/generators/preset/files/LICENSE +0 -201
  151. package/docs/api/base/base-executor.schema.md +0 -16
  152. package/docs/api/base/base-generator.schema.md +0 -15
  153. package/docs/api/base/cargo-base-executor.schema.md +0 -90
  154. package/docs/api/base/typescript-build-executor.schema.md +0 -126
  155. package/docs/api/base/typescript-library-generator.schema.md +0 -129
  156. package/docs/api/executors/cargo-build/schema.md +0 -89
  157. package/docs/api/executors/cargo-check/schema.md +0 -90
  158. package/docs/api/executors/cargo-clippy/schema.md +0 -99
  159. package/docs/api/executors/cargo-doc/schema.md +0 -130
  160. package/docs/api/executors/cargo-format/schema.md +0 -90
  161. package/docs/api/executors/cargo-publish/schema.md +0 -117
  162. package/docs/api/executors/clean-package/schema.md +0 -65
  163. package/docs/api/executors/esbuild/schema.md +0 -126
  164. package/docs/api/executors/npm-publish/schema.md +0 -64
  165. package/docs/api/executors/size-limit/schema.md +0 -25
  166. package/docs/api/executors/typia/schema.md +0 -46
  167. package/docs/api/executors/unbuild/schema.md +0 -222
  168. package/docs/api/generators/browser-library/files/README.md +0 -58
  169. package/docs/api/generators/browser-library/schema.md +0 -129
  170. package/docs/api/generators/config-schema/schema.md +0 -25
  171. package/docs/api/generators/init/schema.md +0 -15
  172. package/docs/api/generators/neutral-library/files/README.md +0 -58
  173. package/docs/api/generators/neutral-library/schema.md +0 -129
  174. package/docs/api/generators/node-library/files/README.md +0 -63
  175. package/docs/api/generators/node-library/schema.md +0 -129
  176. package/docs/api/generators/preset/schema.md +0 -110
  177. package/docs/api/generators/release-version/schema.md +0 -160
  178. /package/{dist/src → src}/base/base-executor.schema.d.ts +0 -0
  179. /package/{dist/src → src}/base/base-executor.schema.json +0 -0
  180. /package/{dist/src → src}/base/base-executor.schema.md +0 -0
  181. /package/{dist/src → src}/base/base-generator.schema.d.ts +0 -0
  182. /package/{dist/src → src}/base/base-generator.schema.json +0 -0
  183. /package/{dist/src → src}/base/base-generator.schema.md +0 -0
  184. /package/{dist/src → src}/base/cargo-base-executor.schema.d.ts +0 -0
  185. /package/{dist/src → src}/base/cargo-base-executor.schema.json +0 -0
  186. /package/{dist/src → src}/base/cargo-base-executor.schema.md +0 -0
  187. /package/{dist/src → src}/base/typescript-build-executor.schema.d.ts +0 -0
  188. /package/{dist/src → src}/base/typescript-build-executor.schema.json +0 -0
  189. /package/{dist/src → src}/base/typescript-build-executor.schema.md +0 -0
  190. /package/{dist/src → src}/base/typescript-library-generator.schema.d.ts +0 -0
  191. /package/{dist/src → src}/base/typescript-library-generator.schema.json +0 -0
  192. /package/{dist/src → src}/base/typescript-library-generator.schema.md +0 -0
  193. /package/{dist/src → src}/executors/cargo-build/schema.d.ts +0 -0
  194. /package/{dist/src → src}/executors/cargo-build/schema.json +0 -0
  195. /package/{dist/src → src}/executors/cargo-build/schema.md +0 -0
  196. /package/{dist/src → src}/executors/cargo-check/schema.d.ts +0 -0
  197. /package/{dist/src → src}/executors/cargo-check/schema.json +0 -0
  198. /package/{dist/src → src}/executors/cargo-check/schema.md +0 -0
  199. /package/{dist/src → src}/executors/cargo-clippy/schema.d.ts +0 -0
  200. /package/{dist/src → src}/executors/cargo-clippy/schema.json +0 -0
  201. /package/{dist/src → src}/executors/cargo-clippy/schema.md +0 -0
  202. /package/{dist/src → src}/executors/cargo-doc/schema.d.ts +0 -0
  203. /package/{dist/src → src}/executors/cargo-doc/schema.json +0 -0
  204. /package/{dist/src → src}/executors/cargo-doc/schema.md +0 -0
  205. /package/{dist/src → src}/executors/cargo-format/schema.d.ts +0 -0
  206. /package/{dist/src → src}/executors/cargo-format/schema.json +0 -0
  207. /package/{dist/src → src}/executors/cargo-format/schema.md +0 -0
  208. /package/{dist/src → src}/executors/cargo-publish/schema.d.ts +0 -0
  209. /package/{dist/src → src}/executors/cargo-publish/schema.json +0 -0
  210. /package/{dist/src → src}/executors/cargo-publish/schema.md +0 -0
  211. /package/{dist/src → src}/executors/clean-package/schema.d.ts +0 -0
  212. /package/{dist/src → src}/executors/clean-package/schema.json +0 -0
  213. /package/{dist/src → src}/executors/clean-package/schema.md +0 -0
  214. /package/{dist/src → src}/executors/esbuild/schema.d.ts +0 -0
  215. /package/{dist/src → src}/executors/esbuild/schema.json +0 -0
  216. /package/{dist/src → src}/executors/esbuild/schema.md +0 -0
  217. /package/{dist/src → src}/executors/npm-publish/schema.d.ts +0 -0
  218. /package/{dist/src → src}/executors/npm-publish/schema.json +0 -0
  219. /package/{dist/src → src}/executors/npm-publish/schema.md +0 -0
  220. /package/{dist/src → src}/executors/size-limit/schema.d.ts +0 -0
  221. /package/{dist/src → src}/executors/size-limit/schema.json +0 -0
  222. /package/{dist/src → src}/executors/size-limit/schema.md +0 -0
  223. /package/{dist/src → src}/executors/typia/schema.d.ts +0 -0
  224. /package/{dist/src → src}/executors/typia/schema.json +0 -0
  225. /package/{dist/src → src}/executors/typia/schema.md +0 -0
  226. /package/{dist/src → src}/executors/unbuild/schema.d.ts +0 -0
  227. /package/{dist/src → src}/executors/unbuild/schema.json +0 -0
  228. /package/{dist/src → src}/executors/unbuild/schema.md +0 -0
  229. /package/{dist/src → src}/generators/browser-library/files/README.md +0 -0
  230. /package/{dist/src → src}/generators/browser-library/files/jest.config.ts +0 -0
  231. /package/{dist/src → src}/generators/browser-library/files/src/index.ts.template +0 -0
  232. /package/{dist/src → src}/generators/browser-library/files/tsconfig.spec.json +0 -0
  233. /package/{dist/src → src}/generators/browser-library/schema.d.ts +0 -0
  234. /package/{dist/src → src}/generators/browser-library/schema.json +0 -0
  235. /package/{dist/src → src}/generators/browser-library/schema.md +0 -0
  236. /package/{dist/src → src}/generators/config-schema/schema.d.ts +0 -0
  237. /package/{dist/src → src}/generators/config-schema/schema.json +0 -0
  238. /package/{dist/src → src}/generators/config-schema/schema.md +0 -0
  239. /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
  240. /package/{dist/src → src}/generators/init/schema.json +0 -0
  241. /package/{dist/src → src}/generators/init/schema.md +0 -0
  242. /package/{dist/src → src}/generators/neutral-library/files/README.md +0 -0
  243. /package/{dist/src → src}/generators/neutral-library/files/jest.config.ts +0 -0
  244. /package/{dist/src → src}/generators/neutral-library/files/src/index.ts.template +0 -0
  245. /package/{dist/src → src}/generators/neutral-library/files/tsconfig.spec.json +0 -0
  246. /package/{dist/src → src}/generators/neutral-library/schema.d.ts +0 -0
  247. /package/{dist/src → src}/generators/neutral-library/schema.json +0 -0
  248. /package/{dist/src → src}/generators/neutral-library/schema.md +0 -0
  249. /package/{dist/src → src}/generators/node-library/files/README.md +0 -0
  250. /package/{dist/src → src}/generators/node-library/files/jest.config.ts +0 -0
  251. /package/{dist/src → src}/generators/node-library/files/src/index.ts.template +0 -0
  252. /package/{dist/src → src}/generators/node-library/files/tsconfig.spec.json +0 -0
  253. /package/{dist/src → src}/generators/node-library/schema.d.ts +0 -0
  254. /package/{dist/src → src}/generators/node-library/schema.json +0 -0
  255. /package/{dist/src → src}/generators/node-library/schema.md +0 -0
  256. /package/{LICENSE → src/generators/preset/files/LICENSE} +0 -0
  257. /package/{dist/src → src}/generators/preset/files/README.md.template +0 -0
  258. /package/{dist/src → src}/generators/preset/files/docs/readme-templates/README.footer.md.template +0 -0
  259. /package/{dist/src → src}/generators/preset/files/docs/readme-templates/README.header.md.template +0 -0
  260. /package/{dist/src → src}/generators/preset/files/eslint.config.js.template +0 -0
  261. /package/{dist/src → src}/generators/preset/files/knip.json +0 -0
  262. /package/{dist/src → src}/generators/preset/files/lefthook.json +0 -0
  263. /package/{dist/src → src}/generators/preset/files/nx.json +0 -0
  264. /package/{dist/src → src}/generators/preset/files/pnpm-workspace.yaml +0 -0
  265. /package/{dist/src → src}/generators/preset/files/socket.yaml +0 -0
  266. /package/{dist/src → src}/generators/preset/files/storm.json.template +0 -0
  267. /package/{dist/src → src}/generators/preset/files/tsconfig.base.json.template +0 -0
  268. /package/{dist/src → src}/generators/preset/schema.d.ts +0 -0
  269. /package/{dist/src → src}/generators/preset/schema.json +0 -0
  270. /package/{dist/src → src}/generators/preset/schema.md +0 -0
  271. /package/{dist/src → src}/generators/release-version/schema.d.ts +0 -0
  272. /package/{dist/src → src}/generators/release-version/schema.json +0 -0
  273. /package/{dist/src → src}/generators/release-version/schema.md +0 -0
  274. /package/{dist/src → src}/plugins/typescript/untyped-schema.ts +0 -0
package/generators.ts ADDED
@@ -0,0 +1,14 @@
1
+ export * from "./src/generators/browser-library/generator";
2
+ export { type BrowserLibraryGeneratorSchema } from "./src/generators/browser-library/schema.d";
3
+ export * from "./src/generators/config-schema/generator";
4
+ export { type ConfigSchemaGeneratorSchema } from "./src/generators/config-schema/schema.d";
5
+ export * from "./src/generators/init/init";
6
+ export { type InitGeneratorSchema } from "./src/generators/init/schema.d";
7
+ export * from "./src/generators/neutral-library/generator";
8
+ export { type NeutralLibraryGeneratorSchema } from "./src/generators/neutral-library/schema.d";
9
+ export * from "./src/generators/node-library/generator";
10
+ export { type NodeLibraryGeneratorSchema } from "./src/generators/node-library/schema.d";
11
+ export * from "./src/generators/preset/generator";
12
+ export { type PresetGeneratorSchema } from "./src/generators/preset/schema.d";
13
+ export * from "./src/generators/release-version/generator";
14
+ export { type ReleaseVersionGeneratorSchema } from "./src/generators/release-version/schema.d";
package/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./executors";
2
+ export * from "./generators";
3
+ export * from "./src/base";
4
+ export * from "./src/types";
5
+ export * from "./src/utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.269.0",
3
+ "version": "1.270.0",
4
4
  "description": "Tools for managing a Storm workspace, including various Nx generators and executors for common development tasks.",
5
5
  "repository": {
6
6
  "type": "github",
@@ -226,9 +226,9 @@
226
226
  "@size-limit/esbuild": "11.1.4",
227
227
  "@size-limit/esbuild-why": "11.1.4",
228
228
  "@size-limit/file": "11.1.4",
229
- "@storm-software/esbuild": "0.37.0",
230
- "@storm-software/prettier": "0.47.0",
231
- "@storm-software/unbuild": "0.43.0",
229
+ "@storm-software/esbuild": "0.38.0",
230
+ "@storm-software/prettier": "0.48.0",
231
+ "@storm-software/unbuild": "0.44.0",
232
232
  "fs-extra": "11.2.0",
233
233
  "glob": "^11.0.1",
234
234
  "jiti": "^2.4.2",
package/project.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "workspace-tools",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/workspace-tools/src",
5
+ "projectType": "library",
6
+ "implicitDependencies": ["untyped", "unbuild", "esbuild"],
7
+ "targets": {
8
+ "build-untyped": {
9
+ "executor": "nx:run-commands",
10
+ "dependsOn": ["clean", "^build"],
11
+ "inputs": [
12
+ "{projectRoot}/src/**/untyped.ts",
13
+ "{projectRoot}/src/**/*.untyped.ts"
14
+ ],
15
+ "outputs": [
16
+ "{projectRoot}/src/**/schema.d.ts",
17
+ "{projectRoot}/src/**/*.schema.d.ts",
18
+ "{projectRoot}/src/**/schema.md",
19
+ "{projectRoot}/src/**/*.schema.md",
20
+ "{projectRoot}/src/**/schema.json",
21
+ "{projectRoot}/src/**/*.schema.json"
22
+ ],
23
+ "options": {
24
+ "commands": [
25
+ "node dist/packages/untyped/bin/untyped.cjs generate --entry=\"packages/workspace-tools/**/{untyped.ts,*.untyped.ts}\" "
26
+ ]
27
+ }
28
+ },
29
+ "build-base": {
30
+ "executor": "nx:run-commands",
31
+ "dependsOn": ["clean", "build-untyped", "^build"],
32
+ "options": {
33
+ "command": "tsup-node --config=tsup.config.ts",
34
+ "cwd": "{projectRoot}"
35
+ }
36
+ },
37
+ "build": {
38
+ "executor": "nx:run-commands",
39
+ "dependsOn": ["build-base", "build-untyped"],
40
+ "options": {
41
+ "commands": [
42
+ "pnpm copyfiles LICENSE dist/packages/workspace-tools",
43
+ "pnpm copyfiles --up=2 ./packages/workspace-tools/*.md ./packages/workspace-tools/executors.json ./packages/workspace-tools/generators.json ./packages/workspace-tools/package.json dist/packages/workspace-tools",
44
+ "pnpm copyfiles --up=3 ./packages/workspace-tools/assets/* dist/packages/workspace-tools/assets",
45
+ "pnpm copyfiles --up=3 ./packages/workspace-tools/config/* dist/packages/workspace-tools/config",
46
+ "pnpm copyfiles --up=3 ./packages/workspace-tools/docs/* dist/packages/workspace-tools/docs",
47
+ "pnpm copyfiles --up=3 \"./packages/workspace-tools/src/**/*schema.*\" dist/packages/workspace-tools/dist/src",
48
+ "pnpm copyfiles --up=3 \"./packages/workspace-tools/src/**/*.md\" dist/packages/workspace-tools/docs/api",
49
+ "pnpm copyfiles --up=4 \"./packages/workspace-tools/src/generators/*/files/**/*\" dist/packages/workspace-tools/dist/src/generators",
50
+ "pnpm copyfiles --up=3 \"./packages/workspace-tools/dist/**/*\" dist/packages/workspace-tools/dist"
51
+ ]
52
+ }
53
+ },
54
+ "nx-release-publish": {
55
+ "executor": "@storm-software/workspace-tools:npm-publish"
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,200 @@
1
+ import type { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
+ import type { StormWorkspaceConfig } from "@storm-software/config";
3
+ import {
4
+ applyWorkspaceProjectTokens,
5
+ applyWorkspaceTokens,
6
+ findWorkspaceRoot,
7
+ formatLogMessage,
8
+ getConfig,
9
+ getStopwatch,
10
+ ProjectTokenizerOptions,
11
+ writeDebug,
12
+ writeError,
13
+ writeFatal,
14
+ writeInfo,
15
+ writeSuccess,
16
+ writeTrace
17
+ } from "@storm-software/config-tools";
18
+ import { defu } from "defu";
19
+ import { BaseExecutorOptions, BaseExecutorResult } from "../types";
20
+ import { BaseExecutorSchema } from "./base-executor.schema.d";
21
+
22
+ export const withRunExecutor =
23
+ <TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(
24
+ name: string,
25
+ executorFn: (
26
+ options: TExecutorSchema,
27
+ context: ExecutorContext,
28
+ config: StormWorkspaceConfig
29
+ ) =>
30
+ | Promise<BaseExecutorResult | null | undefined>
31
+ | AsyncGenerator<any, BaseExecutorResult | null | undefined>
32
+ | BaseExecutorResult
33
+ | null
34
+ | undefined,
35
+ executorOptions: BaseExecutorOptions<TExecutorSchema> = {}
36
+ ): PromiseExecutor<TExecutorSchema> =>
37
+ async (
38
+ _options: TExecutorSchema,
39
+ context: ExecutorContext
40
+ ): Promise<{ success: boolean }> => {
41
+ const stopwatch = getStopwatch(name);
42
+ let options = _options;
43
+
44
+ let config = {} as StormWorkspaceConfig;
45
+ try {
46
+ if (
47
+ !context.projectsConfigurations?.projects ||
48
+ !context.projectName ||
49
+ !context.projectsConfigurations.projects[context.projectName]
50
+ ) {
51
+ throw new Error(
52
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
53
+ );
54
+ }
55
+
56
+ const workspaceRoot = findWorkspaceRoot();
57
+ const projectRoot =
58
+ context.projectsConfigurations.projects[context.projectName]!.root ||
59
+ workspaceRoot;
60
+ const sourceRoot =
61
+ context.projectsConfigurations.projects[context.projectName]!
62
+ .sourceRoot ||
63
+ projectRoot ||
64
+ workspaceRoot;
65
+ const projectName = context.projectName;
66
+ config.workspaceRoot = workspaceRoot;
67
+
68
+ writeInfo(`⚡ Running the ${name} executor for ${projectName} `, config);
69
+
70
+ if (!executorOptions.skipReadingConfig) {
71
+ writeTrace(
72
+ `Loading the Storm Config from environment variables and storm.config.js file...
73
+ - workspaceRoot: ${workspaceRoot}
74
+ - projectRoot: ${projectRoot}
75
+ - sourceRoot: ${sourceRoot}
76
+ - projectName: ${projectName}\n`,
77
+ config
78
+ );
79
+
80
+ config = await getConfig(workspaceRoot);
81
+ }
82
+
83
+ if (executorOptions?.hooks?.applyDefaultOptions) {
84
+ writeDebug("Running the applyDefaultOptions hook...", config);
85
+ options = await Promise.resolve(
86
+ executorOptions.hooks.applyDefaultOptions(options, config)
87
+ );
88
+ writeDebug("Completed the applyDefaultOptions hook", config);
89
+ }
90
+
91
+ writeTrace(
92
+ `Executor schema options ⚙️
93
+ ${formatLogMessage(options)}
94
+ `,
95
+ config
96
+ );
97
+
98
+ const tokenized = (await applyWorkspaceTokens<ProjectTokenizerOptions>(
99
+ options,
100
+ defu(
101
+ { workspaceRoot, projectRoot, sourceRoot, projectName, config },
102
+ config,
103
+ context.projectsConfigurations.projects[context.projectName]
104
+ ),
105
+ applyWorkspaceProjectTokens
106
+ )) as TExecutorSchema;
107
+
108
+ writeTrace(
109
+ `Executor schema tokenized options ⚙️
110
+ ${formatLogMessage(tokenized)}
111
+ `,
112
+ config
113
+ );
114
+
115
+ if (executorOptions?.hooks?.preProcess) {
116
+ writeDebug("Running the preProcess hook...", config);
117
+ await Promise.resolve(
118
+ executorOptions.hooks.preProcess(tokenized, config)
119
+ );
120
+ writeDebug("Completed the preProcess hook", config);
121
+ }
122
+
123
+ const ret = executorFn(tokenized, context, config);
124
+ if (_isFunction((ret as AsyncGenerator)?.next)) {
125
+ const asyncGen = ret as AsyncGenerator;
126
+ for await (const iter of asyncGen) {
127
+ void iter;
128
+ }
129
+ }
130
+
131
+ const result = await Promise.resolve(
132
+ ret as
133
+ | Promise<BaseExecutorResult | null | undefined>
134
+ | BaseExecutorResult
135
+ | null
136
+ | undefined
137
+ );
138
+ if (
139
+ result &&
140
+ (!result.success ||
141
+ (result.error &&
142
+ (result?.error as Error)?.message &&
143
+ typeof (result?.error as Error)?.message === "string" &&
144
+ (result?.error as Error)?.name &&
145
+ typeof (result?.error as Error)?.name === "string"))
146
+ ) {
147
+ writeTrace(
148
+ `Failure determined by the ${name} executor \n${formatLogMessage(result)}`,
149
+ config
150
+ );
151
+ console.error(result);
152
+
153
+ throw new Error(`The ${name} executor failed to run`, {
154
+ cause: result?.error
155
+ });
156
+ }
157
+
158
+ if (executorOptions?.hooks?.postProcess) {
159
+ writeDebug("Running the postProcess hook...", config);
160
+ await Promise.resolve(executorOptions.hooks.postProcess(config));
161
+ writeDebug("Completed the postProcess hook", config);
162
+ }
163
+
164
+ writeSuccess(`Completed running the ${name} task executor!\n`, config);
165
+
166
+ return {
167
+ success: true
168
+ };
169
+ } catch (error) {
170
+ writeFatal(
171
+ "A fatal error occurred while running the executor - the process was forced to terminate",
172
+ config
173
+ );
174
+ writeError(
175
+ `An exception was thrown in the executor's process \n - Details: ${error.message}\n - Stacktrace: ${error.stack}`,
176
+ config
177
+ );
178
+
179
+ return {
180
+ success: false
181
+ };
182
+ } finally {
183
+ stopwatch();
184
+ }
185
+ };
186
+
187
+ const _isFunction = (
188
+ value: unknown
189
+ ): value is ((params?: unknown) => unknown) & ((param?: any) => any) => {
190
+ try {
191
+ return (
192
+ value instanceof Function ||
193
+ typeof value === "function" ||
194
+ !!(value?.constructor && (value as any)?.call && (value as any)?.apply)
195
+ );
196
+ // biome-ignore lint/correctness/noUnusedVariables: <explanation>
197
+ } catch (e) {
198
+ return false;
199
+ }
200
+ };
@@ -0,0 +1,18 @@
1
+ import { defineUntypedSchema } from "untyped";
2
+
3
+ export default defineUntypedSchema({
4
+ $schema: {
5
+ id: "baseExecutor",
6
+ title: "Base Executor",
7
+ description: "A base type definition for an executor schema",
8
+ },
9
+ outputPath: {
10
+ $schema: {
11
+ title: "Output Path",
12
+ type: "string",
13
+ format: "path",
14
+ description: "The output path for the build",
15
+ },
16
+ $default: "dist/{projectRoot}",
17
+ },
18
+ });
@@ -0,0 +1,130 @@
1
+ import type { GeneratorCallback, Tree } from "@nx/devkit";
2
+ import type { StormWorkspaceConfig } from "@storm-software/config";
3
+ import {
4
+ applyWorkspaceBaseTokens,
5
+ applyWorkspaceTokens,
6
+ findWorkspaceRoot,
7
+ getConfig,
8
+ getStopwatch,
9
+ writeDebug,
10
+ writeError,
11
+ writeFatal,
12
+ writeInfo,
13
+ writeSuccess,
14
+ writeTrace
15
+ } from "@storm-software/config-tools";
16
+ import type { BaseGeneratorOptions, BaseGeneratorResult } from "../types";
17
+ import type { BaseGeneratorSchema } from "./base-generator.schema.d";
18
+
19
+ export const withRunGenerator =
20
+ <TGeneratorSchema extends BaseGeneratorSchema = BaseGeneratorSchema>(
21
+ name: string,
22
+ generatorFn: (
23
+ tree: Tree,
24
+ options: TGeneratorSchema,
25
+ config?: StormWorkspaceConfig
26
+ ) =>
27
+ | Promise<BaseGeneratorResult | null | undefined>
28
+ | BaseGeneratorResult
29
+ | null
30
+ | undefined,
31
+ generatorOptions: BaseGeneratorOptions<TGeneratorSchema> = {
32
+ skipReadingConfig: false
33
+ }
34
+ ) =>
35
+ async (
36
+ tree: Tree,
37
+ _options: TGeneratorSchema
38
+ ): Promise<GeneratorCallback | BaseGeneratorResult> => {
39
+ const stopwatch = getStopwatch(name);
40
+ let options = _options;
41
+
42
+ let config: StormWorkspaceConfig | undefined;
43
+ try {
44
+ writeInfo(`⚡ Running the ${name} generator...\n\n`, config);
45
+
46
+ const workspaceRoot = findWorkspaceRoot();
47
+ if (!generatorOptions.skipReadingConfig) {
48
+ writeDebug(
49
+ `Loading the Storm Config from environment variables and storm.config.js file...
50
+ - workspaceRoot: ${workspaceRoot}`,
51
+ config
52
+ );
53
+
54
+ config = await getConfig(workspaceRoot);
55
+ }
56
+
57
+ if (generatorOptions?.hooks?.applyDefaultOptions) {
58
+ writeDebug("Running the applyDefaultOptions hook...", config);
59
+ options = await Promise.resolve(
60
+ generatorOptions.hooks.applyDefaultOptions(options, config)
61
+ );
62
+ writeDebug("Completed the applyDefaultOptions hook", config);
63
+ }
64
+
65
+ writeTrace(
66
+ `Generator schema options ⚙️ \n${Object.keys(options ?? {})
67
+ .map(key => ` - ${key}=${JSON.stringify(options[key])}`)
68
+ .join("\n")}`,
69
+ config
70
+ );
71
+
72
+ const tokenized = (await applyWorkspaceTokens(
73
+ options as Record<string, any>,
74
+ { workspaceRoot: tree.root, config },
75
+ applyWorkspaceBaseTokens
76
+ )) as TGeneratorSchema;
77
+
78
+ if (generatorOptions?.hooks?.preProcess) {
79
+ writeDebug("Running the preProcess hook...", config);
80
+ await Promise.resolve(
81
+ generatorOptions.hooks.preProcess(tokenized, config)
82
+ );
83
+ writeDebug("Completed the preProcess hook", config);
84
+ }
85
+
86
+ // Run the generator function
87
+ const result = await Promise.resolve(
88
+ generatorFn(tree, tokenized, config)
89
+ );
90
+ if (result) {
91
+ if (
92
+ result.success === false ||
93
+ (result.error &&
94
+ (result?.error as Error)?.message &&
95
+ typeof (result?.error as Error)?.message === "string" &&
96
+ (result?.error as Error)?.name &&
97
+ typeof (result?.error as Error)?.name === "string")
98
+ ) {
99
+ throw new Error(`The ${name} generator failed to run`, {
100
+ cause: result?.error
101
+ });
102
+ } else if (result.success && result.data) {
103
+ return result as any;
104
+ }
105
+ }
106
+
107
+ if (generatorOptions?.hooks?.postProcess) {
108
+ writeDebug("Running the postProcess hook...", config);
109
+ await Promise.resolve(generatorOptions.hooks.postProcess(config));
110
+ writeDebug("Completed the postProcess hook", config);
111
+ }
112
+
113
+ return () => {
114
+ writeSuccess(`Completed running the ${name} generator!\n`, config);
115
+ };
116
+ } catch (error) {
117
+ return () => {
118
+ writeFatal(
119
+ "A fatal error occurred while running the generator - the process was forced to terminate",
120
+ config
121
+ );
122
+ writeError(
123
+ `An exception was thrown in the generator's process \n - Details: ${error.message}\n - Stacktrace: ${error.stack}`,
124
+ config
125
+ );
126
+ };
127
+ } finally {
128
+ stopwatch();
129
+ }
130
+ };
@@ -0,0 +1,16 @@
1
+ import { defineUntypedSchema } from "untyped";
2
+
3
+ export default defineUntypedSchema({
4
+ $schema: {
5
+ id: "BaseGeneratorSchema",
6
+ title: "Base Generator",
7
+ description: "A type definition for the base Generator schema",
8
+ },
9
+ directory: {
10
+ $schema: {
11
+ title: "Directory",
12
+ type: "string",
13
+ description: "The directory to create the library in",
14
+ },
15
+ },
16
+ });
@@ -0,0 +1,73 @@
1
+ import { defineUntypedSchema } from "untyped";
2
+ import baseExecutorSchema from "./base-executor.untyped";
3
+
4
+ export default defineUntypedSchema({
5
+ ...baseExecutorSchema,
6
+ $schema: {
7
+ id: "cargoBaseExecutor",
8
+ title: "Cargo Base Executor",
9
+ description:
10
+ "A base type definition for a Cargo/rust related executor schema",
11
+ },
12
+ package: {
13
+ $schema: {
14
+ title: "Cargo.toml Path",
15
+ type: "string",
16
+ format: "path",
17
+ description: "The path to the Cargo.toml file",
18
+ },
19
+ $default: "{projectRoot}/Cargo.toml",
20
+ },
21
+ toolchain: {
22
+ $schema: {
23
+ title: "Toolchain",
24
+ description: "The type of toolchain to use for the build",
25
+ enum: ["stable", "beta", "nightly"],
26
+ default: "stable",
27
+ },
28
+ $default: "stable",
29
+ },
30
+ target: {
31
+ $schema: {
32
+ title: "Target",
33
+ type: "string",
34
+ description: "The target to build",
35
+ },
36
+ },
37
+ allTargets: {
38
+ $schema: {
39
+ title: "All Targets",
40
+ type: "boolean",
41
+ description: "Build all targets",
42
+ },
43
+ },
44
+ profile: {
45
+ $schema: {
46
+ title: "Profile",
47
+ type: "string",
48
+ description: "The profile to build",
49
+ },
50
+ },
51
+ release: {
52
+ $schema: {
53
+ title: "Release",
54
+ type: "boolean",
55
+ description: "Build in release mode",
56
+ },
57
+ },
58
+ features: {
59
+ $schema: {
60
+ title: "Features",
61
+ type: "string",
62
+ description: "The features to build",
63
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
64
+ },
65
+ },
66
+ allFeatures: {
67
+ $schema: {
68
+ title: "All Features",
69
+ type: "boolean",
70
+ description: "Build all features",
71
+ },
72
+ },
73
+ });
@@ -0,0 +1,8 @@
1
+ export * from "./base-executor";
2
+ export { default as baseExecutorSchema } from "./base-executor.untyped";
3
+ export * from "./base-generator";
4
+ export { default as baseGeneratorSchema } from "./base-generator.untyped";
5
+ export { default as cargoBaseExecutorSchema } from "./cargo-base-executor.untyped";
6
+ export { default as typescriptBuildExecutorSchema } from "./typescript-build-executor.untyped";
7
+ export * from "./typescript-library-generator";
8
+ export { default as typescriptLibraryGeneratorSchema } from "./typescript-library-generator.untyped";