@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,415 +0,0 @@
1
- import {
2
- type GeneratorCallback,
3
- type ProjectConfiguration,
4
- type Tree,
5
- addDependenciesToPackageJson,
6
- addProjectConfiguration,
7
- ensurePackage,
8
- formatFiles,
9
- names,
10
- offsetFromRoot,
11
- readJson,
12
- updateJson,
13
- writeJson
14
- } from "@nx/devkit";
15
- import { determineProjectNameAndRootOptions } from "@nx/devkit/src/generators/project-name-and-root-utils";
16
- import {
17
- addTsConfigPath,
18
- getRelativePathToRootTsConfig,
19
- tsConfigBaseOptions
20
- } from "@nx/js";
21
- import jsInitGenerator from "@nx/js/src/generators/init/init";
22
- import { InitSchema } from "@nx/js/src/generators/init/schema";
23
- import {
24
- Bundler,
25
- NormalizedLibraryGeneratorOptions
26
- } from "@nx/js/src/generators/library/schema";
27
- import setupVerdaccio from "@nx/js/src/generators/setup-verdaccio/generator";
28
- import { ProjectPackageManagerWorkspaceState } from "@nx/js/src/utils/package-manager-workspaces";
29
- import { StormWorkspaceConfig } from "@storm-software/config";
30
- import { joinPaths } from "@storm-software/config-tools/utilities/correct-paths";
31
- import type { PackageJson } from "nx/src/utils/package-json";
32
- import { UnbuildExecutorSchema } from "../executors/unbuild/schema.d";
33
- import { addProjectTag, ProjectTagConstants } from "../utils/project-tags";
34
- import { nxVersion } from "../utils/versions";
35
- import { TypeScriptLibraryGeneratorSchema } from "./typescript-library-generator.schema.d";
36
-
37
- export type TypeScriptLibraryGeneratorOptions =
38
- TypeScriptLibraryGeneratorSchema & {
39
- devDependencies?: Record<string, string>;
40
- peerDependencies?: Record<string, string>;
41
- peerDependenciesMeta?: Record<string, any>;
42
- tsconfigOptions?: Record<string, any>;
43
- };
44
-
45
- export type TypeScriptLibraryGeneratorNormalizedOptions =
46
- TypeScriptLibraryGeneratorOptions &
47
- NormalizedLibraryGeneratorOptions & {
48
- rootProject: boolean;
49
- };
50
-
51
- type TypeScriptLibraryProjectConfig = ProjectConfiguration & {
52
- targets: {
53
- build: { options: Partial<UnbuildExecutorSchema> };
54
- } & Record<string, any>;
55
- };
56
-
57
- export async function typeScriptLibraryGeneratorFn(
58
- tree: Tree,
59
- options: TypeScriptLibraryGeneratorOptions,
60
- config?: StormWorkspaceConfig
61
- ) {
62
- const normalized = await normalizeOptions(tree, { ...options });
63
-
64
- const tasks: GeneratorCallback[] = [];
65
- tasks.push(
66
- await jsInitGenerator(tree, {
67
- ...normalized,
68
- tsConfigName: normalized.rootProject
69
- ? "tsconfig.json"
70
- : "tsconfig.base.json"
71
- } as InitSchema)
72
- );
73
-
74
- tasks.push(
75
- addDependenciesToPackageJson(
76
- tree,
77
- {},
78
- {
79
- "@storm-software/workspace-tools": "latest",
80
- "@storm-software/testing-tools": "latest",
81
- ...(options.devDependencies ?? {})
82
- }
83
- )
84
- );
85
-
86
- if (normalized.publishable) {
87
- tasks.push(await setupVerdaccio(tree, { ...normalized, skipFormat: true }));
88
- }
89
-
90
- const projectConfig = {
91
- root: normalized.directory,
92
- projectType: "library",
93
- sourceRoot: joinPaths(normalized.directory ?? "", "src"),
94
- targets: {
95
- build: {
96
- executor: options.buildExecutor,
97
- outputs: ["{options.outputPath}"],
98
- options: {
99
- entry: [joinPaths(normalized.projectRoot, "src", "index.ts")],
100
- outputPath: getOutputPath(normalized),
101
- tsconfig: joinPaths(normalized.projectRoot, "tsconfig.json"),
102
- project: joinPaths(normalized.projectRoot, "package.json"),
103
- defaultConfiguration: "production",
104
- platform: "neutral",
105
- assets: [
106
- {
107
- input: normalized.projectRoot,
108
- glob: "*.md",
109
- output: "/"
110
- },
111
- {
112
- input: "",
113
- glob: "LICENSE",
114
- output: "/"
115
- }
116
- ]
117
- },
118
- configurations: {
119
- production: {
120
- debug: false,
121
- verbose: false
122
- },
123
- development: {
124
- debug: true,
125
- verbose: true
126
- }
127
- }
128
- }
129
- }
130
- } as TypeScriptLibraryProjectConfig;
131
-
132
- if (options.platform) {
133
- projectConfig.targets.build.options.platform =
134
- options.platform === "worker" ? "node" : options.platform;
135
- }
136
-
137
- addProjectTag(
138
- projectConfig,
139
- ProjectTagConstants.Platform.TAG_ID,
140
- options.platform === "node"
141
- ? ProjectTagConstants.Platform.NODE
142
- : options.platform === "worker"
143
- ? ProjectTagConstants.Platform.WORKER
144
- : options.platform === "browser"
145
- ? ProjectTagConstants.Platform.BROWSER
146
- : ProjectTagConstants.Platform.NEUTRAL,
147
- { overwrite: false }
148
- );
149
-
150
- createProjectTsConfigJson(tree, normalized);
151
- addProjectConfiguration(tree, normalized.name, projectConfig);
152
-
153
- let repository = {
154
- type: "github",
155
- url:
156
- config?.repository ||
157
- `https://github.com/${config?.organization || "storm-software"}/${config?.namespace || config?.name || "repository"}.git`
158
- };
159
-
160
- let description =
161
- options.description ||
162
- "A package developed by Storm Software used to create modern, scalable web applications.";
163
-
164
- if (tree.exists("package.json")) {
165
- const packageJson = readJson<{
166
- repository: any;
167
- description: string;
168
- }>(tree, "package.json");
169
-
170
- if (packageJson?.repository) {
171
- repository = packageJson.repository;
172
- }
173
- if (packageJson?.description) {
174
- description = packageJson.description;
175
- }
176
- }
177
-
178
- if (!normalized.importPath) {
179
- normalized.importPath = normalized.name;
180
- }
181
-
182
- const packageJsonPath = joinPaths(normalized.projectRoot, "package.json");
183
- if (tree.exists(packageJsonPath)) {
184
- updateJson<PackageJson>(tree, packageJsonPath, (json: PackageJson) => {
185
- if (!normalized.importPath) {
186
- normalized.importPath = normalized.name;
187
- }
188
-
189
- json.name = normalized.importPath;
190
- json.version = "0.0.1";
191
-
192
- // If the package is publishable or root/standalone, we should remove the private field.
193
- if (json.private && (normalized.publishable || normalized.rootProject)) {
194
- json.private = undefined;
195
- }
196
-
197
- return {
198
- ...json,
199
- version: "0.0.1",
200
- description,
201
- repository: {
202
- ...repository,
203
- directory: normalized.projectRoot
204
- },
205
- type: "module",
206
- dependencies: {
207
- ...json.dependencies
208
- },
209
- publishConfig: {
210
- access: "public"
211
- }
212
- } as unknown as PackageJson;
213
- });
214
- } else {
215
- writeJson<PackageJson>(tree, packageJsonPath, {
216
- name: normalized.importPath,
217
- version: "0.0.1",
218
- description,
219
- repository: {
220
- ...repository,
221
- directory: normalized.projectRoot
222
- },
223
- private: !normalized.publishable || normalized.rootProject,
224
- type: "module",
225
- publishConfig: {
226
- access: "public"
227
- }
228
- } as unknown as PackageJson);
229
- }
230
-
231
- if (tree.exists("package.json") && normalized.importPath) {
232
- updateJson(tree, "package.json", json => ({
233
- ...json,
234
- pnpm: {
235
- ...json?.pnpm,
236
- overrides: {
237
- ...json?.pnpm?.overrides,
238
- [normalized.importPath ?? ""]: "workspace:*"
239
- }
240
- }
241
- }));
242
- }
243
-
244
- addTsConfigPath(tree, normalized.importPath, [
245
- joinPaths(
246
- normalized.projectRoot,
247
- "./src",
248
- `index.${normalized.js ? "js" : "ts"}`
249
- )
250
- ]);
251
- addTsConfigPath(tree, joinPaths(normalized.importPath, "/*"), [
252
- joinPaths(normalized.projectRoot, "./src", "/*")
253
- ]);
254
-
255
- if (tree.exists("package.json")) {
256
- const packageJson = readJson<{
257
- repository: any;
258
- description: string;
259
- }>(tree, "package.json");
260
-
261
- if (packageJson?.repository) {
262
- repository = packageJson.repository;
263
- }
264
- if (packageJson?.description) {
265
- description = packageJson.description;
266
- }
267
- }
268
-
269
- const tsconfigPath = joinPaths(normalized.projectRoot, "tsconfig.json");
270
- if (tree.exists(tsconfigPath)) {
271
- updateJson(tree, tsconfigPath, (json: any) => {
272
- json.composite ??= true;
273
-
274
- return json;
275
- });
276
- } else {
277
- writeJson(tree, tsconfigPath, {
278
- extends: `${offsetFromRoot(normalized.projectRoot)}tsconfig.base.json`,
279
- composite: true,
280
- compilerOptions: {
281
- outDir: `${offsetFromRoot(normalized.projectRoot)}dist/out-tsc`
282
- },
283
- files: [],
284
- include: ["src/**/*.ts", "src/**/*.js"],
285
- exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
286
- });
287
- }
288
-
289
- // const lintCallback = await addLint(tree, options);
290
- // tasks.push(lintCallback);
291
-
292
- await formatFiles(tree);
293
-
294
- return null;
295
- }
296
-
297
- export function getOutputPath(
298
- options: TypeScriptLibraryGeneratorNormalizedOptions
299
- ) {
300
- const parts = ["dist"];
301
- if (options.projectRoot === ".") {
302
- parts.push(options.name);
303
- } else {
304
- parts.push(options.projectRoot);
305
- }
306
- return joinPaths(...parts);
307
- }
308
-
309
- export function createProjectTsConfigJson(
310
- tree: Tree,
311
- options: TypeScriptLibraryGeneratorNormalizedOptions
312
- ) {
313
- const tsconfig = {
314
- extends: options.rootProject
315
- ? undefined
316
- : getRelativePathToRootTsConfig(tree, options.projectRoot),
317
- ...(options?.tsconfigOptions ?? {}),
318
- compilerOptions: {
319
- ...(options.rootProject ? tsConfigBaseOptions : {}),
320
- outDir: joinPaths(offsetFromRoot(options.projectRoot), "dist/out-tsc"),
321
- noEmit: true,
322
- ...(options?.tsconfigOptions?.compilerOptions ?? {})
323
- },
324
- files: [...(options?.tsconfigOptions?.files ?? [])],
325
- include: [
326
- ...(options?.tsconfigOptions?.include ?? []),
327
- "src/**/*.ts",
328
- "src/**/*.js",
329
- "bin/**/*"
330
- ],
331
- exclude: [
332
- ...(options?.tsconfigOptions?.exclude ?? []),
333
- "jest.config.ts",
334
- "src/**/*.spec.ts",
335
- "src/**/*.test.ts"
336
- ]
337
- };
338
-
339
- writeJson(tree, joinPaths(options.projectRoot, "tsconfig.json"), tsconfig);
340
- }
341
-
342
- export type UnitTestRunner = "jest" | "vitest" | "none" | undefined;
343
- export type TestEnvironment = "jsdom" | "node" | undefined;
344
-
345
- export async function normalizeOptions(
346
- tree: Tree,
347
- options: TypeScriptLibraryGeneratorOptions,
348
- config?: StormWorkspaceConfig
349
- ): Promise<TypeScriptLibraryGeneratorNormalizedOptions> {
350
- let importPath = options.importPath;
351
- if (!importPath && config?.namespace) {
352
- importPath = `@${config?.namespace}/${options.name}`;
353
- }
354
-
355
- if (options.publishable) {
356
- if (!importPath) {
357
- throw new Error(
358
- `For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`
359
- );
360
- }
361
- }
362
-
363
- let bundler: Bundler = "tsc";
364
- if (options.publishable === false && options.buildable === false) {
365
- bundler = "none";
366
- }
367
-
368
- const { Linter } = ensurePackage("@nx/eslint", nxVersion);
369
-
370
- const rootProject = false;
371
- const {
372
- projectName,
373
- names: projectNames,
374
- projectRoot,
375
- importPath: normalizedImportPath
376
- } = await determineProjectNameAndRootOptions(tree, {
377
- name: options.name,
378
- projectType: "library",
379
- directory: options.directory,
380
- importPath,
381
- rootProject
382
- });
383
-
384
- const normalized = names(projectNames.projectFileName);
385
- const fileName = normalized.fileName;
386
-
387
- return {
388
- js: false,
389
- pascalCaseFiles: false,
390
- skipFormat: false,
391
- skipTsConfig: false,
392
- includeBabelRc: false,
393
- unitTestRunner: "jest" as UnitTestRunner,
394
- linter: Linter.EsLint,
395
- testEnvironment: "node" as TestEnvironment,
396
- config: "project",
397
- compiler: "tsc",
398
- bundler,
399
- skipTypeCheck: false,
400
- minimal: false,
401
- hasPlugin: false,
402
- isUsingTsSolutionConfig: false,
403
- projectPackageManagerWorkspaceState:
404
- "included" as ProjectPackageManagerWorkspaceState,
405
- ...options,
406
- fileName,
407
- name: projectName,
408
- projectNames,
409
- projectRoot,
410
- parsedTags: options.tags ? options.tags.split(",").map(s => s.trim()) : [],
411
- importPath: normalizedImportPath,
412
- rootProject,
413
- shouldUseSwcJest: false
414
- } as TypeScriptLibraryGeneratorNormalizedOptions;
415
- }
@@ -1,106 +0,0 @@
1
- import { defineUntypedSchema } from "untyped";
2
- import baseGeneratorSchema from "./base-generator.untyped";
3
-
4
- export default defineUntypedSchema({
5
- ...baseGeneratorSchema,
6
- $schema: {
7
- id: "TypeScriptLibraryGeneratorSchema",
8
- title: "TypeScript Library Generator",
9
- description:
10
- "A type definition for the base TypeScript Library Generator schema",
11
- required: ["directory", "name"],
12
- },
13
- name: {
14
- $schema: {
15
- title: "Name",
16
- type: "string",
17
- description: "The name of the library",
18
- },
19
- },
20
- description: {
21
- $schema: {
22
- title: "Description",
23
- type: "string",
24
- description: "The description of the library",
25
- },
26
- },
27
- buildExecutor: {
28
- $schema: {
29
- title: "Build Executor",
30
- type: "string",
31
- description: "The executor to use for building the library",
32
- },
33
- $default: "@storm-software/workspace-tools:unbuild",
34
- },
35
- platform: {
36
- $schema: {
37
- title: "Platform",
38
- type: "string",
39
- description: "The platform to target with the library",
40
- enum: ["neutral", "node", "worker", "browser"],
41
- },
42
- $default: "neutral",
43
- },
44
- importPath: {
45
- $schema: {
46
- title: "Import Path",
47
- type: "string",
48
- description: "The import path for the library",
49
- },
50
- },
51
- tags: {
52
- $schema: {
53
- title: "Tags",
54
- type: "string",
55
- description: "The tags for the library",
56
- },
57
- },
58
- unitTestRunner: {
59
- $schema: {
60
- title: "Unit Test Runner",
61
- type: "string",
62
- enum: ["jest", "vitest", "none"],
63
- description: "The unit test runner to use",
64
- },
65
- },
66
- testEnvironment: {
67
- $schema: {
68
- title: "Test Environment",
69
- type: "string",
70
- enum: ["jsdom", "node"],
71
- description: "The test environment to use",
72
- },
73
- },
74
- pascalCaseFiles: {
75
- $schema: {
76
- title: "Pascal Case Files",
77
- type: "boolean",
78
- description: "Use PascalCase for file names",
79
- },
80
- $default: false,
81
- },
82
- strict: {
83
- $schema: {
84
- title: "Strict",
85
- type: "boolean",
86
- description: "Enable strict mode",
87
- },
88
- $default: true,
89
- },
90
- publishable: {
91
- $schema: {
92
- title: "Publishable",
93
- type: "boolean",
94
- description: "Make the library publishable",
95
- },
96
- $default: false,
97
- },
98
- buildable: {
99
- $schema: {
100
- title: "Buildable",
101
- type: "boolean",
102
- description: "Make the library buildable",
103
- },
104
- $default: true,
105
- },
106
- });
@@ -1,18 +0,0 @@
1
- import { ExecutorContext } from "@nx/devkit";
2
-
3
- import executor from "./executor";
4
- import { CargoBuildExecutorSchema } from "./schema.d";
5
-
6
- const options: CargoBuildExecutorSchema = {};
7
- const context: ExecutorContext = {
8
- root: "",
9
- cwd: process.cwd(),
10
- isVerbose: false,
11
- };
12
-
13
- describe("CargoBuild Executor", () => {
14
- it("can run", async () => {
15
- const output = await executor(options, context);
16
- expect(output.success).toBe(true);
17
- });
18
- });
@@ -1,28 +0,0 @@
1
- import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
- import { withRunExecutor } from "../../base/base-executor";
3
- import { buildCargoCommand, cargoCommand } from "../../utils/cargo";
4
- import { CargoBuildExecutorSchema } from "./schema.d";
5
-
6
- export async function cargoBuildExecutor(
7
- options: CargoBuildExecutorSchema,
8
- context: ExecutorContext,
9
- ) {
10
- const command = buildCargoCommand("build", options, context);
11
- return await cargoCommand(...command);
12
- }
13
-
14
- export default withRunExecutor<CargoBuildExecutorSchema>(
15
- "Cargo Build",
16
- cargoBuildExecutor,
17
- {
18
- skipReadingConfig: false,
19
- hooks: {
20
- applyDefaultOptions: (options: CargoBuildExecutorSchema) => {
21
- options.outputPath ??= "dist/target/{projectRoot}";
22
- options.toolchain ??= "stable";
23
-
24
- return options as CargoBuildExecutorSchema;
25
- },
26
- },
27
- },
28
- ) as PromiseExecutor<CargoBuildExecutorSchema>;
@@ -1,18 +0,0 @@
1
- import { defineUntypedSchema } from "untyped";
2
- import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
3
-
4
- export default defineUntypedSchema({
5
- ...cargoBaseExecutorSchema,
6
- $schema: {
7
- id: "CargoBuildExecutorSchema",
8
- title: "Cargo Build Executor",
9
- description: "A type definition for a Cargo/rust build executor schema",
10
- },
11
- outputPath: {
12
- $schema: {
13
- title: "Output Path",
14
- type: "string",
15
- description: "The path to the output directory",
16
- },
17
- },
18
- });
@@ -1,18 +0,0 @@
1
- import { ExecutorContext } from "@nx/devkit";
2
-
3
- import executor from "./executor";
4
- import { CargoCheckExecutorSchema } from "./schema.d";
5
-
6
- const options: CargoCheckExecutorSchema = {};
7
- const context: ExecutorContext = {
8
- root: "",
9
- cwd: process.cwd(),
10
- isVerbose: false,
11
- };
12
-
13
- describe("CargoCheck Executor", () => {
14
- it("can run", async () => {
15
- const output = await executor(options, context);
16
- expect(output.success).toBe(true);
17
- });
18
- });
@@ -1,27 +0,0 @@
1
- import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
- import { withRunExecutor } from "../../base/base-executor";
3
- import { buildCargoCommand, cargoCommand } from "../../utils/cargo";
4
- import { CargoCheckExecutorSchema } from "./schema.d";
5
-
6
- export async function cargoCheckExecutor(
7
- options: CargoCheckExecutorSchema,
8
- context: ExecutorContext,
9
- ) {
10
- const command = buildCargoCommand("check", options, context);
11
- return await cargoCommand(...command);
12
- }
13
-
14
- export default withRunExecutor<CargoCheckExecutorSchema>(
15
- "Cargo Check",
16
- cargoCheckExecutor,
17
- {
18
- skipReadingConfig: false,
19
- hooks: {
20
- applyDefaultOptions: (options: CargoCheckExecutorSchema) => {
21
- options.toolchain ??= "stable";
22
-
23
- return options as CargoCheckExecutorSchema;
24
- },
25
- },
26
- },
27
- ) as PromiseExecutor<CargoCheckExecutorSchema>;
@@ -1,11 +0,0 @@
1
- import { defineUntypedSchema } from "untyped";
2
- import cargoBaseExecutorSchema from "../../base/cargo-base-executor.untyped";
3
-
4
- export default defineUntypedSchema({
5
- ...cargoBaseExecutorSchema,
6
- $schema: {
7
- id: "CargoCheckExecutorSchema",
8
- title: "Cargo Check Executor",
9
- description: "A type definition for a Cargo/rust check executor schema",
10
- },
11
- });
@@ -1,18 +0,0 @@
1
- import { ExecutorContext } from "@nx/devkit";
2
-
3
- import executor from "./executor";
4
- import { CargoCheckExecutorSchema } from "./schema.d";
5
-
6
- const options: CargoCheckExecutorSchema = {};
7
- const context: ExecutorContext = {
8
- root: "",
9
- cwd: process.cwd(),
10
- isVerbose: false,
11
- };
12
-
13
- describe("CargoCheck Executor", () => {
14
- it("can run", async () => {
15
- const output = await executor(options, context);
16
- expect(output.success).toBe(true);
17
- });
18
- });
@@ -1,28 +0,0 @@
1
- import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
- import { withRunExecutor } from "../../base/base-executor";
3
- import { buildCargoCommand, cargoCommand } from "../../utils/cargo";
4
- import { CargoClippyExecutorSchema } from "./schema.d";
5
-
6
- export async function cargoClippyExecutor(
7
- options: CargoClippyExecutorSchema,
8
- context: ExecutorContext,
9
- ) {
10
- const command = buildCargoCommand("clippy", options, context);
11
- return await cargoCommand(...command);
12
- }
13
-
14
- export default withRunExecutor<CargoClippyExecutorSchema>(
15
- "Cargo Clippy",
16
- cargoClippyExecutor,
17
- {
18
- skipReadingConfig: false,
19
- hooks: {
20
- applyDefaultOptions: (options: CargoClippyExecutorSchema) => {
21
- options.toolchain ??= "stable";
22
- options.fix ??= false;
23
-
24
- return options as CargoClippyExecutorSchema;
25
- },
26
- },
27
- },
28
- ) as PromiseExecutor<CargoClippyExecutorSchema>;