Comparing version
@@ -108,2 +108,6 @@ #!/usr/bin/env node | ||
], | ||
[ | ||
"DENO_BIN_CANARY", | ||
"Use the canary Deno binary instead of latest for publishing.", | ||
], | ||
])} | ||
@@ -146,2 +150,3 @@ `); | ||
return (0, commands_1.publish)(process.cwd(), { | ||
canary: process.env.DENO_BIN_CANARY !== undefined, | ||
binFolder, | ||
@@ -185,2 +190,3 @@ publishArgs: args.slice(1), | ||
debug: { type: "boolean", default: false }, | ||
canary: { type: "boolean", default: false }, | ||
help: { type: "boolean", default: false, short: "h" }, | ||
@@ -187,0 +193,0 @@ version: { type: "boolean", default: false, short: "v" }, |
@@ -17,2 +17,3 @@ import { JsrPackage } from "./utils"; | ||
publishArgs: string[]; | ||
canary: boolean; | ||
} | ||
@@ -19,0 +20,0 @@ export declare function publish(cwd: string, options: PublishOptions): Promise<void>; |
@@ -134,4 +134,4 @@ "use strict"; | ||
exports.remove = remove; | ||
async function getOrDownloadBinPath(binFolder) { | ||
const info = await (0, download_1.getDenoDownloadUrl)(); | ||
async function getOrDownloadBinPath(binFolder, canary) { | ||
const info = await (0, download_1.getDenoDownloadUrl)(canary); | ||
const binPath = path.join(binFolder, info.version, | ||
@@ -160,3 +160,3 @@ // Ensure each binary has their own folder to avoid overwriting it | ||
const binPath = process.env.DENO_BIN_PATH ?? | ||
await getOrDownloadBinPath(options.binFolder); | ||
await getOrDownloadBinPath(options.binFolder, options.canary); | ||
// Ready to publish now! | ||
@@ -163,0 +163,0 @@ const args = [ |
@@ -5,4 +5,5 @@ export interface DownloadInfo { | ||
version: string; | ||
canary: boolean; | ||
} | ||
export declare function getDenoDownloadUrl(): Promise<DownloadInfo>; | ||
export declare function getDenoDownloadUrl(canary: boolean): Promise<DownloadInfo>; | ||
export declare function downloadDeno(binPath: string, info: DownloadInfo): Promise<void>; |
@@ -37,2 +37,3 @@ "use strict"; | ||
const DENO_CANARY_INFO_URL = "https://dl.deno.land/canary-latest.txt"; | ||
const DENO_RELEASE_INFO_URL = "https://dl.deno.land/release-latest.txt"; | ||
// Example: https://github.com/denoland/deno/releases/download/v1.41.0/deno-aarch64-apple-darwin.zip | ||
@@ -47,3 +48,3 @@ // Example: https://dl.deno.land/canary/d722de886b85093eeef08d1e9fd6f3193405762d/deno-aarch64-apple-darwin.zip | ||
}; | ||
async function getDenoDownloadUrl() { | ||
async function getDenoDownloadUrl(canary) { | ||
const key = `${process.platform} ${os.arch()}`; | ||
@@ -54,13 +55,17 @@ if (!(key in FILENAMES)) { | ||
const name = FILENAMES[key]; | ||
const res = await fetch(DENO_CANARY_INFO_URL); | ||
const url = canary ? DENO_CANARY_INFO_URL : DENO_RELEASE_INFO_URL; | ||
const res = await fetch(url); | ||
if (!res.ok) { | ||
await res.body?.cancel(); | ||
throw new Error(`${res.status}: Unable to retrieve canary version information from ${DENO_CANARY_INFO_URL}.`); | ||
throw new Error(`${res.status}: Unable to retrieve ${canary ? "canary" : "release"} version information from ${url}.`); | ||
} | ||
const sha = (await res.text()).trim(); | ||
const version = (await res.text()).trim(); | ||
const filename = name + ".zip"; | ||
return { | ||
url: `https://dl.deno.land/canary/${decodeURI(sha)}/${filename}`, | ||
canary, | ||
url: canary | ||
? `https://dl.deno.land/canary/${decodeURI(version)}/${filename}` | ||
: `https://dl.deno.land/release/${decodeURI(version)}/${filename}`, | ||
filename, | ||
version: sha, | ||
version: version, | ||
}; | ||
@@ -77,3 +82,3 @@ } | ||
} | ||
console.log(`Downloading JSR binary...`); | ||
console.log(`Downloading JSR ${info.canary ? "canary" : "release"} binary...`); | ||
await withProgressBar(async (tick) => { | ||
@@ -80,0 +85,0 @@ const tmpFile = path.join(binFolder, info.filename + ".part"); |
@@ -108,2 +108,6 @@ #!/usr/bin/env node | ||
], | ||
[ | ||
"DENO_BIN_CANARY", | ||
"Use the canary Deno binary instead of latest for publishing.", | ||
], | ||
])} | ||
@@ -146,2 +150,3 @@ `); | ||
return (0, commands_1.publish)(process.cwd(), { | ||
canary: process.env.DENO_BIN_CANARY !== undefined, | ||
binFolder, | ||
@@ -185,2 +190,3 @@ publishArgs: args.slice(1), | ||
debug: { type: "boolean", default: false }, | ||
canary: { type: "boolean", default: false }, | ||
help: { type: "boolean", default: false, short: "h" }, | ||
@@ -187,0 +193,0 @@ version: { type: "boolean", default: false, short: "v" }, |
@@ -17,2 +17,3 @@ import { JsrPackage } from "./utils"; | ||
publishArgs: string[]; | ||
canary: boolean; | ||
} | ||
@@ -19,0 +20,0 @@ export declare function publish(cwd: string, options: PublishOptions): Promise<void>; |
@@ -134,4 +134,4 @@ "use strict"; | ||
exports.remove = remove; | ||
async function getOrDownloadBinPath(binFolder) { | ||
const info = await (0, download_1.getDenoDownloadUrl)(); | ||
async function getOrDownloadBinPath(binFolder, canary) { | ||
const info = await (0, download_1.getDenoDownloadUrl)(canary); | ||
const binPath = path.join(binFolder, info.version, | ||
@@ -160,3 +160,3 @@ // Ensure each binary has their own folder to avoid overwriting it | ||
const binPath = process.env.DENO_BIN_PATH ?? | ||
await getOrDownloadBinPath(options.binFolder); | ||
await getOrDownloadBinPath(options.binFolder, options.canary); | ||
// Ready to publish now! | ||
@@ -163,0 +163,0 @@ const args = [ |
@@ -5,4 +5,5 @@ export interface DownloadInfo { | ||
version: string; | ||
canary: boolean; | ||
} | ||
export declare function getDenoDownloadUrl(): Promise<DownloadInfo>; | ||
export declare function getDenoDownloadUrl(canary: boolean): Promise<DownloadInfo>; | ||
export declare function downloadDeno(binPath: string, info: DownloadInfo): Promise<void>; |
@@ -37,2 +37,3 @@ "use strict"; | ||
const DENO_CANARY_INFO_URL = "https://dl.deno.land/canary-latest.txt"; | ||
const DENO_RELEASE_INFO_URL = "https://dl.deno.land/release-latest.txt"; | ||
// Example: https://github.com/denoland/deno/releases/download/v1.41.0/deno-aarch64-apple-darwin.zip | ||
@@ -47,3 +48,3 @@ // Example: https://dl.deno.land/canary/d722de886b85093eeef08d1e9fd6f3193405762d/deno-aarch64-apple-darwin.zip | ||
}; | ||
async function getDenoDownloadUrl() { | ||
async function getDenoDownloadUrl(canary) { | ||
const key = `${process.platform} ${os.arch()}`; | ||
@@ -54,13 +55,17 @@ if (!(key in FILENAMES)) { | ||
const name = FILENAMES[key]; | ||
const res = await fetch(DENO_CANARY_INFO_URL); | ||
const url = canary ? DENO_CANARY_INFO_URL : DENO_RELEASE_INFO_URL; | ||
const res = await fetch(url); | ||
if (!res.ok) { | ||
await res.body?.cancel(); | ||
throw new Error(`${res.status}: Unable to retrieve canary version information from ${DENO_CANARY_INFO_URL}.`); | ||
throw new Error(`${res.status}: Unable to retrieve ${canary ? "canary" : "release"} version information from ${url}.`); | ||
} | ||
const sha = (await res.text()).trim(); | ||
const version = (await res.text()).trim(); | ||
const filename = name + ".zip"; | ||
return { | ||
url: `https://dl.deno.land/canary/${decodeURI(sha)}/${filename}`, | ||
canary, | ||
url: canary | ||
? `https://dl.deno.land/canary/${decodeURI(version)}/${filename}` | ||
: `https://dl.deno.land/release/${decodeURI(version)}/${filename}`, | ||
filename, | ||
version: sha, | ||
version: version, | ||
}; | ||
@@ -77,3 +82,3 @@ } | ||
} | ||
console.log(`Downloading JSR binary...`); | ||
console.log(`Downloading JSR ${info.canary ? "canary" : "release"} binary...`); | ||
await withProgressBar(async (tick) => { | ||
@@ -80,0 +85,0 @@ const tmpFile = path.join(binFolder, info.filename + ".part"); |
{ | ||
"name": "jsr", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"description": "jsr.io package manager for node", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
187415
1.25%2778
0.94%11
22.22%