pkg-pr-new 0.0.53 → 0.0.55

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 (3) hide show
  1. package/dist/index.js +17 -8
  2. package/index.ts +18 -6
  3. package/package.json +1 -1
package/index.ts CHANGED
@@ -69,6 +69,10 @@ const main = defineCommand({
69
69
  type: "boolean",
70
70
  description: "use `pnpm pack` instead of `npm pack --json`",
71
71
  },
72
+ yarn: {
73
+ type: "boolean",
74
+ description: "use `yarn pack` instead of `npm pack --json`",
75
+ },
72
76
  template: {
73
77
  type: "string",
74
78
  description:
@@ -222,24 +226,32 @@ const main = defineCommand({
222
226
  }
223
227
 
224
228
  const formattedSha = isCompact ? abbreviateCommitHash(sha) : sha;
225
- const depUrl = new URL(
229
+ const longDepUrl = new URL(
226
230
  `/${owner}/${repo}/${pJson.name}@${formattedSha}`,
227
231
  apiUrl,
228
232
  ).href;
229
- deps.set(pJson.name, depUrl);
230
- realDeps?.set(pJson.name, pJson.version ?? depUrl);
233
+ deps.set(pJson.name, longDepUrl);
234
+ realDeps?.set(pJson.name, pJson.version ?? longDepUrl);
231
235
 
232
- const resource = await fetch(depUrl);
236
+ const controller = new AbortController();
237
+ const resource = await fetch(longDepUrl, {
238
+ signal: controller.signal,
239
+ });
233
240
  if (resource.ok) {
234
241
  console.warn(
235
- `${pJson.name}@${formattedSha} was already published on ${depUrl}`,
242
+ `${pJson.name}@${formattedSha} was already published on ${longDepUrl}`,
236
243
  );
237
244
  }
245
+ controller.abort();
246
+
247
+ const jsonUrl = isCompact
248
+ ? new URL(`/${pJson.name}@${formattedSha}`, apiUrl).href
249
+ : longDepUrl;
238
250
 
239
251
  // Collect package metadata
240
252
  outputMetadata.packages.push({
241
253
  name: pJson.name,
242
- url: depUrl,
254
+ url: jsonUrl,
243
255
  shasum: "", // will be filled later
244
256
  });
245
257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkg-pr-new",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",