@storm-software/workspace-tools 1.296.110 → 1.296.112

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.
@@ -1,12 +1,12 @@
1
- import {
2
- getWorkspacePackageManager
3
- } from "./chunk-EXRSULNO.mjs";
4
1
  import {
5
2
  getGitHubTools
6
3
  } from "./chunk-54BBSJHK.mjs";
7
4
  import {
8
5
  addPackageJsonGitHead
9
- } from "./chunk-IDSDBOWW.mjs";
6
+ } from "./chunk-KD4DD3ZC.mjs";
7
+ import {
8
+ getWorkspacePackageManager
9
+ } from "./chunk-EXRSULNO.mjs";
10
10
  import {
11
11
  getConfig
12
12
  } from "./chunk-I4KVL3GR.mjs";
@@ -19,6 +19,7 @@ import { createJiti } from "jiti";
19
19
  import { execSync } from "node:child_process";
20
20
  import { readFile, writeFile } from "node:fs/promises";
21
21
  import { format } from "prettier";
22
+ import prettierPlugin from "prettier-plugin-packagejson";
22
23
  var LARGE_BUFFER = 1024 * 1e6;
23
24
  async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
24
25
  if (packageManager === "bun") {
@@ -101,7 +102,7 @@ async function npmPublishExecutorFn(options, context) {
101
102
  bracketSpacing: true,
102
103
  arrowParens: "avoid",
103
104
  endOfLine: "lf",
104
- plugins: ["prettier-plugin-packagejson"]
105
+ plugins: [prettierPlugin]
105
106
  })
106
107
  );
107
108
  }
@@ -94,7 +94,7 @@ async function presetGeneratorFn(tree, options) {
94
94
  type: "github",
95
95
  url: `${options.repositoryUrl}.git`
96
96
  };
97
- json.prettier = "@storm-software/prettier/config.json";
97
+ json.prettier = "@storm-software/prettier";
98
98
  json.nx ??= {
99
99
  includedScripts: [
100
100
  "lint-sherif",
@@ -19,6 +19,7 @@ import { existsSync } from "node:fs";
19
19
  import { readFile, writeFile } from "node:fs/promises";
20
20
  import { dirname, resolve } from "path";
21
21
  import { format } from "prettier";
22
+ import prettierPlugin from "prettier-plugin-packagejson";
22
23
  var PackageManagerTypes = {
23
24
  PackageJson: "package.json",
24
25
  CargoToml: "Cargo.toml"
@@ -81,7 +82,7 @@ async function addPackageJsonGitHead(packageRoot) {
81
82
  bracketSpacing: true,
82
83
  arrowParens: "avoid",
83
84
  endOfLine: "lf",
84
- plugins: ["prettier-plugin-packagejson"]
85
+ plugins: [prettierPlugin]
85
86
  })
86
87
  );
87
88
  }
@@ -97,7 +97,7 @@ async function presetGeneratorFn(tree, options) {
97
97
  type: "github",
98
98
  url: `${options.repositoryUrl}.git`
99
99
  };
100
- json.prettier = "@storm-software/prettier/config.json";
100
+ json.prettier = "@storm-software/prettier";
101
101
  json.nx ??= {
102
102
  includedScripts: [
103
103
  "lint-sherif",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
  var _chunkN2365RCIjs = require('./chunk-N2365RCI.js');
4
4
 
@@ -19,6 +19,7 @@ var _fs = require('fs');
19
19
  var _promises = require('fs/promises');
20
20
  var _path = require('path');
21
21
  var _prettier = require('prettier');
22
+ var _prettierpluginpackagejson = require('prettier-plugin-packagejson'); var _prettierpluginpackagejson2 = _interopRequireDefault(_prettierpluginpackagejson);
22
23
  var PackageManagerTypes = {
23
24
  PackageJson: "package.json",
24
25
  CargoToml: "Cargo.toml"
@@ -81,7 +82,7 @@ async function addPackageJsonGitHead(packageRoot) {
81
82
  bracketSpacing: true,
82
83
  arrowParens: "avoid",
83
84
  endOfLine: "lf",
84
- plugins: ["prettier-plugin-packagejson"]
85
+ plugins: [_prettierpluginpackagejson2.default]
85
86
  })
86
87
  );
87
88
  }
@@ -1,4 +1,4 @@
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; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
2
 
3
3
  var _chunk3MXZ2RJFjs = require('./chunk-3MXZ2RJF.js');
4
4
 
@@ -6,7 +6,7 @@ var _chunk3MXZ2RJFjs = require('./chunk-3MXZ2RJF.js');
6
6
  var _chunkMKJITWLNjs = require('./chunk-MKJITWLN.js');
7
7
 
8
8
 
9
- var _chunk46OIJVV3js = require('./chunk-46OIJVV3.js');
9
+ var _chunkR6QU3B53js = require('./chunk-R6QU3B53.js');
10
10
 
11
11
 
12
12
  var _chunkIMY2BU43js = require('./chunk-IMY2BU43.js');
@@ -19,6 +19,7 @@ var _jiti = require('jiti');
19
19
  var _child_process = require('child_process');
20
20
  var _promises = require('fs/promises');
21
21
  var _prettier = require('prettier');
22
+ var _prettierpluginpackagejson = require('prettier-plugin-packagejson'); var _prettierpluginpackagejson2 = _interopRequireDefault(_prettierpluginpackagejson);
22
23
  var LARGE_BUFFER = 1024 * 1e6;
23
24
  async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
24
25
  if (packageManager === "bun") {
@@ -101,7 +102,7 @@ async function npmPublishExecutorFn(options, context) {
101
102
  bracketSpacing: true,
102
103
  arrowParens: "avoid",
103
104
  endOfLine: "lf",
104
- plugins: ["prettier-plugin-packagejson"]
105
+ plugins: [_prettierpluginpackagejson2.default]
105
106
  })
106
107
  );
107
108
  }
@@ -118,7 +119,7 @@ async function npmPublishExecutorFn(options, context) {
118
119
  return { success: true };
119
120
  }
120
121
  await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
121
- await _chunk46OIJVV3js.addPackageJsonGitHead.call(void 0, packageRoot);
122
+ await _chunkR6QU3B53js.addPackageJsonGitHead.call(void 0, packageRoot);
122
123
  const npmPublishCommandSegments = [`npm publish --json`];
123
124
  const npmViewCommandSegments = [
124
125
  `npm view ${packageName} versions dist-tags --json`
@@ -0,0 +1,319 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkMKJITWLNjs = require('./chunk-MKJITWLN.js');
4
+
5
+
6
+ var _chunkR6QU3B53js = require('./chunk-R6QU3B53.js');
7
+
8
+
9
+ var _chunk3MXZ2RJFjs = require('./chunk-3MXZ2RJF.js');
10
+
11
+
12
+ var _chunkIMY2BU43js = require('./chunk-IMY2BU43.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 _prettierpluginpackagejson = require('prettier-plugin-packagejson'); var _prettierpluginpackagejson2 = _interopRequireDefault(_prettierpluginpackagejson);
23
+ var LARGE_BUFFER = 1024 * 1e6;
24
+ async function replaceDepsAliases(jiti, packageRoot, workspaceRoot, packageManager) {
25
+ if (packageManager === "bun") {
26
+ const { replaceDepsAliases: replaceBunDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/bun-tools"));
27
+ return replaceBunDepsAliases(packageRoot, workspaceRoot);
28
+ }
29
+ if (packageManager === "pnpm") {
30
+ const { replaceDepsAliases: replacePnpmDepsAliases } = await jiti.import(jiti.esmResolve("@storm-software/pnpm-tools"));
31
+ return replacePnpmDepsAliases(packageRoot, workspaceRoot);
32
+ }
33
+ }
34
+ async function npmPublishExecutorFn(options, context) {
35
+ const workspaceConfig = await _chunkIMY2BU43js.getConfig.call(void 0, context.root);
36
+ const packageManager = await _chunk3MXZ2RJFjs.getWorkspacePackageManager.call(void 0,
37
+ context.root,
38
+ workspaceConfig
39
+ );
40
+ const github = await _chunkMKJITWLNjs.getGitHubTools.call(void 0, workspaceConfig);
41
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
42
+ if (!context.projectName) {
43
+ github.error("The `npm-publish` executor requires a `projectName`.");
44
+ return { success: false };
45
+ }
46
+ const projectConfig = _optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects, 'optionalAccess', _3 => _3[context.projectName]]);
47
+ if (!projectConfig) {
48
+ github.error(
49
+ `Could not find project configuration for \`${context.projectName}\``
50
+ );
51
+ return { success: false };
52
+ }
53
+ const packageRoot = _chunkCQDBLKPFjs.joinPaths.call(void 0,
54
+ context.root,
55
+ options.packageRoot || _chunkCQDBLKPFjs.joinPaths.call(void 0, "dist", projectConfig.root)
56
+ );
57
+ 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,
58
+ context.root,
59
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
60
+ context.projectsConfigurations.projects[context.projectName].root
61
+ ) : packageRoot;
62
+ const jiti = _jiti.createJiti.call(void 0, context.root, {
63
+ fsCache: _chunkCQDBLKPFjs.joinPaths.call(void 0, context.root, "node_modules/.cache/storm", "jiti"),
64
+ interopDefault: true
65
+ });
66
+ const { getNpmRegistry, getRegistry } = await jiti.import(jiti.esmResolve("@storm-software/npm-tools/helpers"));
67
+ const packageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, packageRoot, "package.json");
68
+ const packageJsonFile = await _promises.readFile.call(void 0, packageJsonPath, "utf8");
69
+ if (!packageJsonFile) {
70
+ github.error(`Could not find \`package.json\` at ${packageJsonPath}`);
71
+ return { success: false };
72
+ }
73
+ const packageJson = JSON.parse(packageJsonFile);
74
+ const projectPackageJsonPath = _chunkCQDBLKPFjs.joinPaths.call(void 0, projectRoot, "package.json");
75
+ const projectPackageJsonFile = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
76
+ if (!projectPackageJsonFile) {
77
+ github.error(
78
+ `Could not find \`package.json\` at ${projectPackageJsonPath}`
79
+ );
80
+ return { success: false };
81
+ }
82
+ const projectPackageJson = JSON.parse(projectPackageJsonFile);
83
+ if (packageJson.version !== projectPackageJson.version) {
84
+ console.warn(
85
+ `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.`
86
+ );
87
+ if (projectPackageJson.version) {
88
+ packageJson.version = projectPackageJson.version;
89
+ await _promises.writeFile.call(void 0,
90
+ packageJsonPath,
91
+ await _prettier.format.call(void 0, JSON.stringify(packageJson), {
92
+ parser: "json",
93
+ proseWrap: "preserve",
94
+ trailingComma: "none",
95
+ tabWidth: 2,
96
+ semi: true,
97
+ singleQuote: false,
98
+ quoteProps: "as-needed",
99
+ insertPragma: false,
100
+ bracketSameLine: true,
101
+ printWidth: 80,
102
+ bracketSpacing: true,
103
+ arrowParens: "avoid",
104
+ endOfLine: "lf",
105
+ plugins: [_prettierpluginpackagejson2.default]
106
+ })
107
+ );
108
+ }
109
+ }
110
+ const packageName = packageJson.name;
111
+ console.info(
112
+ `\u{1F680} Running Storm NPM Publish executor on the ${packageName} package`
113
+ );
114
+ const packageTxt = packageName === context.projectName ? `package "${packageName}"` : `package "${packageName}" from project "${context.projectName}"`;
115
+ if (packageJson.private === true) {
116
+ console.warn(
117
+ `Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
118
+ );
119
+ return { success: true };
120
+ }
121
+ await replaceDepsAliases(jiti, packageRoot, context.root, packageManager);
122
+ await _chunkR6QU3B53js.addPackageJsonGitHead.call(void 0, packageRoot);
123
+ const npmPublishCommandSegments = [`npm publish --json`];
124
+ const npmViewCommandSegments = [
125
+ `npm view ${packageName} versions dist-tags --json`
126
+ ];
127
+ const registry = await Promise.resolve(
128
+ await _asyncNullishCoalesce(options.registry, async () => ( (await getRegistry() || getNpmRegistry())))
129
+ );
130
+ if (registry) {
131
+ npmPublishCommandSegments.push(`--registry="${registry}" `);
132
+ npmViewCommandSegments.push(`--registry="${registry}" `);
133
+ }
134
+ if (options.otp) {
135
+ npmPublishCommandSegments.push(`--otp="${options.otp}" `);
136
+ }
137
+ let token;
138
+ if (!options.otp && registry) {
139
+ token = await github.getIDToken(
140
+ `npm:${registry.replace(/^https?:\/\//, "")}`
141
+ );
142
+ if (!token) {
143
+ github.warning(
144
+ `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.`
145
+ );
146
+ }
147
+ }
148
+ npmPublishCommandSegments.push("--provenance --access=public ");
149
+ if (isDryRun) {
150
+ npmPublishCommandSegments.push("--dry-run");
151
+ }
152
+ const tag = options.tag || _child_process.execSync.call(void 0, "npm config get tag", {
153
+ cwd: packageRoot,
154
+ env: {
155
+ NPM_ID_TOKEN: token,
156
+ ...process.env,
157
+ FORCE_COLOR: "true"
158
+ },
159
+ maxBuffer: LARGE_BUFFER,
160
+ killSignal: "SIGTERM"
161
+ }).toString().trim();
162
+ if (tag) {
163
+ npmPublishCommandSegments.push(`--tag="${tag}" `);
164
+ }
165
+ if (!isDryRun) {
166
+ const currentVersion = options.version || packageJson.version;
167
+ try {
168
+ try {
169
+ const result = _child_process.execSync.call(void 0, npmViewCommandSegments.join(" "), {
170
+ cwd: packageRoot,
171
+ env: {
172
+ NPM_ID_TOKEN: token,
173
+ ...process.env,
174
+ FORCE_COLOR: "true"
175
+ },
176
+ maxBuffer: LARGE_BUFFER,
177
+ killSignal: "SIGTERM"
178
+ });
179
+ const resultJson = JSON.parse(result.toString());
180
+ const distTags = resultJson["dist-tags"] || {};
181
+ if (distTags[tag] === currentVersion) {
182
+ console.warn(
183
+ `Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
184
+ );
185
+ return { success: true };
186
+ }
187
+ } catch (err) {
188
+ console.debug(
189
+ `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.
190
+
191
+ Error: ${JSON.stringify(
192
+ err,
193
+ null,
194
+ 2
195
+ )}`
196
+ );
197
+ }
198
+ try {
199
+ if (!isDryRun) {
200
+ const command = `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry="${registry}" `;
201
+ console.debug(
202
+ `Adding the dist-tag ${tag} - preparing to run the following: ${command}`
203
+ );
204
+ const result = _child_process.execSync.call(void 0, command, {
205
+ cwd: packageRoot,
206
+ env: {
207
+ NPM_ID_TOKEN: token,
208
+ ...process.env,
209
+ FORCE_COLOR: "true"
210
+ },
211
+ maxBuffer: LARGE_BUFFER,
212
+ killSignal: "SIGTERM"
213
+ });
214
+ console.info(
215
+ `Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
216
+
217
+ Execution response: ${result.toString()}`
218
+ );
219
+ } else {
220
+ console.info(
221
+ `Would have added the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
222
+ `
223
+ );
224
+ }
225
+ return { success: true };
226
+ } catch (err) {
227
+ try {
228
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _8 => _8.stdout, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]) || "{}");
229
+ 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")]))) {
230
+ const errorMessage = `An unexpected error occured while running the npm dist-tag add command:
231
+
232
+ ${_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])})` : ""}
233
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _38 => _38.error, 'optionalAccess', _39 => _39.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _40 => _40.error, 'optionalAccess', _41 => _41.detail])}
234
+ ` : ""}`;
235
+ github.error(errorMessage);
236
+ return { success: false };
237
+ }
238
+ } catch (err2) {
239
+ const stdoutData = JSON.parse(_optionalChain([err2, 'access', _42 => _42.stdout, 'optionalAccess', _43 => _43.toString, 'call', _44 => _44()]) || "{}");
240
+ const errorMessage = `An unexpected error occured while processing the npm dist-tag add output:
241
+
242
+ ${_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])})` : ""}
243
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _53 => _53.error, 'optionalAccess', _54 => _54.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _55 => _55.error, 'optionalAccess', _56 => _56.detail])}
244
+ ` : ""}`;
245
+ github.error(errorMessage);
246
+ return { success: false };
247
+ }
248
+ }
249
+ } catch (err) {
250
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _57 => _57.stdout, 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()]) || "{}");
251
+ 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")]))) {
252
+ const errorMessage = `An unexpected error occured while checking for existing dist-tags:
253
+
254
+ ${_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])})` : ""}
255
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _92 => _92.error, 'optionalAccess', _93 => _93.detail])}
256
+ ` : ""}`;
257
+ github.error(errorMessage);
258
+ return { success: false };
259
+ }
260
+ }
261
+ }
262
+ try {
263
+ const cwd = packageRoot;
264
+ const command = npmPublishCommandSegments.join(" ");
265
+ console.info(
266
+ `Running publish command "${command}" in current working directory: "${cwd}" `
267
+ );
268
+ const result = _child_process.execSync.call(void 0, command, {
269
+ cwd,
270
+ env: {
271
+ NPM_ID_TOKEN: token,
272
+ ...process.env,
273
+ FORCE_COLOR: "true"
274
+ },
275
+ maxBuffer: LARGE_BUFFER,
276
+ killSignal: "SIGTERM"
277
+ });
278
+ if (isDryRun) {
279
+ console.info(
280
+ `Would publish tag "${tag}" to ${registry}, but [dry-run] was set. ${result ? `
281
+
282
+ Execution response: ${result.toString()}` : ""}`
283
+ );
284
+ } else {
285
+ console.info(
286
+ `Published tag "${tag}" to ${registry}. ${result ? `
287
+
288
+ Execution response: ${result.toString()}` : ""}`
289
+ );
290
+ }
291
+ return { success: true };
292
+ } catch (err) {
293
+ try {
294
+ const stdoutData = JSON.parse(_optionalChain([err, 'access', _94 => _94.stdout, 'optionalAccess', _95 => _95.toString, 'call', _96 => _96()]) || "{}");
295
+ const errorMessage = `An error occurred while publishing the npm package:
296
+
297
+ ${_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])})` : ""}
298
+ ` : ""}${_optionalChain([stdoutData, 'optionalAccess', _105 => _105.error, 'optionalAccess', _106 => _106.detail]) ? `Detail: ${_optionalChain([stdoutData, 'optionalAccess', _107 => _107.error, 'optionalAccess', _108 => _108.detail])}
299
+ ` : ""}`;
300
+ github.error(errorMessage);
301
+ return { success: false };
302
+ } catch (err2) {
303
+ const errorMessage = `Something unexpected went wrong when processing the npm publish output.
304
+
305
+ Error: ${JSON.stringify(
306
+ Buffer.isBuffer(err2) ? err2.toString() : err2,
307
+ null,
308
+ 2
309
+ )}`;
310
+ github.error(errorMessage);
311
+ return { success: false };
312
+ }
313
+ }
314
+ }
315
+
316
+
317
+
318
+
319
+ exports.LARGE_BUFFER = LARGE_BUFFER; exports.npmPublishExecutorFn = npmPublishExecutorFn;