pkg-pr-new 0.0.54 → 0.0.56
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 +13 -8
- package/index.ts +14 -6
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -226,24 +226,32 @@ const main = defineCommand({
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
const formattedSha = isCompact ? abbreviateCommitHash(sha) : sha;
|
|
229
|
-
const
|
|
229
|
+
const longDepUrl = new URL(
|
|
230
230
|
`/${owner}/${repo}/${pJson.name}@${formattedSha}`,
|
|
231
231
|
apiUrl,
|
|
232
232
|
).href;
|
|
233
|
-
deps.set(pJson.name,
|
|
234
|
-
realDeps?.set(pJson.name, pJson.version ??
|
|
233
|
+
deps.set(pJson.name, longDepUrl);
|
|
234
|
+
realDeps?.set(pJson.name, pJson.version ?? longDepUrl);
|
|
235
235
|
|
|
236
|
-
const
|
|
236
|
+
const controller = new AbortController();
|
|
237
|
+
const resource = await fetch(longDepUrl, {
|
|
238
|
+
signal: controller.signal,
|
|
239
|
+
});
|
|
237
240
|
if (resource.ok) {
|
|
238
241
|
console.warn(
|
|
239
|
-
`${pJson.name}@${formattedSha} was already published on ${
|
|
242
|
+
`${pJson.name}@${formattedSha} was already published on ${longDepUrl}`,
|
|
240
243
|
);
|
|
241
244
|
}
|
|
245
|
+
controller.abort();
|
|
246
|
+
|
|
247
|
+
const jsonUrl = isCompact
|
|
248
|
+
? new URL(`/${pJson.name}@${formattedSha}`, apiUrl).href
|
|
249
|
+
: longDepUrl;
|
|
242
250
|
|
|
243
251
|
// Collect package metadata
|
|
244
252
|
outputMetadata.packages.push({
|
|
245
253
|
name: pJson.name,
|
|
246
|
-
url:
|
|
254
|
+
url: jsonUrl,
|
|
247
255
|
shasum: "", // will be filled later
|
|
248
256
|
});
|
|
249
257
|
}
|