@storm-software/workspace-tools 1.90.0 → 1.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // packages/workspace-tools/src/executors/npm-publish/executor.ts
20
20
  var executor_exports = {};
21
21
  __export(executor_exports, {
22
+ LARGE_BUFFER: () => LARGE_BUFFER,
22
23
  default: () => npmPublishExecutorFn
23
24
  });
24
25
  module.exports = __toCommonJS(executor_exports);
@@ -51,13 +52,21 @@ async function npmPublishExecutorFn(options, context) {
51
52
  console.warn(
52
53
  `Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`
53
54
  );
54
- return new Promise((resolve) => resolve({ success: true }));
55
+ return { success: true };
55
56
  }
56
57
  const npmPublishCommandSegments = ["npm publish --json"];
57
58
  const npmViewCommandSegments = [
58
59
  `npm view ${packageName} versions dist-tags --json`
59
60
  ];
60
- const registry = options.registry ? options.registry : (0, import_node_child_process.execSync)("npm config get registry").toString().trim();
61
+ const registry = options.registry ? options.registry : (0, import_node_child_process.execSync)("npm config get registry", {
62
+ cwd: packageRoot,
63
+ env: {
64
+ ...process.env,
65
+ FORCE_COLOR: "true"
66
+ },
67
+ maxBuffer: LARGE_BUFFER,
68
+ killSignal: "SIGTERM"
69
+ }).toString().trim();
61
70
  if (registry) {
62
71
  npmPublishCommandSegments.push(`--registry=${registry}`);
63
72
  npmViewCommandSegments.push(`--registry=${registry}`);
@@ -72,18 +81,27 @@ async function npmPublishExecutorFn(options, context) {
72
81
  npmPublishCommandSegments.push("--dry-run");
73
82
  }
74
83
  npmPublishCommandSegments.push("--provenance --access public");
75
- const tag = options.tag ?? (0, import_node_child_process.execSync)("npm config get tag").toString().trim();
84
+ const tag = options.tag ?? (0, import_node_child_process.execSync)("npm config get tag", {
85
+ cwd: packageRoot,
86
+ env: {
87
+ ...process.env,
88
+ FORCE_COLOR: "true"
89
+ },
90
+ maxBuffer: LARGE_BUFFER,
91
+ killSignal: "SIGTERM"
92
+ }).toString().trim();
76
93
  if (!isDryRun) {
77
94
  const currentVersion = projectPackageJson.version;
78
95
  try {
79
96
  try {
80
97
  const result = (0, import_node_child_process.execSync)(npmViewCommandSegments.join(" "), {
98
+ cwd: packageRoot,
81
99
  env: {
82
100
  ...process.env,
83
101
  FORCE_COLOR: "true"
84
102
  },
85
- cwd: packageRoot,
86
- stdio: ["ignore", "pipe", "pipe"]
103
+ maxBuffer: LARGE_BUFFER,
104
+ killSignal: "SIGTERM"
87
105
  });
88
106
  const resultJson = JSON.parse(result.toString());
89
107
  const distTags = resultJson["dist-tags"] || {};
@@ -91,54 +109,54 @@ async function npmPublishExecutorFn(options, context) {
91
109
  console.warn(
92
110
  `Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`
93
111
  );
94
- return new Promise((resolve) => resolve({ success: true }));
112
+ return { success: true };
95
113
  }
96
114
  } catch (err) {
115
+ console.warn("\n ********************** \n");
97
116
  console.warn(
98
117
  `An error occurred while checking for existing dist-tags
99
- ${err}
118
+ ${JSON.stringify(err)}
100
119
 
101
120
  Note: If this is the first time this package has been published to NPM, this can be ignored.`
102
121
  );
103
- console.log("");
122
+ console.info("");
104
123
  }
105
124
  try {
106
125
  if (!isDryRun) {
107
126
  (0, import_node_child_process.execSync)(
108
127
  `npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry=${registry}`,
109
128
  {
129
+ cwd: packageRoot,
110
130
  env: {
111
131
  ...process.env,
112
132
  FORCE_COLOR: "true"
113
133
  },
114
- cwd: packageRoot,
115
- stdio: ["ignore", "pipe", "pipe"]
134
+ stdio: "inherit",
135
+ maxBuffer: LARGE_BUFFER,
136
+ killSignal: "SIGTERM"
116
137
  }
117
138
  );
118
139
  console.info(
119
- `Added the dist-tag ${tag} to v${currentVersion} for registries "${registry}".
140
+ `Added the dist-tag ${tag} to v${currentVersion} for registry "${registry}".
120
141
  `
121
142
  );
122
143
  } else {
123
144
  console.info(
124
- `Would add the dist-tag ${tag} to v${currentVersion} for registries "${registry}", but [dry-run] was set.
145
+ `Would add the dist-tag ${tag} to v${currentVersion} for registry "${registry}", but [dry-run] was set.
125
146
  `
126
147
  );
127
148
  }
128
- return new Promise((resolve) => resolve({ success: true }));
149
+ return { success: true };
129
150
  } catch (err) {
130
- console.log("");
131
- console.error("An error occured checking existing dist-tags.");
132
- console.error(err);
133
- console.log("");
134
151
  try {
152
+ console.warn("\n ********************** \n");
135
153
  console.warn(
136
- `An error occurred while checking for existing dist-tags
137
- ${err}
154
+ `An error occurred while adding dist-tags
155
+ ${JSON.stringify(err)}
138
156
 
139
157
  Note: If this is the first time this package has been published to NPM, this can be ignored.`
140
158
  );
141
- console.log("");
159
+ console.info("");
142
160
  const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
143
161
  if (stdoutData?.error && !(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.includes("no such package available")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().includes("no such package available"))) {
144
162
  console.error(
@@ -155,42 +173,46 @@ Note: If this is the first time this package has been published to NPM, this can
155
173
  `npm dist-tag add stdout: ${JSON.stringify(stdoutData, null, 2)}`
156
174
  );
157
175
  }
158
- return new Promise((resolve) => resolve({ success: false }));
176
+ return { success: false };
159
177
  }
160
178
  } catch (err2) {
161
179
  console.error(
162
180
  `Something unexpected went wrong when processing the npm dist-tag add output
163
- ${err2}`
181
+ ${JSON.stringify(err2)}`
164
182
  );
165
- return new Promise((resolve) => resolve({ success: false }));
183
+ return { success: false };
166
184
  }
167
185
  }
168
186
  } catch (err) {
169
- console.log("");
187
+ console.error("\n ********************** \n");
188
+ console.info("");
170
189
  console.error(
171
190
  "An error occured trying to run the npm dist-tag add command."
172
191
  );
173
192
  console.error(err);
174
- console.log("");
193
+ console.info("");
175
194
  const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
176
195
  if (!(stdoutData.error?.code?.includes("E404") && stdoutData.error?.summary?.toLowerCase().includes("not found")) && !(err.stderr?.toString().includes("E404") && err.stderr?.toString().toLowerCase().includes("not found"))) {
177
196
  console.error(
178
197
  `Something unexpected went wrong when checking for existing dist-tags.
179
- ${err}`
198
+ ${JSON.stringify(err)}`
180
199
  );
181
- return new Promise((resolve) => resolve({ success: false }));
200
+ return { success: false };
182
201
  }
183
202
  }
184
203
  }
185
204
  try {
205
+ console.info(
206
+ `Running publish command ${npmPublishCommandSegments.join(" ")}`
207
+ );
186
208
  const output = (0, import_node_child_process.execSync)(npmPublishCommandSegments.join(" "), {
187
- maxBuffer: LARGE_BUFFER,
209
+ cwd: packageRoot,
188
210
  env: {
189
211
  ...process.env,
190
212
  FORCE_COLOR: "true"
191
213
  },
192
- cwd: packageRoot,
193
- stdio: ["ignore", "pipe", "pipe"]
214
+ maxBuffer: LARGE_BUFFER,
215
+ killSignal: "SIGTERM"
194
216
  });
195
217
  console.info(output.toString());
196
218
  if (isDryRun) {
@@ -200,15 +222,15 @@ ${err}`
200
222
  } else {
201
223
  console.info(`Published to ${registry} with tag "${tag}"`);
202
224
  }
203
- return new Promise((resolve) => resolve({ success: true }));
225
+ return { success: true };
204
226
  } catch (err) {
205
- console.log("");
206
- console.error("An error occured running npm publish.");
207
- console.error(err);
208
- console.log("");
209
227
  try {
228
+ console.error("\n ********************** \n");
229
+ console.info("");
230
+ console.error("An error occured running npm publish.");
231
+ console.error("Please see below for more information:");
232
+ console.info("");
210
233
  const stdoutData = JSON.parse(err.stdout?.toString() || "{}");
211
- console.error("npm publish error please see below for more information:");
212
234
  if (stdoutData.error.summary) {
213
235
  console.error(stdoutData.error.summary);
214
236
  console.error(stdoutData.error.summary);
@@ -222,13 +244,19 @@ ${err}`
222
244
  ${JSON.stringify(stdoutData, null, 2)}`
223
245
  );
224
246
  }
225
- return new Promise((resolve) => resolve({ success: false }));
247
+ console.error("\n ********************** \n");
248
+ return { success: false };
226
249
  } catch (err2) {
227
250
  console.error(
228
251
  `Something unexpected went wrong when processing the npm publish output
229
- ${err2}`
252
+ ${JSON.stringify(err2)}`
230
253
  );
231
- return new Promise((resolve) => resolve({ success: false }));
254
+ console.error("\n ********************** \n");
255
+ return { success: false };
232
256
  }
233
257
  }
234
258
  }
259
+ // Annotate the CommonJS export names for ESM import in node:
260
+ 0 && (module.exports = {
261
+ LARGE_BUFFER
262
+ });