@storm-software/workspace-tools 1.296.79 → 1.296.84

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 (136) hide show
  1. package/README.md +1 -1
  2. package/config/base.json +13 -14
  3. package/config/recommended.json +17 -15
  4. package/dist/{chunk-SZWM7COV.js → chunk-3G7PNDZ5.js} +15 -2
  5. package/dist/{chunk-DHJTU33T.mjs → chunk-4RR3IGJL.mjs} +1 -1
  6. package/dist/chunk-5BGCA73V.mjs +39 -0
  7. package/dist/{chunk-3VIV3TF3.js → chunk-CSH4G6YP.js} +11 -5
  8. package/dist/{chunk-QC5ON3X4.mjs → chunk-DEHA5C77.mjs} +15 -2
  9. package/dist/{chunk-Q36BH543.mjs → chunk-E2PVUX2W.mjs} +25 -209
  10. package/dist/{chunk-YXDHTGAK.js → chunk-FETI3TYM.js} +47 -35
  11. package/dist/{chunk-TTXC4DHE.mjs → chunk-FQ7VZ2JR.mjs} +2 -2
  12. package/dist/{chunk-3OIXMEIT.mjs → chunk-G35OKYMG.mjs} +2 -2
  13. package/dist/{chunk-TM2CRDJW.js → chunk-HN5UXNLM.js} +33 -12
  14. package/dist/{chunk-KE2YNYTE.mjs → chunk-HU2ZYTZL.mjs} +45 -33
  15. package/dist/{chunk-2F7AZHRH.js → chunk-ILSI74FW.js} +49 -20
  16. package/dist/chunk-KSEB2U7B.js +318 -0
  17. package/dist/{chunk-2OVKSAE7.mjs → chunk-M7W3EPWR.mjs} +3 -3
  18. package/dist/{chunk-323C3SE6.js → chunk-MYALGFOC.js} +3 -3
  19. package/dist/chunk-OGB3BDE5.js +39 -0
  20. package/dist/{chunk-77B77QNY.mjs → chunk-VQYZG5YE.mjs} +33 -12
  21. package/dist/{chunk-NNDVMJGY.mjs → chunk-WTASIX7S.mjs} +17 -15
  22. package/dist/{chunk-R4GXDUM2.mjs → chunk-WU2HALDD.mjs} +11 -5
  23. package/dist/{chunk-WCUI5X7P.js → chunk-WYV2VL6T.js} +17 -15
  24. package/dist/{chunk-NTTC774E.mjs → chunk-XSHN3XHD.mjs} +39 -10
  25. package/dist/{chunk-EEMND2GI.js → chunk-ZM4LIWD4.js} +3 -3
  26. package/dist/{chunk-2R2MHEOI.js → chunk-ZO6ZPXB7.js} +5 -5
  27. package/dist/executors.js +12 -11
  28. package/dist/executors.mjs +15 -14
  29. package/dist/generators.js +10 -9
  30. package/dist/generators.mjs +10 -9
  31. package/dist/index.d.mts +4 -3
  32. package/dist/index.d.ts +4 -3
  33. package/dist/index.js +56 -30
  34. package/dist/index.mjs +63 -37
  35. package/dist/src/base/base-executor.mjs +1 -1
  36. package/dist/src/base/base-executor.untyped.mjs +1 -1
  37. package/dist/src/base/base-generator.mjs +1 -1
  38. package/dist/src/base/base-generator.untyped.mjs +1 -1
  39. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  40. package/dist/src/base/index.js +3 -3
  41. package/dist/src/base/index.mjs +3 -3
  42. package/dist/src/base/typescript-build-executor.untyped.mjs +1 -1
  43. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  44. package/dist/src/executors/cargo-build/executor.mjs +1 -1
  45. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  46. package/dist/src/executors/cargo-check/executor.mjs +1 -1
  47. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  48. package/dist/src/executors/cargo-clippy/executor.mjs +1 -1
  49. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  50. package/dist/src/executors/cargo-doc/executor.mjs +1 -1
  51. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  52. package/dist/src/executors/cargo-format/executor.mjs +1 -1
  53. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  54. package/dist/src/executors/cargo-publish/executor.mjs +1 -1
  55. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  56. package/dist/src/executors/clean-package/executor.mjs +1 -1
  57. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  58. package/dist/src/executors/esbuild/executor.mjs +1 -1
  59. package/dist/src/executors/esbuild/untyped.mjs +1 -1
  60. package/dist/src/executors/napi/executor.mjs +1 -1
  61. package/dist/src/executors/napi/untyped.mjs +1 -1
  62. package/dist/src/executors/npm-publish/executor.js +3 -2
  63. package/dist/src/executors/npm-publish/executor.mjs +3 -2
  64. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  65. package/dist/src/executors/size-limit/executor.mjs +1 -1
  66. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  67. package/dist/src/executors/tsdown/executor.mjs +1 -1
  68. package/dist/src/executors/tsdown/untyped.mjs +1 -1
  69. package/dist/src/executors/typia/executor.mjs +1 -1
  70. package/dist/src/executors/typia/untyped.mjs +1 -1
  71. package/dist/src/executors/unbuild/executor.mjs +1 -1
  72. package/dist/src/executors/unbuild/untyped.mjs +1 -1
  73. package/dist/src/generators/browser-library/generator.js +4 -4
  74. package/dist/src/generators/browser-library/generator.mjs +4 -4
  75. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  76. package/dist/src/generators/config-schema/generator.mjs +1 -1
  77. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  78. package/dist/src/generators/init/init.mjs +1 -1
  79. package/dist/src/generators/init/untyped.mjs +1 -1
  80. package/dist/src/generators/neutral-library/generator.js +4 -4
  81. package/dist/src/generators/neutral-library/generator.mjs +4 -4
  82. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  83. package/dist/src/generators/node-library/generator.js +4 -4
  84. package/dist/src/generators/node-library/generator.mjs +4 -4
  85. package/dist/src/generators/node-library/untyped.mjs +1 -1
  86. package/dist/src/generators/preset/generator.js +4 -3
  87. package/dist/src/generators/preset/generator.mjs +4 -3
  88. package/dist/src/generators/preset/untyped.mjs +1 -1
  89. package/dist/src/plugins/rust/cargo-toml.js +6 -2
  90. package/dist/src/plugins/rust/cargo-toml.mjs +6 -2
  91. package/dist/src/plugins/rust/index.js +6 -2
  92. package/dist/src/plugins/rust/index.mjs +6 -2
  93. package/dist/src/plugins/typescript/index.js +19 -14
  94. package/dist/src/plugins/typescript/index.mjs +21 -16
  95. package/dist/src/plugins/typescript/tsdown.js +16 -11
  96. package/dist/src/plugins/typescript/tsdown.mjs +17 -12
  97. package/dist/src/plugins/typescript/tsup.js +16 -11
  98. package/dist/src/plugins/typescript/tsup.mjs +17 -12
  99. package/dist/src/plugins/typescript/untyped-schema.js +15 -7
  100. package/dist/src/plugins/typescript/untyped-schema.mjs +16 -8
  101. package/dist/src/release/index.mjs +1 -1
  102. package/dist/src/release/js-version-actions.mjs +1 -1
  103. package/dist/src/release/rust-version-actions.mjs +1 -1
  104. package/dist/src/types.mjs +1 -1
  105. package/dist/src/utils/apply-workspace-tokens.mjs +1 -1
  106. package/dist/src/utils/cargo.mjs +1 -1
  107. package/dist/src/utils/create-cli-options.mjs +1 -1
  108. package/dist/src/utils/get-project-configurations.mjs +1 -1
  109. package/dist/src/utils/github.mjs +1 -1
  110. package/dist/src/utils/index.d.mts +4 -3
  111. package/dist/src/utils/index.d.ts +4 -3
  112. package/dist/src/utils/index.js +37 -10
  113. package/dist/src/utils/index.mjs +46 -19
  114. package/dist/src/utils/lock-file.d.mts +16 -4
  115. package/dist/src/utils/lock-file.d.ts +16 -4
  116. package/dist/src/utils/lock-file.js +12 -2
  117. package/dist/src/utils/lock-file.mjs +12 -2
  118. package/dist/src/utils/nx-json.js +2 -2
  119. package/dist/src/utils/nx-json.mjs +2 -2
  120. package/dist/src/utils/package-helpers.mjs +1 -1
  121. package/dist/src/utils/package-manager.d.mts +33 -0
  122. package/dist/src/utils/package-manager.d.ts +33 -0
  123. package/dist/src/utils/package-manager.js +14 -0
  124. package/dist/src/utils/package-manager.mjs +15 -0
  125. package/dist/src/utils/plugin-helpers.mjs +1 -1
  126. package/dist/src/utils/project-tags.mjs +1 -1
  127. package/dist/src/utils/registry-helpers.mjs +1 -1
  128. package/dist/src/utils/typia-transform.mjs +1 -1
  129. package/dist/src/utils/versions.d.mts +11 -2
  130. package/dist/src/utils/versions.d.ts +11 -2
  131. package/dist/src/utils/versions.js +10 -2
  132. package/dist/src/utils/versions.mjs +12 -4
  133. package/package.json +16 -11
  134. package/dist/chunk-F6U5OQR6.js +0 -502
  135. /package/dist/{chunk-DO2X7OZO.js → chunk-CVKUY5YY.js} +0 -0
  136. /package/dist/{chunk-XCVH63OO.mjs → chunk-QCN77EOQ.mjs} +0 -0
@@ -0,0 +1,318 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkOGB3BDE5js = require('./chunk-OGB3BDE5.js');
4
+
5
+
6
+ var _chunkMKJITWLNjs = require('./chunk-MKJITWLN.js');
7
+
8
+
9
+ var _chunk46OIJVV3js = require('./chunk-46OIJVV3.js');
10
+
11
+
12
+ var _chunk4ARF5MP2js = require('./chunk-4ARF5MP2.js');
13
+
14
+
15
+ var _chunkCQDBLKPFjs = require('./chunk-CQDBLKPF.js');
16
+
17
+ // src/executors/npm-publish/executor.ts
18
+ var _jiti = require('jiti');
19
+ var _child_process = require('child_process');
20
+ var _promises = require('fs/promises');
21
+ var _prettier = require('prettier');
22
+ var LARGE_BUFFER = 1024 * 1e6;
23
+ async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
24
+ if (packageManager === "bun") {
25
+ const { replaceDepsAliases: replaceBunDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/bun-tools"));
26
+ return replaceBunDepsAliases(packageRoot, workspaceRoot);
27
+ }
28
+ if (packageManager === "pnpm") {
29
+ const { replaceDepsAliases: replacePnpmDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/pnpm-tools"));
30
+ return replacePnpmDepsAliases(packageRoot, workspaceRoot);
31
+ }
32
+ }
33
+ async function npmPublishExecutorFn(options, context) {
34
+ const workspaceConfig = await _chunk4ARF5MP2js.getConfig.call(void 0, context.root);
35
+ const packageManager = await _chunkOGB3BDE5js.getWorkspacePackageManager.call(void 0,
36
+ context.root,
37
+ workspaceConfig
38
+ );
39
+ const github = await _chunkMKJITWLNjs.getGitHubTools.call(void 0, workspaceConfig);
40
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
41
+ if (!context.projectName) {
42
+ github.error("The `npm-publish` executor requires a `projectName`.");
43
+ return { success: false };
44
+ }
45
+ const projectConfig = _optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects, 'optionalAccess', _3 => _3[context.projectName]]);
46
+ if (!projectConfig) {
47
+ github.error(
48
+ `Could not find project configuration for \`${context.projectName}\``
49
+ );
50
+ return { success: false };
51
+ }
52
+ const packageRoot = _chunkCQDBLKPFjs.joinPaths.call(void 0,
53
+ context.root,
54
+ options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
55
+ );
56
+ const projectRoot = _optionalChain([context, 'access', _4 => _4.projectsConfigurations, 'access', _5 => _5.projects, 'access', _6 => _6[context.projectName], 'optionalAccess', _7 => _7.root]) ? _chunkCQDBLKPFjs.joinPaths.call(void 0,
57
+ context.root,
58
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59
+ context.projectsConfigurations.projects[context.projectName].root
60
+ ) : packageRoot;
61
+ const jiti = _jiti.createJiti.call(void 0, context.root, {
62
+ fsCache: _chunkCQDBLKPFjs.joinPaths.call(void 0, context.root, "node_modules/.cache/storm", "jiti"),
63
+ interopDefault: true
64
+ });
65
+ const { getNpmRegistry, getRegistry } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
66
+ const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
67
+ const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
68
+ if (!packageJsonFile) {
69
+ github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
70
+ return { success: false };
71
+ }
72
+ const packageJson = JSON.parse(packageJsonFile);
73
+ const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, projectRoot, "package.json");
74
+ const projectPackageJsonFile = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
75
+ if (!projectPackageJsonFile) {
76
+ github.error(
77
+ `Could not find \`package.json\` at ${projectPackageJsonPath}`
78
+ );
79
+ return { success: false };
80
+ }
81
+ const projectPackageJson = JSON.parse(projectPackageJsonFile);
82
+ if (packageJson.version !== projectPackageJson.version) {
83
+ console.warn(
84
+ `The version in the package.json file at ${packageJsonPath} (current: ${packageJson.version}) does not match the version in the package.json file at ${projectPackageJsonPath} (current: ${projectPackageJson.version}). This file will be updated to match the version in the project package.json file.`
85
+ );
86
+ if (projectPackageJson.version) {
87
+ packageJson.version = projectPackageJson.version;
88
+ await _promises.writeFile.call(void 0,
89
+ packageJsonPath,
90
+ await _prettier.format.call(void 0, JSON.stringify(packageJson), {
91
+ parser: "json",
92
+ proseWrap: "preserve",
93
+ trailingComma: "none",
94
+ tabWidth: 2,
95
+ semi: true,
96
+ singleQuote: false,
97
+ quoteProps: "as-needed",
98
+ insertPragma: false,
99
+ bracketSameLine: true,
100
+ printWidth: 80,
101
+ bracketSpacing: true,
102
+ arrowParens: "avoid",
103
+ endOfLine: "lf",
104
+ plugins: ["prettier-plugin-packagejson"]
105
+ })
106
+ );
107
+ }
108
+ }
109
+ const packageName = packageJson.name;
110
+ console.info(
111
+ `\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
112
+ );
113
+ const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
114
+ if (packageJson.private === true) {
115
+ console.warn(
116
+ `Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
117
+ );
118
+ return { success: true };
119
+ }
120
+ await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
121
+ await _chunk46OIJVV3js.addPackageJsonGitHead.call(void 0, packageRoot);
122
+ const npmPublishCommandSegments = [`npm publish --json`];
123
+ const npmViewCommandSegments = [
124
+ `npm view ${packageName} versions dist-tags --json`
125
+ ];
126
+ const registry = await Promise.resolve(
127
+ await _asyncNullishCoalesce(options.registry, async () => ( (await getRegistry() || getNpmRegistry())))
128
+ );
129
+ if (registry) {
130
+ npmPublishCommandSegments.push(`--registry="${registry}" `);
131
+ npmViewCommandSegments.push(`--registry="${registry}" `);
132
+ }
133
+ if (options.otp) {
134
+ npmPublishCommandSegments.push(`--otp="${options.otp}" `);
135
+ }
136
+ let token;
137
+ if (!options.otp && registry) {
138
+ token = await github.getIDToken(
139
+ `npm:${registry.replace(/^https?:\/\//, "")}`
140
+ );
141
+ if (!token) {
142
+ github.warning(
143
+ `Either a One time password (OTP) or an OpenID Connect (OIDC) token is generally required to publish ${packageTxt} to NPM. Usually the OIDC token should be provided automatically via GitHub Actions (see: https://github.com/actions/toolkit/tree/main/packages/core#oidc-token); however, the release process was unable to retrieve it. Please provide a \`otp\` executor option, or investigate why the OIDC token could not be retrieved.`
144
+ );
145
+ }
146
+ }
147
+ npmPublishCommandSegments.push("--provenance --access=public ");
148
+ if (isDryRun) {
149
+ npmPublishCommandSegments.push("--dry-run");
150
+ }
151
+ const tag = options.tag || _child_process.execSync.call(void 0, "npm config get tag", {
152
+ cwd: packageRoot,
153
+ env: {
154
+ NPM_ID_TOKEN: token,
155
+ ...process.env,
156
+ FORCE_COLOR: "true"
157
+ },
158
+ maxBuffer: LARGE_BUFFER,
159
+ killSignal: "SIGTERM"
160
+ }).toString().trim();
161
+ if (tag) {
162
+ npmPublishCommandSegments.push(`--tag="${tag}" `);
163
+ }
164
+ if (!isDryRun) {
165
+ const currentVersion = options.version || packageJson.version;
166
+ try {
167
+ try {
168
+ const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
169
+ cwd: packageRoot,
170
+ env: {
171
+ NPM_ID_TOKEN: token,
172
+ ...process.env,
173
+ FORCE_COLOR: "true"
174
+ },
175
+ maxBuffer: LARGE_BUFFER,
176
+ killSignal: "SIGTERM"
177
+ });
178
+ const resultJson = JSON.parse(result.toString());
179
+ const distTags = resultJson["dist-tags"] || {};
180
+ if (distTags[tag] === currentVersion) {
181
+ console.warn(
182
+ `Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
183
+ );
184
+ return { success: true };
185
+ }
186
+ } catch (err) {
187
+ console.debug(
188
+ `An error occurred while checking for existing dist-tags. Please note: if this is the first time this package has been published to npm, this can be ignored.
189
+
190
+ Error: ${JSON.stringify(
191
+ err,
192
+ null,
193
+ 2
194
+ )}`
195
+ );
196
+ }
197
+ try {
198
+ if (!isDryRun) {
199
+ const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
200
+ console.debug(
201
+ `Adding the dist-tag ${tag} - preparing to run the following: ${command}`
202
+ );
203
+ const result = _child_process.execSync.call(void 0, command, {
204
+ cwd: packageRoot,
205
+ env: {
206
+ NPM_ID_TOKEN: token,
207
+ ...process.env,
208
+ FORCE_COLOR: "true"
209
+ },
210
+ maxBuffer: LARGE_BUFFER,
211
+ killSignal: "SIGTERM"
212
+ });
213
+ console.info(
214
+ `Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
215
+
216
+ Execution response: ${result.toString()}`
217
+ );
218
+ } else {
219
+ console.info(
220
+ `Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
221
+ `
222
+ );
223
+ }
224
+ return { success: true };
225
+ } catch (err) {
226
+ try {
227
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _8 => _8.stdout, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]) || "{}");
228
+ if (_optionalChain([stdoutData, 'optionalAccess', _11 => _11.error]) && !(_optionalChain([stdoutData, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.code, 'optionalAccess', _14 => _14.includes, 'call', _15 => _15("E404")]) && _optionalChain([stdoutData, 'access', _16 => _16.error, 'optionalAccess', _17 => _17.summary, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19("no such package available")])) && !(_optionalChain([err, 'access', _20 => _20.stderr, 'optionalAccess', _21 => _21.toString, 'call', _22 => _22(), 'access', _23 => _23.includes, 'call', _24 => _24("E404")]) && _optionalChain([err, 'access', _25 => _25.stderr, 'optionalAccess', _26 => _26.toString, 'call', _27 => _27(), 'access', _28 => _28.includes, 'call', _29 => _29("no such package available")]))) {
229
+ const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
230
+
231
+ ${_optionalChain([stdoutData, 'optionalAccess', _30 => _30.error, 'optionalAccess', _31 => _31.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _32 => _32.error, 'optionalAccess', _33 => _33.summary])}${_optionalChain([stdoutData, 'optionalAccess', _34 => _34.error, 'optionalAccess', _35 => _35.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _36 => _36.error, 'optionalAccess', _37 => _37.code])})` : ""}
232
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _38 => _38.error, 'optionalAccess', _39 => _39.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _40 => _40.error, 'optionalAccess', _41 => _41.detail])}
233
+ ` : ""}`;
234
+ github.error(errorMessage);
235
+ return { success: false };
236
+ }
237
+ } catch (err2) {
238
+ const stdoutData = JSON.parse(_optionalChain([err2, 'access', _42 => _42.stdout, 'optionalAccess', _43 => _43.toString, 'call', _44 => _44()]) || "{}");
239
+ const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
240
+
241
+ ${_optionalChain([stdoutData, 'optionalAccess', _45 => _45.error, 'optionalAccess', _46 => _46.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _47 => _47.error, 'optionalAccess', _48 => _48.summary])}${_optionalChain([stdoutData, 'optionalAccess', _49 => _49.error, 'optionalAccess', _50 => _50.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _51 => _51.error, 'optionalAccess', _52 => _52.code])})` : ""}
242
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _53 => _53.error, 'optionalAccess', _54 => _54.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _55 => _55.error, 'optionalAccess', _56 => _56.detail])}
243
+ ` : ""}`;
244
+ github.error(errorMessage);
245
+ return { success: false };
246
+ }
247
+ }
248
+ } catch (err) {
249
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _57 => _57.stdout, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]) || "{}");
250
+ if (!(_optionalChain([stdoutData, 'access', _60 => _60.error, 'optionalAccess', _61 => _61.code, 'optionalAccess', _62 => _62.includes, 'call', _63 => _63("E404")]) && _optionalChain([stdoutData, 'access', _64 => _64.error, 'optionalAccess', _65 => _65.summary, 'optionalAccess', _66 => _66.toLowerCase, 'call', _67 => _67(), 'access', _68 => _68.includes, 'call', _69 => _69("not found")])) && !(_optionalChain([err, 'access', _70 => _70.stderr, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72(), 'access', _73 => _73.includes, 'call', _74 => _74("E404")]) && _optionalChain([err, 'access', _75 => _75.stderr, 'optionalAccess', _76 => _76.toString, 'call', _77 => _77(), 'access', _78 => _78.toLowerCase, 'call', _79 => _79(), 'access', _80 => _80.includes, 'call', _81 => _81("not found")]))) {
251
+ const errorMessage = `An unexpected error occured while checking for existing dist-tags:
252
+
253
+ ${_optionalChain([stdoutData, 'optionalAccess', _82 => _82.error, 'optionalAccess', _83 => _83.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _84 => _84.error, 'optionalAccess', _85 => _85.summary])}${_optionalChain([stdoutData, 'optionalAccess', _86 => _86.error, 'optionalAccess', _87 => _87.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _88 => _88.error, 'optionalAccess', _89 => _89.code])})` : ""}
254
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _92 => _92.error, 'optionalAccess', _93 => _93.detail])}
255
+ ` : ""}`;
256
+ github.error(errorMessage);
257
+ return { success: false };
258
+ }
259
+ }
260
+ }
261
+ try {
262
+ const cwd = packageRoot;
263
+ const command = npmPublishCommandSegments.join(" ");
264
+ console.info(
265
+ `Running publish command "${command}" in current working directory: "${cwd}" `
266
+ );
267
+ const result = _child_process.execSync.call(void 0, command, {
268
+ cwd,
269
+ env: {
270
+ NPM_ID_TOKEN: token,
271
+ ...process.env,
272
+ FORCE_COLOR: "true"
273
+ },
274
+ maxBuffer: LARGE_BUFFER,
275
+ killSignal: "SIGTERM"
276
+ });
277
+ if (isDryRun) {
278
+ console.info(
279
+ `Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
280
+
281
+ Execution response: ${result.toString()}` : ""}`
282
+ );
283
+ } else {
284
+ console.info(
285
+ `Published tag "${tag}" to ${registry}. ${result ? `
286
+
287
+ Execution response: ${result.toString()}` : ""}`
288
+ );
289
+ }
290
+ return { success: true };
291
+ } catch (err) {
292
+ try {
293
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _94 => _94.stdout, 'optionalAccess', _95 => _95.toString, 'call', _96 => _96()]) || "{}");
294
+ const errorMessage = `An error occurred while publishing the npm package:
295
+
296
+ ${_optionalChain([stdoutData, 'optionalAccess', _97 => _97.error, 'optionalAccess', _98 => _98.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _99 => _99.error, 'optionalAccess', _100 => _100.summary])}${_optionalChain([stdoutData, 'optionalAccess', _101 => _101.error, 'optionalAccess', _102 => _102.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _103 => _103.error, 'optionalAccess', _104 => _104.code])})` : ""}
297
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _105 => _105.error, 'optionalAccess', _106 => _106.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _107 => _107.error, 'optionalAccess', _108 => _108.detail])}
298
+ ` : ""}`;
299
+ github.error(errorMessage);
300
+ return { success: false };
301
+ } catch (err2) {
302
+ const errorMessage = `Something unexpected went wrong when processing the npm publish output.
303
+
304
+ Error: ${JSON.stringify(
305
+ Buffer.isBuffer(err2) ? err2.toString() : err2,
306
+ null,
307
+ 2
308
+ )}`;
309
+ github.error(errorMessage);
310
+ return { success: false };
311
+ }
312
+ }
313
+ }
314
+
315
+
316
+
317
+
318
+ exports.LARGE_BUFFER = LARGE_BUFFER; exports.npmPublishExecutorFn = npmPublishExecutorFn;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  normalizeOptions,
3
3
  typeScriptLibraryGeneratorFn
4
- } from "./chunk-NTTC774E.mjs";
4
+ } from "./chunk-XSHN3XHD.mjs";
5
5
  import {
6
6
  typesNodeVersion
7
- } from "./chunk-QC5ON3X4.mjs";
7
+ } from "./chunk-DEHA5C77.mjs";
8
8
  import {
9
9
  withRunGenerator
10
10
  } from "./chunk-Y5BPWYHW.mjs";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-TBW5MCN6.mjs";
14
14
  import {
15
15
  __dirname
16
- } from "./chunk-DHJTU33T.mjs";
16
+ } from "./chunk-4RR3IGJL.mjs";
17
17
 
18
18
  // src/generators/node-library/generator.ts
19
19
  import {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunk2F7AZHRHjs = require('./chunk-2F7AZHRH.js');
4
+ var _chunkILSI74FWjs = require('./chunk-ILSI74FW.js');
5
5
 
6
6
 
7
7
  var _chunkQSTZP7MXjs = require('./chunk-QSTZP7MX.js');
@@ -30,7 +30,7 @@ async function neutralLibraryGeneratorFn(tree, schema, config) {
30
30
  devDependencies: {},
31
31
  buildExecutor: "@storm-software/workspace-tools:unbuild"
32
32
  };
33
- const options = await _chunk2F7AZHRHjs.normalizeOptions.call(void 0, tree, tsLibraryGeneratorOptions);
33
+ const options = await _chunkILSI74FWjs.normalizeOptions.call(void 0, tree, tsLibraryGeneratorOptions);
34
34
  const { className, name, propertyName } = _devkit.names.call(void 0,
35
35
  options.projectNames.projectFileName
36
36
  );
@@ -50,7 +50,7 @@ async function neutralLibraryGeneratorFn(tree, schema, config) {
50
50
  buildable: options.bundler && options.bundler !== "none",
51
51
  hasUnitTestRunner: options.unitTestRunner !== "none"
52
52
  });
53
- await _chunk2F7AZHRHjs.typeScriptLibraryGeneratorFn.call(void 0, tree, tsLibraryGeneratorOptions, config);
53
+ await _chunkILSI74FWjs.typeScriptLibraryGeneratorFn.call(void 0, tree, tsLibraryGeneratorOptions, config);
54
54
  await _devkit.formatFiles.call(void 0, tree);
55
55
  return null;
56
56
  }
@@ -0,0 +1,39 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunk4ARF5MP2js = require('./chunk-4ARF5MP2.js');
4
+
5
+ // src/utils/package-manager.ts
6
+
7
+
8
+
9
+ var _devkit = require('@nx/devkit');
10
+ async function getWorkspacePackageManager(workspaceRoot, config) {
11
+ let packageManager = _optionalChain([config, 'optionalAccess', _ => _.packageManager]);
12
+ if (!packageManager) {
13
+ try {
14
+ packageManager = (await _chunk4ARF5MP2js.getConfig.call(void 0, workspaceRoot)).packageManager;
15
+ } catch (e) {
16
+ packageManager = void 0;
17
+ }
18
+ }
19
+ if (packageManager === "npm" || packageManager === "yarn" || packageManager === "pnpm" || packageManager === "bun") {
20
+ return packageManager;
21
+ }
22
+ return _devkit.detectPackageManager.call(void 0, workspaceRoot);
23
+ }
24
+ async function getWorkspacePackageManagerCommand(workspaceRoot, config) {
25
+ const packageManager = await getWorkspacePackageManager(
26
+ workspaceRoot,
27
+ config
28
+ );
29
+ return _devkit.getPackageManagerCommand.call(void 0, packageManager, workspaceRoot);
30
+ }
31
+ function getInstallCommand(packageManager) {
32
+ return _devkit.getPackageManagerCommand.call(void 0, packageManager).install;
33
+ }
34
+
35
+
36
+
37
+
38
+
39
+ exports.getWorkspacePackageManager = getWorkspacePackageManager; exports.getWorkspacePackageManagerCommand = getWorkspacePackageManagerCommand; exports.getInstallCommand = getInstallCommand;
@@ -21,10 +21,17 @@ import {
21
21
  var YARN_LOCK_FILE = "yarn.lock";
22
22
  var NPM_LOCK_FILE = "package-lock.json";
23
23
  var PNPM_LOCK_FILE = "pnpm-lock.yaml";
24
- var LOCK_FILES = [YARN_LOCK_FILE, NPM_LOCK_FILE, PNPM_LOCK_FILE];
24
+ var BUN_LOCK_FILE = "bun.lock";
25
+ var LOCK_FILES = [
26
+ YARN_LOCK_FILE,
27
+ NPM_LOCK_FILE,
28
+ PNPM_LOCK_FILE,
29
+ BUN_LOCK_FILE
30
+ ];
25
31
  var YARN_LOCK_PATH = join(workspaceRoot, YARN_LOCK_FILE);
26
32
  var NPM_LOCK_PATH = join(workspaceRoot, NPM_LOCK_FILE);
27
33
  var PNPM_LOCK_PATH = join(workspaceRoot, PNPM_LOCK_FILE);
34
+ var BUN_LOCK_PATH = join(workspaceRoot, BUN_LOCK_FILE);
28
35
  function getLockFileNodes(packageManager, contents, lockFileHash, context) {
29
36
  try {
30
37
  if (packageManager === "yarn") {
@@ -97,21 +104,30 @@ function lockFileExists(packageManager) {
97
104
  if (packageManager === "npm") {
98
105
  return existsSync(NPM_LOCK_PATH);
99
106
  }
107
+ if (packageManager === "bun") {
108
+ return existsSync(BUN_LOCK_PATH) || existsSync(join(workspaceRoot, "bun.lockb"));
109
+ }
100
110
  throw new Error(
101
111
  `Unknown package manager ${packageManager} or lock file missing`
102
112
  );
103
113
  }
114
+ var LOCK_FILE_BY_PACKAGE_MANAGER = {
115
+ npm: "package-lock.json",
116
+ yarn: "yarn.lock",
117
+ pnpm: "pnpm-lock.yaml",
118
+ bun: "bun.lock"
119
+ };
120
+ var OTHER_LOCK_FILES = {
121
+ npm: ["yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb"],
122
+ yarn: ["package-lock.json", "pnpm-lock.yaml", "bun.lock", "bun.lockb"],
123
+ pnpm: ["package-lock.json", "yarn.lock", "bun.lock", "bun.lockb"],
124
+ bun: ["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb"]
125
+ };
104
126
  function getLockFileName(packageManager) {
105
- if (packageManager === "yarn") {
106
- return YARN_LOCK_FILE;
107
- }
108
- if (packageManager === "pnpm") {
109
- return PNPM_LOCK_FILE;
110
- }
111
- if (packageManager === "npm") {
112
- return NPM_LOCK_FILE;
113
- }
114
- throw new Error(`Unknown package manager: ${packageManager}`);
127
+ return LOCK_FILE_BY_PACKAGE_MANAGER[packageManager];
128
+ }
129
+ function getOtherLockFileNames(packageManager) {
130
+ return OTHER_LOCK_FILES[packageManager];
115
131
  }
116
132
  function errorBodyLines(originalError, additionalInfo = []) {
117
133
  const result = [
@@ -137,12 +153,17 @@ export {
137
153
  YARN_LOCK_FILE,
138
154
  NPM_LOCK_FILE,
139
155
  PNPM_LOCK_FILE,
156
+ BUN_LOCK_FILE,
140
157
  LOCK_FILES,
141
158
  YARN_LOCK_PATH,
142
159
  NPM_LOCK_PATH,
143
160
  PNPM_LOCK_PATH,
161
+ BUN_LOCK_PATH,
144
162
  getLockFileNodes,
145
163
  getLockFileDependencies,
146
164
  lockFileExists,
147
- getLockFileName
165
+ LOCK_FILE_BY_PACKAGE_MANAGER,
166
+ OTHER_LOCK_FILES,
167
+ getLockFileName,
168
+ getOtherLockFileNames
148
169
  };
@@ -6,15 +6,12 @@ var recommended_default = {
6
6
  allProjectFiles: ["sharedGlobals", "{projectRoot}/**/*"],
7
7
  default: ["sharedGlobals", "{projectRoot}/**/*"],
8
8
  sharedGlobals: [
9
- "{workspaceRoot}/.github/workflows/*.yml",
10
- "{workspaceRoot}/assets/**/*",
11
9
  "{workspaceRoot}/tsconfig.json",
12
- "{workspaceRoot}/tsconfig.base.json",
10
+ "{workspaceRoot}/tsconfig.*.json",
13
11
  "{workspaceRoot}/.npm@(rc|ignore)",
14
12
  "{workspaceRoot}/package.json",
15
13
  "{workspaceRoot}/{pnpm-workspace,pnpm-lock,package-lock,yarn-lock}.@(yaml|yml)",
16
- "{workspaceRoot}/bun.lockb",
17
- "{workspaceRoot}/LICENSE",
14
+ "{workspaceRoot}/bun.lock{,b}",
18
15
  "{workspaceRoot}/.git@(attributes|ignore)",
19
16
  "{workspaceRoot}/{nx.json,.nxignore}",
20
17
  "{workspaceRoot}/storm-workspace{,.*}.@(json|yaml|toml)",
@@ -22,7 +19,6 @@ var recommended_default = {
22
19
  "{workspaceRoot}/storm-workspace.config.[jt]s",
23
20
  "{workspaceRoot}/.storm-workspace/config{,.*}.[jt]s",
24
21
  "{workspaceRoot}/devenv.@(lock|nix|yaml)",
25
- "{workspaceRoot}/{flake,shell,devShell}.nix",
26
22
  "{workspaceRoot}/.envrc",
27
23
  "{workspaceRoot}/.env{,.local,.*}"
28
24
  ],
@@ -129,14 +125,12 @@ var recommended_default = {
129
125
  "{workspaceRoot}/Cargo.lock",
130
126
  "{workspaceRoot}/.cargo/config.toml",
131
127
  "{workspaceRoot}/rust-toolchain",
132
- "{workspaceRoot}/rustfmt.toml",
133
- "{workspaceRoot}/deny.toml",
134
128
  "{projectRoot}/Cargo.toml",
135
129
  "{projectRoot}/.cargo/config.toml",
136
130
  {
137
131
  runtime: "node -p '`${process.platform}_${process.arch}`'"
138
132
  },
139
- "{projectRoot}/{project.json,CHANGELOG.md}",
133
+ "{projectRoot}/project.json",
140
134
  "{projectRoot}/.env{,.local}",
141
135
  "{projectRoot}/**/*.rs",
142
136
  "{projectRoot}/**/*.@(proto|acid|acidic|prisma)",
@@ -155,14 +149,22 @@ var recommended_default = {
155
149
  "{projectRoot}/package.json",
156
150
  "{projectRoot}/tsconfig.json",
157
151
  "{projectRoot}/tsconfig.*.json",
158
- "{projectRoot}/{project.json,README.md,CHANGELOG.md}",
152
+ "{projectRoot}/project.json",
159
153
  "{projectRoot}/.env{,.*}",
160
- "{projectRoot}/docs/**/*",
161
- "{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
154
+ "!{projectRoot}/docs/**/*",
155
+ "!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
162
156
  "{projectRoot}/**/*.@(proto|acid|acidic|prisma)",
163
157
  "{projectRoot}/src/**/*.@(cts|mts|ts|tsx|graphql|gql|js|cjs|mjs|jsx|json|jsonc|yaml|yml|toml|md|mdx)",
164
158
  "{projectRoot}/{build,tsup,tsdown,vite,contentlayer,powerlines,shell-shock,earthquake}.*.[jt]s?(x)",
165
159
  "{projectRoot}/{bin,tools,helpers,scripts}/**/*"
160
+ ],
161
+ ci: [
162
+ "sharedGlobals",
163
+ "{workspaceRoot}/.github/workflows/*.yml",
164
+ "{workspaceRoot}/assets/**/*",
165
+ "{workspaceRoot}/devenv.@(lock|nix|yaml)",
166
+ "{workspaceRoot}/.devenv{,.flake.nix}",
167
+ "{workspaceRoot}/.direnv"
166
168
  ]
167
169
  },
168
170
  targetDefaults: {
@@ -173,8 +175,8 @@ var recommended_default = {
173
175
  executor: "nx:run-commands",
174
176
  options: {
175
177
  commands: [
176
- "pnpm exec rimraf --glob {projectRoot}/dist",
177
- "pnpm exec rimraf dist/{projectRoot}"
178
+ "rimraf --glob {projectRoot}/dist",
179
+ "rimraf dist/{projectRoot}"
178
180
  ]
179
181
  }
180
182
  },
@@ -194,7 +196,7 @@ var recommended_default = {
194
196
  version: {
195
197
  currentVersionResolver: "git-tag",
196
198
  specifierSource: "conventional-commits",
197
- groupPreVersionCommand: "pnpm build",
199
+ groupPreVersionCommand: "build",
198
200
  manifestRootsToUpdate: [
199
201
  "{projectRoot}",
200
202
  {
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  getRoot
3
3
  } from "./chunk-K4QMCCQB.mjs";
4
+ import {
5
+ getWorkspacePackageManagerCommand
6
+ } from "./chunk-5BGCA73V.mjs";
4
7
  import {
5
8
  cargoMetadata,
6
9
  isExternal
@@ -33,6 +36,9 @@ var DefaultCargoPluginProfileMap = {
33
36
  var createNodesV2 = [
34
37
  "*/**/Cargo.toml",
35
38
  async (configFiles, options, context) => {
39
+ const { exec } = await getWorkspacePackageManagerCommand(
40
+ context.workspaceRoot
41
+ );
36
42
  return await createNodesFromFiles(
37
43
  (configFile, options2, context2) => {
38
44
  try {
@@ -97,7 +103,7 @@ var createNodesV2 = [
97
103
  dependsOn: ["^lint-markdown"],
98
104
  executor: "nx:run-commands",
99
105
  options: {
100
- command: 'pnpm exec markdownlint-cli2 "{projectRoot}/*.{md,mdx}" "{projectRoot}/**/*.{md,mdx}" --config "node_modules/@storm-software/markdownlint/config/recommended.markdownlint-cli2.jsonc" --fix'
106
+ command: `${exec} markdownlint-cli2 "{projectRoot}/*.{md,mdx}" "{projectRoot}/**/*.{md,mdx}" --config "node_modules/@storm-software/markdownlint/config/recommended.markdownlint-cli2.jsonc" --fix`
101
107
  }
102
108
  },
103
109
  "lint-ls": {
@@ -105,7 +111,7 @@ var createNodesV2 = [
105
111
  inputs: ["linting", "rust", "^production"],
106
112
  dependsOn: ["^lint-ls"],
107
113
  options: {
108
- command: 'pnpm exec ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/.ls-lint.yml" ',
114
+ command: `${exec} ls-lint --config="./node_modules/@storm-software/linting-tools/ls-lint/.ls-lint.yml" `,
109
115
  color: true
110
116
  }
111
117
  },
@@ -143,7 +149,7 @@ var createNodesV2 = [
143
149
  dependsOn: ["^format-readme"],
144
150
  executor: "nx:run-commands",
145
151
  options: {
146
- command: 'pnpm exec storm-git readme --templates="tools/readme-templates" --project="{projectName}"'
152
+ command: `${exec} storm-git readme --templates="tools/readme-templates" --project="{projectName}"`
147
153
  }
148
154
  },
149
155
  "format-toml": {
@@ -153,7 +159,7 @@ var createNodesV2 = [
153
159
  dependsOn: ["^format-toml"],
154
160
  executor: "nx:run-commands",
155
161
  options: {
156
- command: '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" '
162
+ command: `${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" `
157
163
  }
158
164
  },
159
165
  "format-clippy": {
@@ -191,7 +197,7 @@ var createNodesV2 = [
191
197
  outputs: [`{workspaceRoot}/dist/{projectRoot}/target`],
192
198
  executor: "nx:run-commands",
193
199
  options: {
194
- command: `pnpm exec rimraf dist/{projectRoot}/target`,
200
+ command: `${exec} rimraf dist/{projectRoot}/target`,
195
201
  color: true,
196
202
  cwd: "{workspaceRoot}"
197
203
  }