soja-cli 1.5.0 → 1.5.1
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/README.md +1 -1
- package/dist/git/releases.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/git/releases.js
CHANGED
|
@@ -33,12 +33,15 @@ export class GhReleases {
|
|
|
33
33
|
/** Public release metadata and tarballs from npm; no GitHub account is needed to update. */
|
|
34
34
|
export class NpmReleases {
|
|
35
35
|
packageName;
|
|
36
|
-
|
|
36
|
+
fetchImpl;
|
|
37
|
+
constructor(packageName = 'soja-cli', fetchImpl = fetch) {
|
|
37
38
|
this.packageName = packageName;
|
|
39
|
+
this.fetchImpl = fetchImpl;
|
|
38
40
|
}
|
|
39
41
|
async latest() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
// The `/latest` document only speaks plain JSON: the abbreviated install format gets a 406.
|
|
43
|
+
const response = await this.fetchImpl(`https://registry.npmjs.org/${encodeURIComponent(this.packageName)}/latest`, {
|
|
44
|
+
headers: { accept: 'application/json' },
|
|
42
45
|
signal: AbortSignal.timeout(10_000),
|
|
43
46
|
});
|
|
44
47
|
if (!response.ok)
|