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.
- package/dist/index.js +17 -8
- package/index.ts +18 -6
- 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
|
|
229
|
+
const longDepUrl = new URL(
|
|
226
230
|
`/${owner}/${repo}/${pJson.name}@${formattedSha}`,
|
|
227
231
|
apiUrl,
|
|
228
232
|
).href;
|
|
229
|
-
deps.set(pJson.name,
|
|
230
|
-
realDeps?.set(pJson.name, pJson.version ??
|
|
233
|
+
deps.set(pJson.name, longDepUrl);
|
|
234
|
+
realDeps?.set(pJson.name, pJson.version ?? longDepUrl);
|
|
231
235
|
|
|
232
|
-
const
|
|
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 ${
|
|
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:
|
|
254
|
+
url: jsonUrl,
|
|
243
255
|
shasum: "", // will be filled later
|
|
244
256
|
});
|
|
245
257
|
}
|