@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,564 +0,0 @@
1
- import {
2
- createNodesFromFiles,
3
- CreateNodesResultV2,
4
- CreateNodesV2
5
- } from "@nx/devkit";
6
- import { existsSync } from "node:fs";
7
- import { dirname, join } from "node:path";
8
- import { readNxJson } from "nx/src/config/nx-json.js";
9
- import type { ProjectConfiguration } from "nx/src/config/workspace-json-project-json";
10
- import { readJsonFile } from "nx/src/utils/fileutils";
11
- import {
12
- readTargetsFromPackageJson,
13
- type PackageJson as PackageJsonNx
14
- } from "nx/src/utils/package-json";
15
- import type { PackageJson } from "pkg-types";
16
- import { readTSConfig } from "pkg-types";
17
- import { getProjectPlatform } from "../../utils/plugin-helpers";
18
- import {
19
- addProjectTag,
20
- isEqualProjectTag,
21
- ProjectTagConstants,
22
- setDefaultProjectTags
23
- } from "../../utils/project-tags";
24
-
25
- export const name = "storm-software/typescript";
26
-
27
- /**
28
- * Options for configuring the TypeScript plugin.
29
- */
30
- export interface TypeScriptPluginOptions {
31
- /**
32
- * Whether to include applications in the TypeScript project configuration.
33
- * @defaultValue true
34
- */
35
- includeApps?: boolean;
36
-
37
- /**
38
- * Whether to enable Knip, a tool for analyzing TypeScript projects.
39
- * @defaultValue true
40
- */
41
- enableKnip?: boolean;
42
-
43
- /**
44
- * Whether to enable Markdownlint for linting Markdown files.
45
- * @defaultValue true
46
- */
47
- enableMarkdownlint?: boolean;
48
-
49
- /**
50
- * Whether to enable ESLint for linting TypeScript and JavaScript files.
51
- * @defaultValue true
52
- */
53
- enableEslint?: boolean;
54
-
55
- /**
56
- * Whether to skip the linting of internal tools (projects in the `/tools` directory).
57
- *
58
- * @defaultValue false
59
- */
60
- lintInternalTools?: boolean;
61
- }
62
-
63
- export const createNodesV2: CreateNodesV2<TypeScriptPluginOptions> = [
64
- "{project.json,**/project.json}",
65
- async (
66
- configFiles,
67
- options = { includeApps: true },
68
- context
69
- ): Promise<CreateNodesResultV2> => {
70
- return await createNodesFromFiles(
71
- async (file, options = { includeApps: true }, context) => {
72
- try {
73
- const packageJson = createPackageJson(file, context.workspaceRoot);
74
- if (!packageJson) {
75
- return [];
76
- }
77
-
78
- const tsconfig = await createTsconfig(file, context.workspaceRoot);
79
- if (!tsconfig) {
80
- return [];
81
- }
82
-
83
- const project = createProjectFromPackageJsonNextToProjectJson(
84
- file,
85
- packageJson
86
- );
87
-
88
- // If the project is an application and we don't want to include apps, skip it
89
- if (
90
- options?.includeApps === false &&
91
- project.projectType === "application"
92
- ) {
93
- return [];
94
- }
95
-
96
- let relativeRoot = project.root
97
- .replaceAll("\\", "/")
98
- .replace(context.workspaceRoot.replaceAll("\\", "/"), "");
99
- if (relativeRoot.startsWith("/")) {
100
- relativeRoot = relativeRoot.slice(1);
101
- }
102
-
103
- // const enableKnip = options?.enableKnip !== false;
104
- const enableMarkdownlint = options?.enableMarkdownlint !== false;
105
- const enableEslint = options?.enableEslint !== false;
106
-
107
- const nxJson = readNxJson(context.workspaceRoot);
108
- const targets: ProjectConfiguration["targets"] =
109
- readTargetsFromPackageJson(packageJson as PackageJsonNx, nxJson);
110
-
111
- if (
112
- join(context.workspaceRoot, project.root).startsWith(
113
- join(context.workspaceRoot, "tools")
114
- ) &&
115
- options?.lintInternalTools !== true
116
- ) {
117
- targets.lint = {
118
- dependsOn: ["^lint"],
119
- executor: "nx:run-commands",
120
- options: {
121
- command:
122
- "echo 'Skipping linting of internal tools package \"{projectName}\". This can be changed by setting `lintInternalTools` to `true` in the Storm TypeScript plugin options.' "
123
- }
124
- };
125
- } else {
126
- // if (!targets["lint-knip"] && enableKnip) {
127
- // const relativePath = relative(dirname(file), context.workspaceRoot);
128
-
129
- // targets["lint-knip"] = {
130
- // cache: true,
131
- // outputs: ["{projectRoot}/**/*.md", "{projectRoot}/**/*.mdx"],
132
- // inputs: [
133
- // "linting",
134
- // "{projectRoot}/**/*.md",
135
- // "{projectRoot}/**/*.mdx"
136
- // ],
137
- // dependsOn: ["^lint-knip"],
138
- // executor: "nx:run-commands",
139
- // options: {
140
- // command: `pnpm exec knip --config "${join(relativePath, "node_modules/@storm-software/linting-tools/knip/config.json").replaceAll("\\", "/")}" --tsConfig "{projectRoot}/tsconfig.json" --directory "{projectRoot}" --fix --no-exit-code --cache --cache-location "${join(relativePath, "node_modules/.cache/knip/{projectRoot}").replaceAll("\\", "/")}"`
141
- // }
142
- // };
143
- // }
144
-
145
- if (!targets["lint-ls"]) {
146
- targets["lint-ls"] = {
147
- cache: true,
148
- inputs: ["linting", "typescript", "^production"],
149
- dependsOn: ["^lint-ls"],
150
- executor: "nx:run-commands",
151
- options: {
152
- command:
153
- 'pnpm exec ls-lint --config="node_modules/@storm-software/linting-tools/ls-lint/.ls-lint.yml" '
154
- }
155
- };
156
- }
157
-
158
- if (!targets["lint-markdown"] && enableMarkdownlint) {
159
- targets["lint-markdown"] = {
160
- cache: true,
161
- outputs: ["{projectRoot}/**/*.md", "{projectRoot}/**/*.mdx"],
162
- inputs: [
163
- "linting",
164
- "{projectRoot}/**/*.md",
165
- "{projectRoot}/**/*.mdx"
166
- ],
167
- dependsOn: ["^lint-markdown"],
168
- executor: "nx:run-commands",
169
- options: {
170
- command:
171
- 'pnpm exec markdownlint-cli2 "{projectRoot}/*.{md,mdx}" "{projectRoot}/**/*.{md,mdx}" --config "node_modules/@storm-software/markdownlint/config/base.markdownlint-cli2.jsonc" --fix'
172
- }
173
- };
174
- }
175
-
176
- if (!targets.lint && enableEslint) {
177
- let eslintConfig = checkEslintConfigAtPath(project.root);
178
- if (!eslintConfig) {
179
- eslintConfig = checkEslintConfigAtPath(context.workspaceRoot);
180
- }
181
-
182
- if (eslintConfig) {
183
- targets.lint = {
184
- cache: true,
185
- inputs: ["linting", "typescript", "^production"],
186
- outputs: [
187
- "{projectRoot}/**/*.{ts,tsx,js,jsx,json,md,mdx,yaml,yml,html,css,scss,sass,less,graphql,gql}"
188
- ],
189
- dependsOn: ["lint-markdown", "lint-knip", "^lint"],
190
- executor: "@nx/eslint:lint",
191
- options: {
192
- format: "stylish",
193
- fix: true,
194
- errorOnUnmatchedPattern: false,
195
- cache: true,
196
- cacheLocation:
197
- "{workspaceRoot}/node_modules/.cache/eslint/{projectRoot}",
198
- eslintConfig
199
- }
200
- };
201
- }
202
- }
203
- }
204
-
205
- if (!targets["format-toml"]) {
206
- targets["format-toml"] = {
207
- inputs: ["linting", "{projectRoot}/**/*.toml"],
208
- outputs: ["{projectRoot}/**/*.toml"],
209
- dependsOn: ["^format-toml"],
210
- executor: "nx:run-commands",
211
- options: {
212
- command:
213
- 'pnpm exec taplo format --config="node_modules/@storm-software/linting-tools/taplo/config.toml" --cache-path="node_modules/.cache/taplo/{projectRoot}" --colors="always" "{projectRoot}/*.toml" "{projectRoot}/**/*.toml" '
214
- }
215
- };
216
- }
217
-
218
- if (!targets["format-readme"]) {
219
- targets["format-readme"] = {
220
- inputs: [
221
- "linting",
222
- "documentation",
223
- "{projectRoot}/{README.md,package.json,Cargo.toml,executors.json,generators.json}"
224
- ],
225
- outputs: ["{projectRoot}/README.md"],
226
- dependsOn: ["^format-readme"],
227
- executor: "nx:run-commands",
228
- options: {
229
- command:
230
- 'pnpm exec storm-git readme --templates="tools/readme-templates" --project="{projectName}"'
231
- }
232
- };
233
- }
234
-
235
- if (!targets["format-prettier"]) {
236
- targets["format-prettier"] = {
237
- inputs: ["linting", "typescript", "^production"],
238
- outputs: ["{projectRoot}/**/*"],
239
- dependsOn: ["^format-prettier"],
240
- executor: "nx:run-commands",
241
- options: {
242
- command:
243
- 'pnpm exec prettier "{projectRoot}/**/*" --write --ignore-unknown --no-error-on-unmatched-pattern --config="node_modules/@storm-software/prettier/config.json" --ignore-path="node_modules/@storm-software/prettier/.prettierignore" --cache --cache-location="node_modules/.cache/prettier/{projectRoot}" '
244
- }
245
- };
246
- }
247
-
248
- if (!targets.format) {
249
- targets.format = {
250
- dependsOn: [
251
- "format-readme",
252
- "format-toml",
253
- "format-prettier",
254
- "^format"
255
- ],
256
- executor: "nx:run-commands",
257
- options: {
258
- command:
259
- "echo 'Formatting the project files in \"{projectRoot}\"' "
260
- }
261
- };
262
- }
263
-
264
- if (!targets.clean) {
265
- targets.clean = {
266
- cache: true,
267
- executor: "nx:run-commands",
268
- inputs: ["typescript", "^production"],
269
- outputs: ["{workspaceRoot}/dist/{projectRoot}"],
270
- options: {
271
- command: "pnpm exec rimraf dist/{projectRoot}",
272
- color: true,
273
- cwd: "{workspaceRoot}"
274
- }
275
- };
276
- }
277
-
278
- if (!targets.rebuild) {
279
- targets.rebuild = {
280
- cache: false,
281
- executor: "nx:run-commands",
282
- dependsOn: ["clean", "^build"],
283
- inputs: ["typescript", "default", "^production"],
284
- outputs: ["{workspaceRoot}/dist/{projectRoot}"],
285
- options: {
286
- command: `pnpm exec nx run ${project.name}:build`
287
- }
288
- };
289
- }
290
-
291
- if (!targets.test && checkJestConfigAtPath(project.root)) {
292
- targets.test = {
293
- cache: true,
294
- executor: "@nx/jest:jest",
295
- inputs: ["testing", "typescript", "^production"],
296
- outputs: ["{workspaceRoot}/coverage/{projectRoot}"],
297
- defaultConfiguration: "development",
298
- options: {
299
- jestConfig: "{projectRoot}/jest.config.ts",
300
- passWithNoTests: true
301
- },
302
- configurations: {
303
- development: {
304
- ci: false,
305
- codeCoverage: true
306
- },
307
- production: {
308
- ci: true,
309
- codeCoverage: true
310
- }
311
- }
312
- };
313
- }
314
-
315
- targets["size-limit"] = {
316
- dependsOn: ["build", "^size-limit"],
317
- options: {}
318
- };
319
-
320
- // Apply nx-release-publish target for non-private projects
321
- const isPrivate = packageJson.private ?? false;
322
- if (!isPrivate) {
323
- addProjectTag(
324
- project,
325
- ProjectTagConstants.Registry.TAG_ID,
326
- ProjectTagConstants.Registry.NPM,
327
- { overwrite: true }
328
- );
329
-
330
- targets["nx-release-publish"] = {
331
- dependsOn: ["build", "size-limit", "^nx-release-publish"],
332
- executor: "@storm-software/workspace-tools:npm-publish",
333
- options: {}
334
- };
335
-
336
- if (
337
- project.projectType === "application" ||
338
- isEqualProjectTag(
339
- project,
340
- ProjectTagConstants.ProjectType.TAG_ID,
341
- ProjectTagConstants.ProjectType.APPLICATION
342
- ) ||
343
- isEqualProjectTag(
344
- project,
345
- ProjectTagConstants.DistStyle.TAG_ID,
346
- ProjectTagConstants.DistStyle.CLEAN
347
- )
348
- ) {
349
- targets["clean-package"] = {
350
- cache: true,
351
- dependsOn: ["build"],
352
- inputs: [
353
- "linting",
354
- "testing",
355
- "documentation",
356
- "default",
357
- "^production"
358
- ],
359
- outputs: ["{workspaceRoot}/dist/{projectRoot}"],
360
- executor: "@storm-software/workspace-tools:clean-package",
361
- options: {
362
- cleanReadMe: true,
363
- cleanComments: true
364
- }
365
- };
366
-
367
- targets["nx-release-publish"].dependsOn?.push("clean-package");
368
- targets["size-limit"].dependsOn?.push("clean-package");
369
- }
370
- }
371
-
372
- addProjectTag(
373
- project,
374
- ProjectTagConstants.Language.TAG_ID,
375
- ProjectTagConstants.Language.TYPESCRIPT,
376
- { overwrite: true }
377
- );
378
-
379
- const platform = getProjectPlatform(project);
380
- switch (platform) {
381
- case "worker":
382
- addProjectTag(
383
- project,
384
- ProjectTagConstants.Platform.TAG_ID,
385
- ProjectTagConstants.Platform.WORKER,
386
- { overwrite: true }
387
- );
388
- break;
389
-
390
- case "node":
391
- addProjectTag(
392
- project,
393
- ProjectTagConstants.Platform.TAG_ID,
394
- ProjectTagConstants.Platform.NODE,
395
- { overwrite: true }
396
- );
397
- break;
398
-
399
- case "browser":
400
- addProjectTag(
401
- project,
402
- ProjectTagConstants.Platform.TAG_ID,
403
- ProjectTagConstants.Platform.BROWSER,
404
- { overwrite: true }
405
- );
406
- break;
407
-
408
- default:
409
- addProjectTag(
410
- project,
411
- ProjectTagConstants.Platform.TAG_ID,
412
- ProjectTagConstants.Platform.NEUTRAL,
413
- { overwrite: true }
414
- );
415
- break;
416
- }
417
-
418
- setDefaultProjectTags(project, name);
419
-
420
- const result = (
421
- project?.name
422
- ? {
423
- projects: {
424
- [project.name]: {
425
- ...project,
426
- root: relativeRoot,
427
- targets,
428
- release: {
429
- ...project?.release,
430
- version: {
431
- ...project?.release?.version,
432
- generator:
433
- "@storm-software/workspace-tools:release-version"
434
- }
435
- }
436
- }
437
- }
438
- }
439
- : {}
440
- ) as CreateNodesResultV2;
441
- console.log(`Writing Results for ${project?.name ?? "missing name"}`);
442
- console.log(result);
443
-
444
- return result;
445
- } catch (e) {
446
- console.error(e);
447
- return {};
448
- }
449
- },
450
- configFiles,
451
- options,
452
- context
453
- );
454
- }
455
- ];
456
-
457
- function createProjectFromPackageJsonNextToProjectJson(
458
- projectJsonPath: string,
459
- packageJson: PackageJson
460
- ): ProjectConfiguration {
461
- const { nx, name } = packageJson;
462
- const root = dirname(projectJsonPath);
463
-
464
- return {
465
- ...nx,
466
- name,
467
- root,
468
- targets: {}
469
- } as ProjectConfiguration;
470
- }
471
-
472
- function createPackageJson(
473
- projectJsonPath: string,
474
- workspaceRoot: string
475
- ): PackageJson | null {
476
- try {
477
- const root = dirname(projectJsonPath);
478
- const packageJsonPath = join(workspaceRoot, root, "package.json");
479
- if (!existsSync(packageJsonPath)) {
480
- return null;
481
- }
482
-
483
- return readJsonFile(packageJsonPath) as PackageJson;
484
- } catch (e) {
485
- console.log(e);
486
- return null;
487
- }
488
- }
489
-
490
- async function createTsconfig(projectJsonPath: string, workspaceRoot: string) {
491
- try {
492
- const root = dirname(projectJsonPath);
493
- const tsconfigJsonPath = join(workspaceRoot, root, "tsconfig.json");
494
- if (!existsSync(tsconfigJsonPath)) {
495
- return null;
496
- }
497
-
498
- // return readTSConfig(tsconfigJsonPath, {
499
- // rootPattern: workspaceRoot,
500
- // startingFrom: dirname(tsconfigJsonPath)
501
- // });
502
-
503
- return readTSConfig(tsconfigJsonPath);
504
- } catch (e) {
505
- console.log(e);
506
- return null;
507
- }
508
- }
509
-
510
- function checkEslintConfigAtPath(directory: string): string | null {
511
- const hasEslintConfigFile = (fileName: string): boolean => {
512
- return existsSync(join(directory, fileName));
513
- };
514
-
515
- if (hasEslintConfigFile(".eslintrc.js")) {
516
- return ".eslintrc.js";
517
- } else if (hasEslintConfigFile(".eslintrc.cjs")) {
518
- return ".eslintrc.cjs";
519
- } else if (hasEslintConfigFile(".eslintrc.yaml")) {
520
- return ".eslintrc.yaml";
521
- } else if (hasEslintConfigFile(".eslintrc.yml")) {
522
- return ".eslintrc.yml";
523
- } else if (hasEslintConfigFile(".eslintrc.json")) {
524
- return ".eslintrc.json";
525
- } else if (hasEslintConfigFile(".eslintrc")) {
526
- return ".eslintrc";
527
- } else if (hasEslintConfigFile("eslint.config.js")) {
528
- return "eslint.config.js";
529
- } else if (hasEslintConfigFile("eslint.config.cjs")) {
530
- return "eslint.config.cjs";
531
- } else if (hasEslintConfigFile("eslint.config.mjs")) {
532
- return "eslint.config.mjs";
533
- } else if (hasEslintConfigFile("eslint.config.ts")) {
534
- return "eslint.config.ts";
535
- } else if (hasEslintConfigFile("eslint.config.cts")) {
536
- return "eslint.config.cts";
537
- } else if (hasEslintConfigFile("eslint.config.mts")) {
538
- return "eslint.config.mts";
539
- }
540
-
541
- return null;
542
- }
543
-
544
- function checkJestConfigAtPath(directory: string): string | null {
545
- const hasJestConfigFile = (fileName: string): boolean => {
546
- return existsSync(join(directory, fileName));
547
- };
548
-
549
- if (hasJestConfigFile("eslint.config.js")) {
550
- return "jest.config.js";
551
- } else if (hasJestConfigFile("eslint.config.cjs")) {
552
- return "jest.config.cjs";
553
- } else if (hasJestConfigFile("eslint.config.mjs")) {
554
- return "jest.config.mjs";
555
- } else if (hasJestConfigFile("eslint.config.ts")) {
556
- return "jest.config.ts";
557
- } else if (hasJestConfigFile("jest.config.cts")) {
558
- return "jest.config.cts";
559
- } else if (hasJestConfigFile("jest.config.mts")) {
560
- return "jest.config.mts";
561
- }
562
-
563
- return null;
564
- }