@storm-software/workspace-tools 1.297.18 → 1.297.20

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 (90) hide show
  1. package/dist/{chunk-QNA6DMYD.mjs → chunk-2SBG5C7W.mjs} +1 -1
  2. package/dist/{chunk-7CXXQ3KC.js → chunk-I2HFAJPK.js} +118 -17
  3. package/dist/{chunk-22IAVE2Q.mjs → chunk-JBSWEDCZ.mjs} +1 -1
  4. package/dist/{chunk-HTBDZHCG.mjs → chunk-JZYF4DSL.mjs} +1 -1
  5. package/dist/{chunk-SQRDAISM.mjs → chunk-LGXT7X2B.mjs} +103 -2
  6. package/dist/{chunk-Q65223V2.mjs → chunk-MCLHT3FA.mjs} +1 -1
  7. package/dist/{chunk-ITYGFAJE.mjs → chunk-V4SED27K.mjs} +1 -1
  8. package/dist/{chunk-XZCDM7U7.mjs → chunk-YYQN5FVN.mjs} +1 -1
  9. package/dist/executors.js +3 -3
  10. package/dist/executors.mjs +6 -6
  11. package/dist/generators.mjs +5 -5
  12. package/dist/index.js +3 -3
  13. package/dist/index.mjs +10 -10
  14. package/dist/src/base/base-executor.mjs +1 -1
  15. package/dist/src/base/base-executor.untyped.mjs +1 -1
  16. package/dist/src/base/base-generator.mjs +1 -1
  17. package/dist/src/base/base-generator.untyped.mjs +1 -1
  18. package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
  19. package/dist/src/base/index.mjs +1 -1
  20. package/dist/src/base/typescript-build-executor.untyped.mjs +1 -1
  21. package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
  22. package/dist/src/executors/cargo-build/executor.mjs +1 -1
  23. package/dist/src/executors/cargo-build/untyped.mjs +1 -1
  24. package/dist/src/executors/cargo-check/executor.mjs +1 -1
  25. package/dist/src/executors/cargo-check/untyped.mjs +1 -1
  26. package/dist/src/executors/cargo-clippy/executor.mjs +1 -1
  27. package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
  28. package/dist/src/executors/cargo-doc/executor.mjs +1 -1
  29. package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
  30. package/dist/src/executors/cargo-format/executor.mjs +1 -1
  31. package/dist/src/executors/cargo-format/untyped.mjs +1 -1
  32. package/dist/src/executors/cargo-publish/executor.mjs +1 -1
  33. package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
  34. package/dist/src/executors/clean-package/executor.mjs +1 -1
  35. package/dist/src/executors/clean-package/untyped.mjs +1 -1
  36. package/dist/src/executors/command-publish/executor.mjs +1 -1
  37. package/dist/src/executors/command-publish/untyped.mjs +1 -1
  38. package/dist/src/executors/esbuild/executor.mjs +1 -1
  39. package/dist/src/executors/esbuild/untyped.mjs +1 -1
  40. package/dist/src/executors/napi/executor.mjs +1 -1
  41. package/dist/src/executors/napi/untyped.mjs +1 -1
  42. package/dist/src/executors/npm-publish/executor.js +2 -2
  43. package/dist/src/executors/npm-publish/executor.mjs +3 -3
  44. package/dist/src/executors/npm-publish/untyped.mjs +1 -1
  45. package/dist/src/executors/size-limit/executor.mjs +1 -1
  46. package/dist/src/executors/size-limit/untyped.mjs +1 -1
  47. package/dist/src/executors/tsdown/executor.mjs +1 -1
  48. package/dist/src/executors/tsdown/untyped.mjs +1 -1
  49. package/dist/src/executors/typia/executor.mjs +1 -1
  50. package/dist/src/executors/typia/untyped.mjs +1 -1
  51. package/dist/src/executors/unbuild/executor.mjs +1 -1
  52. package/dist/src/executors/unbuild/untyped.mjs +1 -1
  53. package/dist/src/generators/browser-library/generator.mjs +2 -2
  54. package/dist/src/generators/browser-library/untyped.mjs +1 -1
  55. package/dist/src/generators/config-schema/generator.mjs +1 -1
  56. package/dist/src/generators/config-schema/untyped.mjs +1 -1
  57. package/dist/src/generators/init/init.mjs +1 -1
  58. package/dist/src/generators/init/untyped.mjs +1 -1
  59. package/dist/src/generators/neutral-library/generator.mjs +2 -2
  60. package/dist/src/generators/neutral-library/untyped.mjs +1 -1
  61. package/dist/src/generators/node-library/generator.mjs +2 -2
  62. package/dist/src/generators/node-library/untyped.mjs +1 -1
  63. package/dist/src/generators/preset/generator.mjs +2 -2
  64. package/dist/src/generators/preset/untyped.mjs +1 -1
  65. package/dist/src/plugins/rust/cargo-toml.mjs +1 -1
  66. package/dist/src/plugins/rust/index.mjs +1 -1
  67. package/dist/src/plugins/typescript/index.mjs +1 -1
  68. package/dist/src/plugins/typescript/tsdown.mjs +1 -1
  69. package/dist/src/plugins/typescript/tsup.mjs +1 -1
  70. package/dist/src/plugins/typescript/untyped-schema.mjs +1 -1
  71. package/dist/src/release/index.mjs +1 -1
  72. package/dist/src/release/js-version-actions.mjs +1 -1
  73. package/dist/src/release/rust-version-actions.mjs +1 -1
  74. package/dist/src/types.mjs +1 -1
  75. package/dist/src/utils/apply-workspace-tokens.mjs +1 -1
  76. package/dist/src/utils/cargo.mjs +1 -1
  77. package/dist/src/utils/create-cli-options.mjs +1 -1
  78. package/dist/src/utils/get-project-configurations.mjs +1 -1
  79. package/dist/src/utils/github.mjs +2 -2
  80. package/dist/src/utils/index.mjs +2 -2
  81. package/dist/src/utils/lock-file.mjs +1 -1
  82. package/dist/src/utils/nx-json.mjs +1 -1
  83. package/dist/src/utils/package-helpers.mjs +1 -1
  84. package/dist/src/utils/package-manager.mjs +1 -1
  85. package/dist/src/utils/plugin-helpers.mjs +1 -1
  86. package/dist/src/utils/project-tags.mjs +1 -1
  87. package/dist/src/utils/registry-helpers.mjs +1 -1
  88. package/dist/src/utils/typia-transform.mjs +1 -1
  89. package/dist/src/utils/versions.mjs +1 -1
  90. package/package.json +13 -13
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-TBW5MCN6.mjs";
11
11
  import {
12
12
  __dirname
13
- } from "./chunk-22IAVE2Q.mjs";
13
+ } from "./chunk-JBSWEDCZ.mjs";
14
14
 
15
15
  // src/generators/neutral-library/generator.ts
16
16
  import {
@@ -21,6 +21,59 @@ var _child_process = require('child_process');
21
21
  var _promises = require('fs/promises');
22
22
  var _prettier = require('prettier');
23
23
  var _prettierpluginpackagejson = require('prettier-plugin-packagejson'); var _prettierpluginpackagejson2 = _interopRequireDefault(_prettierpluginpackagejson);
24
+
25
+ // src/executors/npm-publish/publish-status.ts
26
+ var PUBLISH_VISIBILITY_ATTEMPTS = 60;
27
+ var PUBLISH_VISIBILITY_INTERVAL_MS = 5e3;
28
+ function commandOutputToString(output) {
29
+ if (Buffer.isBuffer(output)) {
30
+ return output.toString();
31
+ }
32
+ return typeof output === "string" ? output : "";
33
+ }
34
+ function isPreviouslyStagedVersionError(error, version) {
35
+ const commandError = error;
36
+ const stdout = commandOutputToString(_optionalChain([commandError, 'optionalAccess', _ => _.stdout]));
37
+ const stderr = commandOutputToString(_optionalChain([commandError, 'optionalAccess', _2 => _2.stderr]));
38
+ let code = "";
39
+ let summary = "";
40
+ try {
41
+ const parsed = JSON.parse(stdout);
42
+ code = _optionalChain([parsed, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.code]) || "";
43
+ summary = _optionalChain([parsed, 'optionalAccess', _5 => _5.error, 'optionalAccess', _6 => _6.summary]) || "";
44
+ } catch (e) {
45
+ }
46
+ const output = `${code}
47
+ ${summary}
48
+ ${stdout}
49
+ ${stderr}`;
50
+ return output.includes("E409") && output.includes(`previously staged version "${version}"`);
51
+ }
52
+ async function waitForPublishedVersion({
53
+ version,
54
+ tag,
55
+ gitHead,
56
+ attempts = PUBLISH_VISIBILITY_ATTEMPTS,
57
+ intervalMs = PUBLISH_VISIBILITY_INTERVAL_MS,
58
+ getMetadata,
59
+ wait = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))
60
+ }) {
61
+ for (let attempt = 0; attempt < attempts; attempt++) {
62
+ try {
63
+ const metadata = await getMetadata();
64
+ if (metadata.version === version && _optionalChain([metadata, 'access', _7 => _7["dist-tags"], 'optionalAccess', _8 => _8[tag]]) === version && metadata.gitHead === gitHead) {
65
+ return true;
66
+ }
67
+ } catch (e2) {
68
+ }
69
+ if (attempt < attempts - 1) {
70
+ await wait(intervalMs);
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+
76
+ // src/executors/npm-publish/executor.ts
24
77
  var LARGE_BUFFER = 1024 * 1e6;
25
78
  async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
26
79
  if (packageManager === "bun") {
@@ -44,7 +97,7 @@ async function npmPublishExecutorFn(options, context) {
44
97
  github.error("The `npm-publish` executor requires a `projectName`.");
45
98
  return { success: false };
46
99
  }
47
- const projectConfig = _optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects, 'optionalAccess', _3 => _3[context.projectName]]);
100
+ const projectConfig = _optionalChain([context, 'access', _9 => _9.projectsConfigurations, 'optionalAccess', _10 => _10.projects, 'optionalAccess', _11 => _11[context.projectName]]);
48
101
  if (!projectConfig) {
49
102
  github.error(
50
103
  `Could not find project configuration for \`${context.projectName}\``
@@ -55,7 +108,7 @@ async function npmPublishExecutorFn(options, context) {
55
108
  context.root,
56
109
  options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
57
110
  );
58
- 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,
111
+ const projectRoot = _optionalChain([context, 'access', _12 => _12.projectsConfigurations, 'access', _13 => _13.projects, 'access', _14 => _14[context.projectName], 'optionalAccess', _15 => _15.root]) ? _chunkCQDBLKPFjs.joinPaths.call(void 0,
59
112
  context.root,
60
113
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
114
  context.projectsConfigurations.projects[context.projectName].root
@@ -130,6 +183,10 @@ async function npmPublishExecutorFn(options, context) {
130
183
  }
131
184
  await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
132
185
  await _chunkVXOPWQTJjs.addPackageJsonGitHead.call(void 0, packageRoot);
186
+ const publishPackageJson = JSON.parse(
187
+ await _promises.readFile.call(void 0, packageJsonPath, "utf8")
188
+ );
189
+ const currentVersion = options.version || packageJson.version;
133
190
  const npmPublishCommandSegments = [`npm publish --json`];
134
191
  const npmViewCommandSegments = [
135
192
  `npm view ${packageName} versions dist-tags --json`
@@ -172,8 +229,35 @@ async function npmPublishExecutorFn(options, context) {
172
229
  if (tag) {
173
230
  npmPublishCommandSegments.push(`--tag="${tag}" `);
174
231
  }
232
+ const npmViewPublishedVersionCommandSegments = [
233
+ `npm view ${packageName}@${currentVersion} version dist-tags gitHead --json`
234
+ ];
235
+ if (registry) {
236
+ npmViewPublishedVersionCommandSegments.push(`--registry="${registry}" `);
237
+ }
238
+ const waitForRegistryVisibility = () => waitForPublishedVersion({
239
+ version: currentVersion,
240
+ tag,
241
+ gitHead: publishPackageJson.gitHead,
242
+ getMetadata: () => {
243
+ const result = _child_process.execSync.call(void 0,
244
+ npmViewPublishedVersionCommandSegments.join(" "),
245
+ {
246
+ cwd: packageRoot,
247
+ env: {
248
+ NPM_ID_TOKEN: token,
249
+ ...process.env,
250
+ FORCE_COLOR: "true"
251
+ },
252
+ maxBuffer: LARGE_BUFFER,
253
+ killSignal: "SIGTERM"
254
+ }
255
+ );
256
+ const parsed = JSON.parse(result.toString());
257
+ return Array.isArray(parsed) ? parsed[parsed.length - 1] || {} : parsed;
258
+ }
259
+ });
175
260
  if (!isDryRun) {
176
- const currentVersion = options.version || packageJson.version;
177
261
  try {
178
262
  try {
179
263
  const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
@@ -235,34 +319,34 @@ Execution response: ${result.toString()}`
235
319
  return { success: true };
236
320
  } catch (err) {
237
321
  try {
238
- const stdoutData = JSON.parse(_optionalChain([err, 'access', _8 => _8.stdout, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]) || "{}");
239
- 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")]))) {
322
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _16 => _16.stdout, 'optionalAccess', _17 => _17.toString, 'call', _18 => _18()]) || "{}");
323
+ if (_optionalChain([stdoutData, 'optionalAccess', _19 => _19.error]) && !(_optionalChain([stdoutData, 'access', _20 => _20.error, 'optionalAccess', _21 => _21.code, 'optionalAccess', _22 => _22.includes, 'call', _23 => _23("E404")]) && _optionalChain([stdoutData, 'access', _24 => _24.error, 'optionalAccess', _25 => _25.summary, 'optionalAccess', _26 => _26.includes, 'call', _27 => _27("no such package available")])) && !(_optionalChain([err, 'access', _28 => _28.stderr, 'optionalAccess', _29 => _29.toString, 'call', _30 => _30(), 'access', _31 => _31.includes, 'call', _32 => _32("E404")]) && _optionalChain([err, 'access', _33 => _33.stderr, 'optionalAccess', _34 => _34.toString, 'call', _35 => _35(), 'access', _36 => _36.includes, 'call', _37 => _37("no such package available")]))) {
240
324
  const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
241
325
 
242
- ${_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])})` : ""}
243
- ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _38 => _38.error, 'optionalAccess', _39 => _39.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _40 => _40.error, 'optionalAccess', _41 => _41.detail])}
326
+ ${_optionalChain([stdoutData, 'optionalAccess', _38 => _38.error, 'optionalAccess', _39 => _39.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _40 => _40.error, 'optionalAccess', _41 => _41.summary])}${_optionalChain([stdoutData, 'optionalAccess', _42 => _42.error, 'optionalAccess', _43 => _43.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _44 => _44.error, 'optionalAccess', _45 => _45.code])})` : ""}
327
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _46 => _46.error, 'optionalAccess', _47 => _47.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _48 => _48.error, 'optionalAccess', _49 => _49.detail])}
244
328
  ` : ""}`;
245
329
  github.error(errorMessage);
246
330
  return { success: false };
247
331
  }
248
332
  } catch (err2) {
249
- const stdoutData = JSON.parse(_optionalChain([err2, 'access', _42 => _42.stdout, 'optionalAccess', _43 => _43.toString, 'call', _44 => _44()]) || "{}");
333
+ const stdoutData = JSON.parse(_optionalChain([err2, 'access', _50 => _50.stdout, 'optionalAccess', _51 => _51.toString, 'call', _52 => _52()]) || "{}");
250
334
  const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
251
335
 
252
- ${_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])})` : ""}
253
- ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _53 => _53.error, 'optionalAccess', _54 => _54.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _55 => _55.error, 'optionalAccess', _56 => _56.detail])}
336
+ ${_optionalChain([stdoutData, 'optionalAccess', _53 => _53.error, 'optionalAccess', _54 => _54.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _55 => _55.error, 'optionalAccess', _56 => _56.summary])}${_optionalChain([stdoutData, 'optionalAccess', _57 => _57.error, 'optionalAccess', _58 => _58.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _59 => _59.error, 'optionalAccess', _60 => _60.code])})` : ""}
337
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _61 => _61.error, 'optionalAccess', _62 => _62.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _63 => _63.error, 'optionalAccess', _64 => _64.detail])}
254
338
  ` : ""}`;
255
339
  github.error(errorMessage);
256
340
  return { success: false };
257
341
  }
258
342
  }
259
343
  } catch (err) {
260
- const stdoutData = JSON.parse(_optionalChain([err, 'access', _57 => _57.stdout, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]) || "{}");
261
- 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")]))) {
344
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _65 => _65.stdout, 'optionalAccess', _66 => _66.toString, 'call', _67 => _67()]) || "{}");
345
+ if (!(_optionalChain([stdoutData, 'access', _68 => _68.error, 'optionalAccess', _69 => _69.code, 'optionalAccess', _70 => _70.includes, 'call', _71 => _71("E404")]) && _optionalChain([stdoutData, 'access', _72 => _72.error, 'optionalAccess', _73 => _73.summary, 'optionalAccess', _74 => _74.toLowerCase, 'call', _75 => _75(), 'access', _76 => _76.includes, 'call', _77 => _77("not found")])) && !(_optionalChain([err, 'access', _78 => _78.stderr, 'optionalAccess', _79 => _79.toString, 'call', _80 => _80(), 'access', _81 => _81.includes, 'call', _82 => _82("E404")]) && _optionalChain([err, 'access', _83 => _83.stderr, 'optionalAccess', _84 => _84.toString, 'call', _85 => _85(), 'access', _86 => _86.toLowerCase, 'call', _87 => _87(), 'access', _88 => _88.includes, 'call', _89 => _89("not found")]))) {
262
346
  const errorMessage = `An unexpected error occured while checking for existing dist-tags:
263
347
 
264
- ${_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])})` : ""}
265
- ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _92 => _92.error, 'optionalAccess', _93 => _93.detail])}
348
+ ${_optionalChain([stdoutData, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _92 => _92.error, 'optionalAccess', _93 => _93.summary])}${_optionalChain([stdoutData, 'optionalAccess', _94 => _94.error, 'optionalAccess', _95 => _95.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _96 => _96.error, 'optionalAccess', _97 => _97.code])})` : ""}
349
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _98 => _98.error, 'optionalAccess', _99 => _99.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _100 => _100.error, 'optionalAccess', _101 => _101.detail])}
266
350
  ` : ""}`;
267
351
  github.error(errorMessage);
268
352
  return { success: false };
@@ -297,15 +381,32 @@ Execution response: ${result.toString()}` : ""}`
297
381
 
298
382
  Execution response: ${result.toString()}` : ""}`
299
383
  );
384
+ if (!await waitForRegistryVisibility()) {
385
+ github.error(
386
+ `npm publish completed, but ${packageName}@${currentVersion} did not become visible in ${registry} with tag "${tag}" before the processing timeout.`
387
+ );
388
+ return { success: false };
389
+ }
300
390
  }
301
391
  return { success: true };
302
392
  } catch (err) {
393
+ if (!isDryRun && isPreviouslyStagedVersionError(err, currentVersion)) {
394
+ console.warn(
395
+ `npm reported that ${packageName}@${currentVersion} was previously staged. Waiting for npm to finish processing the package.`
396
+ );
397
+ if (await waitForRegistryVisibility()) {
398
+ console.info(
399
+ `Confirmed ${packageName}@${currentVersion} is available in ${registry} with tag "${tag}" and the expected gitHead.`
400
+ );
401
+ return { success: true };
402
+ }
403
+ }
303
404
  try {
304
- const stdoutData = JSON.parse(_optionalChain([err, 'access', _94 => _94.stdout, 'optionalAccess', _95 => _95.toString, 'call', _96 => _96()]) || "{}");
405
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _102 => _102.stdout, 'optionalAccess', _103 => _103.toString, 'call', _104 => _104()]) || "{}");
305
406
  const errorMessage = `An error occurred while publishing the npm package:
306
407
 
307
- ${_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])})` : ""}
308
- ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _105 => _105.error, 'optionalAccess', _106 => _106.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _107 => _107.error, 'optionalAccess', _108 => _108.detail])}
408
+ ${_optionalChain([stdoutData, 'optionalAccess', _105 => _105.error, 'optionalAccess', _106 => _106.summary]) ? `Summary: ${_optionalChain([stdoutData, 'optionalAccess', _107 => _107.error, 'optionalAccess', _108 => _108.summary])}${_optionalChain([stdoutData, 'optionalAccess', _109 => _109.error, 'optionalAccess', _110 => _110.code]) ? ` (${_optionalChain([stdoutData, 'optionalAccess', _111 => _111.error, 'optionalAccess', _112 => _112.code])})` : ""}
409
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _113 => _113.error, 'optionalAccess', _114 => _114.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _115 => _115.error, 'optionalAccess', _116 => _116.detail])}
309
410
  ` : ""}`;
310
411
  github.error(errorMessage);
311
412
  return { success: false };
@@ -1,4 +1,4 @@
1
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=a9def7e06ce25c19654987ab91979289197bf4d3e7e124c514a4487c3e8d68c6__6aa2c7d0df74890dfada8e34d4fe5ff7/node_modules/tsup/assets/esm_shims.js
1
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=a9def7e06ce25c19654987ab91979289197bf4d3e7e124c514a4487c3e8d68c6__c2d17e3c915408e362a43028bd1d170e/node_modules/tsup/assets/esm_shims.js
2
2
  import { fileURLToPath } from "url";
3
3
  import path from "path";
4
4
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-TBW5MCN6.mjs";
4
4
  import {
5
5
  __filename
6
- } from "./chunk-22IAVE2Q.mjs";
6
+ } from "./chunk-JBSWEDCZ.mjs";
7
7
 
8
8
  // src/utils/github.ts
9
9
  import { createJiti } from "jiti";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EXRSULNO.mjs";
4
4
  import {
5
5
  getGitHubTools
6
- } from "./chunk-HTBDZHCG.mjs";
6
+ } from "./chunk-JZYF4DSL.mjs";
7
7
  import {
8
8
  addPackageJsonGitHead,
9
9
  stripPrivateWorkspaceDeps
@@ -21,6 +21,59 @@ import { execSync } from "node:child_process";
21
21
  import { readFile, writeFile } from "node:fs/promises";
22
22
  import { format } from "prettier";
23
23
  import prettierPlugin from "prettier-plugin-packagejson";
24
+
25
+ // src/executors/npm-publish/publish-status.ts
26
+ var PUBLISH_VISIBILITY_ATTEMPTS = 60;
27
+ var PUBLISH_VISIBILITY_INTERVAL_MS = 5e3;
28
+ function commandOutputToString(output) {
29
+ if (Buffer.isBuffer(output)) {
30
+ return output.toString();
31
+ }
32
+ return typeof output === "string" ? output : "";
33
+ }
34
+ function isPreviouslyStagedVersionError(error, version) {
35
+ const commandError = error;
36
+ const stdout = commandOutputToString(commandError?.stdout);
37
+ const stderr = commandOutputToString(commandError?.stderr);
38
+ let code = "";
39
+ let summary = "";
40
+ try {
41
+ const parsed = JSON.parse(stdout);
42
+ code = parsed?.error?.code || "";
43
+ summary = parsed?.error?.summary || "";
44
+ } catch {
45
+ }
46
+ const output = `${code}
47
+ ${summary}
48
+ ${stdout}
49
+ ${stderr}`;
50
+ return output.includes("E409") && output.includes(`previously staged version "${version}"`);
51
+ }
52
+ async function waitForPublishedVersion({
53
+ version,
54
+ tag,
55
+ gitHead,
56
+ attempts = PUBLISH_VISIBILITY_ATTEMPTS,
57
+ intervalMs = PUBLISH_VISIBILITY_INTERVAL_MS,
58
+ getMetadata,
59
+ wait = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))
60
+ }) {
61
+ for (let attempt = 0; attempt < attempts; attempt++) {
62
+ try {
63
+ const metadata = await getMetadata();
64
+ if (metadata.version === version && metadata["dist-tags"]?.[tag] === version && metadata.gitHead === gitHead) {
65
+ return true;
66
+ }
67
+ } catch {
68
+ }
69
+ if (attempt < attempts - 1) {
70
+ await wait(intervalMs);
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+
76
+ // src/executors/npm-publish/executor.ts
24
77
  var LARGE_BUFFER = 1024 * 1e6;
25
78
  async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
26
79
  if (packageManager === "bun") {
@@ -130,6 +183,10 @@ async function npmPublishExecutorFn(options, context) {
130
183
  }
131
184
  await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
132
185
  await addPackageJsonGitHead(packageRoot);
186
+ const publishPackageJson = JSON.parse(
187
+ await readFile(packageJsonPath, "utf8")
188
+ );
189
+ const currentVersion = options.version || packageJson.version;
133
190
  const npmPublishCommandSegments = [`npm publish --json`];
134
191
  const npmViewCommandSegments = [
135
192
  `npm view ${packageName} versions dist-tags --json`
@@ -172,8 +229,35 @@ async function npmPublishExecutorFn(options, context) {
172
229
  if (tag) {
173
230
  npmPublishCommandSegments.push(`--tag="${tag}" `);
174
231
  }
232
+ const npmViewPublishedVersionCommandSegments = [
233
+ `npm view ${packageName}@${currentVersion} version dist-tags gitHead --json`
234
+ ];
235
+ if (registry) {
236
+ npmViewPublishedVersionCommandSegments.push(`--registry="${registry}" `);
237
+ }
238
+ const waitForRegistryVisibility = () => waitForPublishedVersion({
239
+ version: currentVersion,
240
+ tag,
241
+ gitHead: publishPackageJson.gitHead,
242
+ getMetadata: () => {
243
+ const result = execSync(
244
+ npmViewPublishedVersionCommandSegments.join(" "),
245
+ {
246
+ cwd: packageRoot,
247
+ env: {
248
+ NPM_ID_TOKEN: token,
249
+ ...process.env,
250
+ FORCE_COLOR: "true"
251
+ },
252
+ maxBuffer: LARGE_BUFFER,
253
+ killSignal: "SIGTERM"
254
+ }
255
+ );
256
+ const parsed = JSON.parse(result.toString());
257
+ return Array.isArray(parsed) ? parsed[parsed.length - 1] || {} : parsed;
258
+ }
259
+ });
175
260
  if (!isDryRun) {
176
- const currentVersion = options.version || packageJson.version;
177
261
  try {
178
262
  try {
179
263
  const result = execSync(npmViewCommandSegments.join(" "), {
@@ -297,9 +381,26 @@ Execution response: ${result.toString()}` : ""}`
297
381
 
298
382
  Execution response: ${result.toString()}` : ""}`
299
383
  );
384
+ if (!await waitForRegistryVisibility()) {
385
+ github.error(
386
+ `npm publish completed, but ${packageName}@${currentVersion} did not become visible in ${registry} with tag "${tag}" before the processing timeout.`
387
+ );
388
+ return { success: false };
389
+ }
300
390
  }
301
391
  return { success: true };
302
392
  } catch (err) {
393
+ if (!isDryRun && isPreviouslyStagedVersionError(err, currentVersion)) {
394
+ console.warn(
395
+ `npm reported that ${packageName}@${currentVersion} was previously staged. Waiting for npm to finish processing the package.`
396
+ );
397
+ if (await waitForRegistryVisibility()) {
398
+ console.info(
399
+ `Confirmed ${packageName}@${currentVersion} is available in ${registry} with tag "${tag}" and the expected gitHead.`
400
+ );
401
+ return { success: true };
402
+ }
403
+ }
303
404
  try {
304
405
  const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
305
406
  const errorMessage = `An error occurred while publishing the npm package:
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-TBW5MCN6.mjs";
14
14
  import {
15
15
  __dirname
16
- } from "./chunk-22IAVE2Q.mjs";
16
+ } from "./chunk-JBSWEDCZ.mjs";
17
17
 
18
18
  // src/generators/node-library/generator.ts
19
19
  import {
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-TBW5MCN6.mjs";
11
11
  import {
12
12
  __dirname
13
- } from "./chunk-22IAVE2Q.mjs";
13
+ } from "./chunk-JBSWEDCZ.mjs";
14
14
 
15
15
  // src/generators/browser-library/generator.ts
16
16
  import {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-3G7TXYW2.mjs";
12
12
  import {
13
13
  __dirname
14
- } from "./chunk-22IAVE2Q.mjs";
14
+ } from "./chunk-JBSWEDCZ.mjs";
15
15
 
16
16
  // src/generators/preset/generator.ts
17
17
  import {
package/dist/executors.js CHANGED
@@ -8,7 +8,7 @@ var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
8
8
 
9
9
 
10
10
  var _chunkVKLLVYQ5js = require('./chunk-VKLLVYQ5.js');
11
- require('./chunk-7CXXQ3KC.js');
11
+ require('./chunk-I2HFAJPK.js');
12
12
 
13
13
 
14
14
  var _chunk65C6CGV3js = require('./chunk-65C6CGV3.js');
@@ -27,10 +27,10 @@ var _chunkN5LZIOWWjs = require('./chunk-N5LZIOWW.js');
27
27
  var _chunkIV2QQRXOjs = require('./chunk-IV2QQRXO.js');
28
28
 
29
29
 
30
- var _chunk6W7UEKUNjs = require('./chunk-6W7UEKUN.js');
30
+ var _chunkKDZH66U5js = require('./chunk-KDZH66U5.js');
31
31
 
32
32
 
33
- var _chunkKDZH66U5js = require('./chunk-KDZH66U5.js');
33
+ var _chunk6W7UEKUNjs = require('./chunk-6W7UEKUN.js');
34
34
 
35
35
 
36
36
  var _chunkXXCBFZB6js = require('./chunk-XXCBFZB6.js');
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  napiExecutor
10
10
  } from "./chunk-U6J67ZUE.mjs";
11
- import "./chunk-SQRDAISM.mjs";
11
+ import "./chunk-LGXT7X2B.mjs";
12
12
  import {
13
13
  sizeLimitExecutorFn
14
14
  } from "./chunk-I7RM7R7C.mjs";
@@ -25,12 +25,12 @@ import {
25
25
  import {
26
26
  cargoCheckExecutor
27
27
  } from "./chunk-36N55IVK.mjs";
28
- import {
29
- cargoDocExecutor
30
- } from "./chunk-HGU4RMLB.mjs";
31
28
  import {
32
29
  cargoClippyExecutor
33
30
  } from "./chunk-UZ25NC7M.mjs";
31
+ import {
32
+ cargoDocExecutor
33
+ } from "./chunk-HGU4RMLB.mjs";
34
34
  import {
35
35
  cargoFormatExecutor
36
36
  } from "./chunk-LYZ5ACPN.mjs";
@@ -39,7 +39,7 @@ import {
39
39
  } from "./chunk-XMATGAG4.mjs";
40
40
  import "./chunk-EXRSULNO.mjs";
41
41
  import "./chunk-C3G4MZGP.mjs";
42
- import "./chunk-HTBDZHCG.mjs";
42
+ import "./chunk-JZYF4DSL.mjs";
43
43
  import "./chunk-G4DPDEL3.mjs";
44
44
  import "./chunk-UA33NH5O.mjs";
45
45
  import "./chunk-2GQSCZ3J.mjs";
@@ -49,7 +49,7 @@ import "./chunk-I4KVL3GR.mjs";
49
49
  import "./chunk-45CW7OJB.mjs";
50
50
  import "./chunk-JUJWJXED.mjs";
51
51
  import "./chunk-TBW5MCN6.mjs";
52
- import "./chunk-22IAVE2Q.mjs";
52
+ import "./chunk-JBSWEDCZ.mjs";
53
53
  export {
54
54
  cargoBuildExecutor,
55
55
  cargoCheckExecutor,
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-437WGH2M.mjs";
5
5
  import {
6
6
  neutralLibraryGeneratorFn
7
- } from "./chunk-QNA6DMYD.mjs";
7
+ } from "./chunk-2SBG5C7W.mjs";
8
8
  import {
9
9
  nodeLibraryGeneratorFn
10
- } from "./chunk-Q65223V2.mjs";
10
+ } from "./chunk-MCLHT3FA.mjs";
11
11
  import {
12
12
  presetGeneratorFn
13
- } from "./chunk-XZCDM7U7.mjs";
13
+ } from "./chunk-YYQN5FVN.mjs";
14
14
  import {
15
15
  browserLibraryGeneratorFn
16
- } from "./chunk-ITYGFAJE.mjs";
16
+ } from "./chunk-V4SED27K.mjs";
17
17
  import {
18
18
  configSchemaGeneratorFn
19
19
  } from "./chunk-EYIUJSGD.mjs";
@@ -27,7 +27,7 @@ import "./chunk-I4KVL3GR.mjs";
27
27
  import "./chunk-45CW7OJB.mjs";
28
28
  import "./chunk-JUJWJXED.mjs";
29
29
  import "./chunk-TBW5MCN6.mjs";
30
- import "./chunk-22IAVE2Q.mjs";
30
+ import "./chunk-JBSWEDCZ.mjs";
31
31
  export {
32
32
  browserLibraryGeneratorFn,
33
33
  configSchemaGeneratorFn,
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ var _chunkZWUGCEBZjs = require('./chunk-ZWUGCEBZ.js');
52
52
 
53
53
 
54
54
  var _chunkVKLLVYQ5js = require('./chunk-VKLLVYQ5.js');
55
- require('./chunk-7CXXQ3KC.js');
55
+ require('./chunk-I2HFAJPK.js');
56
56
 
57
57
 
58
58
  var _chunk65C6CGV3js = require('./chunk-65C6CGV3.js');
@@ -71,10 +71,10 @@ var _chunkN5LZIOWWjs = require('./chunk-N5LZIOWW.js');
71
71
  var _chunkIV2QQRXOjs = require('./chunk-IV2QQRXO.js');
72
72
 
73
73
 
74
- var _chunk6W7UEKUNjs = require('./chunk-6W7UEKUN.js');
74
+ var _chunkKDZH66U5js = require('./chunk-KDZH66U5.js');
75
75
 
76
76
 
77
- var _chunkKDZH66U5js = require('./chunk-KDZH66U5.js');
77
+ var _chunk6W7UEKUNjs = require('./chunk-6W7UEKUN.js');
78
78
 
79
79
 
80
80
  var _chunkXXCBFZB6js = require('./chunk-XXCBFZB6.js');
package/dist/index.mjs CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  import {
53
53
  napiExecutor
54
54
  } from "./chunk-U6J67ZUE.mjs";
55
- import "./chunk-SQRDAISM.mjs";
55
+ import "./chunk-LGXT7X2B.mjs";
56
56
  import {
57
57
  sizeLimitExecutorFn
58
58
  } from "./chunk-I7RM7R7C.mjs";
@@ -69,12 +69,12 @@ import {
69
69
  import {
70
70
  cargoCheckExecutor
71
71
  } from "./chunk-36N55IVK.mjs";
72
- import {
73
- cargoDocExecutor
74
- } from "./chunk-HGU4RMLB.mjs";
75
72
  import {
76
73
  cargoClippyExecutor
77
74
  } from "./chunk-UZ25NC7M.mjs";
75
+ import {
76
+ cargoDocExecutor
77
+ } from "./chunk-HGU4RMLB.mjs";
78
78
  import {
79
79
  cargoFormatExecutor
80
80
  } from "./chunk-LYZ5ACPN.mjs";
@@ -99,7 +99,7 @@ import {
99
99
  } from "./chunk-C3G4MZGP.mjs";
100
100
  import {
101
101
  getGitHubTools
102
- } from "./chunk-HTBDZHCG.mjs";
102
+ } from "./chunk-JZYF4DSL.mjs";
103
103
  import {
104
104
  PackageManagerTypes,
105
105
  addPackageJsonGitHead,
@@ -113,16 +113,16 @@ import {
113
113
  } from "./chunk-437WGH2M.mjs";
114
114
  import {
115
115
  neutralLibraryGeneratorFn
116
- } from "./chunk-QNA6DMYD.mjs";
116
+ } from "./chunk-2SBG5C7W.mjs";
117
117
  import {
118
118
  nodeLibraryGeneratorFn
119
- } from "./chunk-Q65223V2.mjs";
119
+ } from "./chunk-MCLHT3FA.mjs";
120
120
  import {
121
121
  presetGeneratorFn
122
- } from "./chunk-XZCDM7U7.mjs";
122
+ } from "./chunk-YYQN5FVN.mjs";
123
123
  import {
124
124
  browserLibraryGeneratorFn
125
- } from "./chunk-ITYGFAJE.mjs";
125
+ } from "./chunk-V4SED27K.mjs";
126
126
  import {
127
127
  configSchemaGeneratorFn
128
128
  } from "./chunk-EYIUJSGD.mjs";
@@ -210,7 +210,7 @@ import "./chunk-TBW5MCN6.mjs";
210
210
  import {
211
211
  base_generator_untyped_default
212
212
  } from "./chunk-34LSWMWV.mjs";
213
- import "./chunk-22IAVE2Q.mjs";
213
+ import "./chunk-JBSWEDCZ.mjs";
214
214
  export {
215
215
  BUN_LOCK_FILE,
216
216
  BUN_LOCK_PATH,
@@ -6,7 +6,7 @@ import "../../chunk-I4KVL3GR.mjs";
6
6
  import "../../chunk-45CW7OJB.mjs";
7
7
  import "../../chunk-JUJWJXED.mjs";
8
8
  import "../../chunk-TBW5MCN6.mjs";
9
- import "../../chunk-22IAVE2Q.mjs";
9
+ import "../../chunk-JBSWEDCZ.mjs";
10
10
  export {
11
11
  withRunExecutor
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  base_executor_untyped_default
3
3
  } from "../../chunk-ZCTECGQS.mjs";
4
- import "../../chunk-22IAVE2Q.mjs";
4
+ import "../../chunk-JBSWEDCZ.mjs";
5
5
  export {
6
6
  base_executor_untyped_default as default
7
7
  };
@@ -6,7 +6,7 @@ import "../../chunk-I4KVL3GR.mjs";
6
6
  import "../../chunk-45CW7OJB.mjs";
7
7
  import "../../chunk-JUJWJXED.mjs";
8
8
  import "../../chunk-TBW5MCN6.mjs";
9
- import "../../chunk-22IAVE2Q.mjs";
9
+ import "../../chunk-JBSWEDCZ.mjs";
10
10
  export {
11
11
  withRunGenerator
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  base_generator_untyped_default
3
3
  } from "../../chunk-34LSWMWV.mjs";
4
- import "../../chunk-22IAVE2Q.mjs";
4
+ import "../../chunk-JBSWEDCZ.mjs";
5
5
  export {
6
6
  base_generator_untyped_default as default
7
7
  };