@storm-software/workspace-tools 1.270.1 → 1.271.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 (287) hide show
  1. package/CHANGELOG.md +43 -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 +3 -3
  8. package/dist/executors.mjs +2 -2
  9. package/dist/index.d.mts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +3 -3
  12. package/dist/index.mjs +4 -4
  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-CWBVTZAO.mjs +0 -467
  53. package/dist/chunk-HMJTTE4A.mjs +0 -96
  54. package/dist/chunk-PGUGHXXT.js +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,467 +0,0 @@
1
- import {
2
- pnpmCatalogUpdate
3
- } from "./chunk-HMJTTE4A.mjs";
4
- import {
5
- joinPaths
6
- } from "./chunk-U7JFVMCK.mjs";
7
-
8
- // src/executors/npm-publish/executor.ts
9
- import {
10
- detectPackageManager,
11
- readJsonFile
12
- } from "@nx/devkit";
13
- import * as columnify from "columnify";
14
- import { exec, execSync } from "node:child_process";
15
- import { existsSync } from "node:fs";
16
- import { relative } from "node:path";
17
- import { env as appendLocalEnv } from "npm-run-path";
18
- var LARGE_BUFFER = 1024 * 1e6;
19
- function processEnv(color) {
20
- const env = {
21
- ...process.env,
22
- ...appendLocalEnv()
23
- };
24
- if (color) {
25
- env.FORCE_COLOR = `${color}`;
26
- }
27
- return env;
28
- }
29
- async function npmPublishExecutorFn(options, context) {
30
- const pm = detectPackageManager();
31
- const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
32
- const projectConfig = context.projectsConfigurations.projects[context.projectName];
33
- const packageRoot = joinPaths(
34
- context.root,
35
- options.packageRoot ?? projectConfig.root
36
- );
37
- const packageJsonPath = joinPaths(packageRoot, "package.json");
38
- const packageJson = readJsonFile(packageJsonPath);
39
- const packageName = packageJson.name;
40
- await pnpmCatalogUpdate(packageRoot, context.root);
41
- const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
42
- if (packageJson.private === true) {
43
- console.warn(
44
- `Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
45
- );
46
- return {
47
- success: true
48
- };
49
- }
50
- const warnFn = (message) => {
51
- console.log(message);
52
- };
53
- const { registry, tag, registryConfigKey } = await parseRegistryOptions(
54
- context.root,
55
- {
56
- packageRoot,
57
- packageJson
58
- },
59
- {
60
- registry: options.registry,
61
- tag: options.tag
62
- },
63
- warnFn
64
- );
65
- const npmViewCommandSegments = [
66
- `npm view ${packageName} versions dist-tags --json --"${registryConfigKey}=${registry}"`
67
- ];
68
- const npmDistTagAddCommandSegments = [
69
- `npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}"`
70
- ];
71
- if (!isDryRun && !options.firstRelease) {
72
- const currentVersion = packageJson.version;
73
- try {
74
- const result = execSync(npmViewCommandSegments.join(" "), {
75
- env: processEnv(true),
76
- cwd: context.root,
77
- stdio: ["ignore", "pipe", "pipe"],
78
- windowsHide: false
79
- });
80
- const resultJson = JSON.parse(result.toString());
81
- const distTags = resultJson["dist-tags"] || {};
82
- if (distTags[tag] === currentVersion) {
83
- console.warn(
84
- `Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
85
- );
86
- return {
87
- success: true
88
- };
89
- }
90
- const versions = Array.isArray(resultJson.versions) ? resultJson.versions : [resultJson.versions];
91
- if (versions.includes(currentVersion)) {
92
- try {
93
- if (!isDryRun) {
94
- execSync(npmDistTagAddCommandSegments.join(" "), {
95
- env: processEnv(true),
96
- cwd: context.root,
97
- stdio: "ignore",
98
- windowsHide: false
99
- });
100
- console.log(
101
- `Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.
102
- `
103
- );
104
- } else {
105
- console.log(
106
- `Would add the dist-tag ${tag} to v${currentVersion} for registry ${registry}, but "[dry-run]" was set.
107
- `
108
- );
109
- }
110
- return {
111
- success: true
112
- };
113
- } catch (err) {
114
- try {
115
- const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
116
- if (!(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.includes("no such package available")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().includes("no such package available"))) {
117
- console.error("npm dist-tag add error:");
118
- if (stdoutData.error.summary) {
119
- console.error(stdoutData.error.summary);
120
- }
121
- if (stdoutData.error.detail) {
122
- console.error(stdoutData.error.detail);
123
- }
124
- if (context.isVerbose) {
125
- console.error("npm dist-tag add stdout:");
126
- console.error(JSON.stringify(stdoutData, null, 2));
127
- }
128
- return {
129
- success: false
130
- };
131
- }
132
- } catch (err2) {
133
- console.error(
134
- "Something unexpected went wrong when processing the npm dist-tag add output\n",
135
- err2
136
- );
137
- return {
138
- success: false
139
- };
140
- }
141
- }
142
- }
143
- } catch (err) {
144
- const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
145
- if (!(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.toLowerCase().includes("not found")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().toLowerCase().includes("not found"))) {
146
- console.error(
147
- `Something unexpected went wrong when checking for existing dist-tags.
148
- `,
149
- err
150
- );
151
- return {
152
- success: false
153
- };
154
- }
155
- }
156
- }
157
- if (options.firstRelease && context.isVerbose) {
158
- console.log("Skipped npm view because --first-release was set");
159
- }
160
- const publishCommandSegments = [
161
- pm === "bun" ? (
162
- // Unlike npm, bun publish does not support a custom registryConfigKey option
163
- `bun publish --cwd="${packageRoot}" --json --registry="${registry}" --tag=${tag}`
164
- ) : pm === "pnpm" ? (
165
- // Unlike npm, pnpm publish does not support a custom registryConfigKey option, and will error on uncommitted changes by default if --no-git-checks is not set
166
- `pnpm publish "${packageRoot}" --json --registry="${registry}" --tag=${tag} --no-git-checks`
167
- ) : `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`
168
- ];
169
- if (options.otp) {
170
- publishCommandSegments.push(`--otp=${options.otp}`);
171
- }
172
- publishCommandSegments.push(`--access=public`);
173
- if (isDryRun) {
174
- publishCommandSegments.push(`--dry-run`);
175
- }
176
- try {
177
- const output = execSync(publishCommandSegments.join(" "), {
178
- maxBuffer: LARGE_BUFFER,
179
- env: processEnv(true),
180
- cwd: context.root,
181
- stdio: ["ignore", "pipe", "pipe"],
182
- windowsHide: false
183
- });
184
- const dryRunVersionPlaceholder = "X.X.X-dry-run";
185
- const publishSummaryMessage = isDryRun ? `Would publish to ${registry} with tag "${tag}", but "[dry-run]" was set` : `Published to ${registry} with tag "${tag}"`;
186
- if (pm === "bun") {
187
- let outputStr = output.toString();
188
- if (isDryRun) {
189
- outputStr = outputStr.replace(
190
- new RegExp(`${packageJson.name}@${packageJson.version}`, "g"),
191
- `${packageJson.name}@${dryRunVersionPlaceholder}`
192
- );
193
- }
194
- console.log(outputStr);
195
- console.log(publishSummaryMessage);
196
- return {
197
- success: true
198
- };
199
- }
200
- const { beforeJsonData, jsonData, afterJsonData } = extractNpmPublishJsonData(output.toString());
201
- if (!jsonData) {
202
- console.error(
203
- `The ${pm} publish output data could not be extracted. Please report this issue on https://github.com/nrwl/nx`
204
- );
205
- return {
206
- success: false
207
- };
208
- }
209
- if (isDryRun) {
210
- for (const [key, val] of Object.entries(jsonData)) {
211
- if (typeof val !== "string") {
212
- continue;
213
- }
214
- jsonData[key] = val.replace(
215
- new RegExp(packageJson.version, "g"),
216
- dryRunVersionPlaceholder
217
- );
218
- }
219
- }
220
- if (typeof beforeJsonData === "string" && beforeJsonData.trim().length > 0) {
221
- console.log(beforeJsonData);
222
- }
223
- logTar(jsonData);
224
- if (typeof afterJsonData === "string" && afterJsonData.trim().length > 0) {
225
- console.log(afterJsonData);
226
- }
227
- console.log(publishSummaryMessage);
228
- return {
229
- success: true
230
- };
231
- } catch (err) {
232
- try {
233
- if (pm === "bun") {
234
- console.error(`bun publish error:`);
235
- console.error(err.stderr?.toString() || "");
236
- console.error(err.stdout?.toString() || "");
237
- return {
238
- success: false
239
- };
240
- }
241
- const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
242
- console.error(`${pm} publish error:`);
243
- if (stdoutData.error?.summary) {
244
- console.error(stdoutData.error.summary);
245
- }
246
- if (stdoutData.error?.detail) {
247
- console.error(stdoutData.error.detail);
248
- }
249
- if (context.isVerbose) {
250
- console.error(`${pm} publish stdout:`);
251
- console.error(JSON.stringify(stdoutData, null, 2));
252
- }
253
- if (!stdoutData.error) {
254
- throw err;
255
- }
256
- return {
257
- success: false
258
- };
259
- } catch (err2) {
260
- console.error(
261
- `Something unexpected went wrong when processing the ${pm} publish output
262
- `,
263
- err2
264
- );
265
- return {
266
- success: false
267
- };
268
- }
269
- }
270
- }
271
- async function parseRegistryOptions(cwd, pkg, options, logWarnFn = console.warn) {
272
- const npmRcPath = joinPaths(pkg.packageRoot, ".npmrc");
273
- if (existsSync(npmRcPath)) {
274
- const relativeNpmRcPath = relative(cwd, npmRcPath);
275
- logWarnFn(
276
- `
277
- Ignoring .npmrc file detected in the package root: ${relativeNpmRcPath}. Nested .npmrc files are not supported by npm. Only the .npmrc file at the root of the workspace will be used. To customize the registry or tag for specific packages, see https://nx.dev/recipes/nx-release/configure-custom-registries
278
- `
279
- );
280
- }
281
- const scope = pkg.packageJson.name.startsWith("@") ? pkg.packageJson.name.split("/")[0] : "";
282
- const registryConfigKey = scope ? `${scope}:registry` : "registry";
283
- const publishConfigRegistry = pkg.packageJson.publishConfig?.[registryConfigKey];
284
- if (publishConfigRegistry || pkg.packageJson.publishConfig?.registry) {
285
- const relativePackageJsonPath = relative(
286
- cwd,
287
- joinPaths(pkg.packageRoot, "package.json")
288
- );
289
- if (options.registry) {
290
- logWarnFn(
291
- `
292
- Registry detected in the 'publishConfig' of the package manifest: ${relativePackageJsonPath}. This will override your registry option set in the project configuration or passed via the --registry argument, which is why configuring the registry with 'publishConfig' is not recommended. For details, see https://nx.dev/recipes/nx-release/configure-custom-registries
293
- `
294
- );
295
- } else {
296
- logWarnFn(
297
- `
298
- Registry detected in the 'publishConfig' of the package manifest: ${relativePackageJsonPath}. Configuring the registry in this way is not recommended because it prevents the registry from being overridden in project configuration or via the --registry argument. To customize the registry for specific packages, see https://nx.dev/recipes/nx-release/configure-custom-registries
299
- `
300
- );
301
- }
302
- }
303
- const registry = (
304
- // `npm publish` will always use the publishConfig registry if it exists, even over the --registry arg
305
- publishConfigRegistry || options.registry || await getNpmRegistry(cwd, scope)
306
- );
307
- const tag = options.tag || await getNpmTag(cwd);
308
- if (!registry || !tag) {
309
- throw new Error(
310
- `The registry and tag options are required. Please provide them in the project configuration or via the --registry and --tag arguments.`
311
- );
312
- }
313
- return { registry, tag, registryConfigKey };
314
- }
315
- async function getNpmRegistry(cwd, scope) {
316
- let registry;
317
- if (scope) {
318
- registry = await getNpmConfigValue(`${scope}:registry`, cwd);
319
- }
320
- if (!registry) {
321
- registry = await getNpmConfigValue("registry", cwd);
322
- }
323
- return registry;
324
- }
325
- async function getNpmTag(cwd) {
326
- return getNpmConfigValue("tag", cwd);
327
- }
328
- async function getNpmConfigValue(key, cwd) {
329
- try {
330
- const result = await execAsync(`npm config get ${key}`, cwd);
331
- return result === "undefined" ? void 0 : result;
332
- } catch (_) {
333
- return Promise.resolve(void 0);
334
- }
335
- }
336
- async function execAsync(command, cwd) {
337
- return new Promise((resolve, reject) => {
338
- exec(command, { cwd, windowsHide: false }, (error, stdout, stderr) => {
339
- if (error) {
340
- return reject((stderr ? `${stderr}
341
- ` : "") + error);
342
- }
343
- return resolve(stdout.trim());
344
- });
345
- });
346
- }
347
- var expectedNpmPublishJsonKeys = [
348
- "id",
349
- "name",
350
- "version",
351
- "size",
352
- "filename"
353
- ];
354
- function extractNpmPublishJsonData(str) {
355
- const jsonMatches = str.match(/{(?:[^{}]|{[^{}]*})*}/g);
356
- if (jsonMatches) {
357
- for (const match of jsonMatches) {
358
- if (!expectedNpmPublishJsonKeys.every((key) => str.includes(key))) {
359
- continue;
360
- }
361
- try {
362
- const parsedJson = JSON.parse(match);
363
- if (!expectedNpmPublishJsonKeys.every(
364
- (key) => parsedJson[key] !== void 0
365
- )) {
366
- continue;
367
- }
368
- const jsonStartIndex = str.indexOf(match);
369
- return {
370
- beforeJsonData: str.slice(0, jsonStartIndex),
371
- jsonData: parsedJson,
372
- afterJsonData: str.slice(jsonStartIndex + match.length)
373
- };
374
- } catch {
375
- }
376
- }
377
- }
378
- return {
379
- beforeJsonData: str,
380
- jsonData: null,
381
- afterJsonData: ""
382
- };
383
- }
384
- var formatBytes = (bytes, space = true) => {
385
- let spacer = "";
386
- if (space) {
387
- spacer = " ";
388
- }
389
- if (bytes < 1e3) {
390
- return `${bytes}${spacer}B`;
391
- }
392
- if (bytes < 1e6) {
393
- return `${(bytes / 1e3).toFixed(1)}${spacer}kB`;
394
- }
395
- if (bytes < 1e9) {
396
- return `${(bytes / 1e6).toFixed(1)}${spacer}MB`;
397
- }
398
- return `${(bytes / 1e9).toFixed(1)}${spacer}GB`;
399
- };
400
- var logTar = (tarball, opts = {}) => {
401
- const { unicode = true } = opts;
402
- console.log("");
403
- console.log(
404
- `${unicode ? "\u{1F4E6} " : "package:"} ${tarball.name}@${tarball.version}`
405
- );
406
- console.log("=== Tarball Contents ===");
407
- if (tarball.files.length) {
408
- console.log("");
409
- const columnData = columnify(
410
- tarball.files.map((f) => {
411
- const bytes = formatBytes(f.size, false);
412
- return /^node_modules\//.test(f.path) ? null : { path: f.path, size: `${bytes}` };
413
- }).filter((f) => f),
414
- {
415
- include: ["size", "path"],
416
- showHeaders: false
417
- }
418
- );
419
- columnData.split("\n").forEach((line) => {
420
- console.log(line);
421
- });
422
- }
423
- if (tarball.bundled.length) {
424
- console.log("=== Bundled Dependencies ===");
425
- tarball.bundled.forEach((name) => console.log("", name));
426
- }
427
- console.log("=== Tarball Details ===");
428
- console.log(
429
- columnify(
430
- [
431
- { name: "name:", value: tarball.name },
432
- { name: "version:", value: tarball.version },
433
- tarball.filename && { name: "filename:", value: tarball.filename },
434
- { name: "package size:", value: formatBytes(tarball.size) },
435
- { name: "unpacked size:", value: formatBytes(tarball.unpackedSize) },
436
- { name: "shasum:", value: tarball.shasum },
437
- {
438
- name: "integrity:",
439
- value: tarball.integrity.toString().slice(0, 20) + "[...]" + tarball.integrity.toString().slice(80)
440
- },
441
- tarball.bundled.length && {
442
- name: "bundled deps:",
443
- value: tarball.bundled.length
444
- },
445
- tarball.bundled.length && {
446
- name: "bundled files:",
447
- value: tarball.entryCount - tarball.files.length
448
- },
449
- tarball.bundled.length && {
450
- name: "own files:",
451
- value: tarball.files.length
452
- },
453
- { name: "total files:", value: tarball.entryCount }
454
- ].filter((x) => x),
455
- {
456
- include: ["name", "value"],
457
- showHeaders: false
458
- }
459
- )
460
- );
461
- console.log("", "");
462
- };
463
-
464
- export {
465
- LARGE_BUFFER,
466
- npmPublishExecutorFn
467
- };
@@ -1,96 +0,0 @@
1
- import {
2
- joinPaths
3
- } from "./chunk-U7JFVMCK.mjs";
4
-
5
- // src/utils/pnpm-deps-update.ts
6
- import { existsSync } from "node:fs";
7
- import { readFile, writeFile } from "node:fs/promises";
8
- import { format } from "prettier";
9
- import readYamlFile from "read-yaml-file";
10
- var pnpmCatalog;
11
- async function pnpmCatalogUpdate(packageRoot, workspaceRoot = process.cwd()) {
12
- if (!pnpmCatalog) {
13
- const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
14
- if (!existsSync(pnpmWorkspacePath)) {
15
- console.warn(
16
- `No \`pnpm-workspace.yaml\` file found in workspace root (searching in: ${pnpmWorkspacePath}). Skipping pnpm catalog read for now.`
17
- );
18
- return;
19
- }
20
- const pnpmWorkspaceYaml = await readYamlFile(pnpmWorkspacePath);
21
- console.info(
22
- `pnpmWorkspaceYaml: ${JSON.stringify(pnpmWorkspaceYaml ?? {})}`
23
- );
24
- if (pnpmWorkspaceYaml?.catalog) {
25
- pnpmCatalog = pnpmWorkspaceYaml.catalog;
26
- } else {
27
- console.warn(
28
- `Found a \`pnpm-workspace.yaml\` file in the workspace root directory, but no pnpm catalog existed:
29
- File name: ${pnpmWorkspacePath}
30
- File contents: ${pnpmWorkspaceYaml ? JSON.stringify(pnpmWorkspaceYaml) : "EMPTY FILE"}`
31
- );
32
- }
33
- }
34
- if (!pnpmCatalog) {
35
- console.warn(
36
- `No pnpm catalog found. Attempting to read from workspace root's \`pnpm-workspace.yaml\` file.`
37
- );
38
- }
39
- const packageJsonPath = joinPaths(packageRoot, "package.json");
40
- const packageJsonFile = await readFile(packageJsonPath, "utf8");
41
- if (!packageJsonFile) {
42
- throw new Error(
43
- "No package.json file found in package root: " + packageRoot
44
- );
45
- }
46
- const packageJson = JSON.parse(packageJsonFile);
47
- for (const dependencyType of [
48
- "dependencies",
49
- "devDependencies",
50
- "peerDependencies"
51
- ]) {
52
- const dependencies = packageJson[dependencyType];
53
- if (!dependencies) {
54
- continue;
55
- }
56
- for (const dependencyName of Object.keys(dependencies)) {
57
- if (dependencies[dependencyName] === "catalog:") {
58
- if (!pnpmCatalog) {
59
- throw new Error(
60
- `Dependency ${dependencyName} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`pnpm-workspace.yaml\` file.`
61
- );
62
- }
63
- const catalogVersion = pnpmCatalog[dependencyName];
64
- if (!catalogVersion) {
65
- throw new Error("Missing pnpm catalog version for " + dependencyName);
66
- }
67
- dependencies[dependencyName] = catalogVersion;
68
- } else if (dependencies[dependencyName].startsWith("catalog:")) {
69
- throw new Error("multiple named catalogs not supported");
70
- }
71
- }
72
- }
73
- return writeFile(
74
- packageJsonPath,
75
- await format(JSON.stringify(packageJson), {
76
- parser: "json",
77
- proseWrap: "always",
78
- trailingComma: "none",
79
- tabWidth: 2,
80
- semi: true,
81
- singleQuote: false,
82
- quoteProps: "as-needed",
83
- insertPragma: false,
84
- bracketSameLine: true,
85
- printWidth: 80,
86
- bracketSpacing: true,
87
- arrowParens: "avoid",
88
- endOfLine: "lf",
89
- plugins: ["prettier-plugin-pkg"]
90
- })
91
- );
92
- }
93
-
94
- export {
95
- pnpmCatalogUpdate
96
- };