mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 16:51:13 +00:00
fix: require npm auth for dist-tag mirror
This commit is contained in:
@@ -24,6 +24,12 @@ const CORRECTION_VERSION_REGEX =
|
||||
* @property {("latest" | "beta")[]} mirrorDistTags
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} NpmDistTagMirrorAuth
|
||||
* @property {boolean} hasAuth
|
||||
* @property {"node-auth-token" | "npm-token" | "none"} source
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} version
|
||||
* @param {Record<string, string | undefined>} groups
|
||||
@@ -174,3 +180,24 @@ export function resolveNpmPublishPlan(version, currentBetaVersion) {
|
||||
mirrorDistTags: ["beta"],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* nodeAuthToken?: string | null | undefined;
|
||||
* npmToken?: string | null | undefined;
|
||||
* }} [params]
|
||||
* @returns {NpmDistTagMirrorAuth}
|
||||
*/
|
||||
export function resolveNpmDistTagMirrorAuth(params = {}) {
|
||||
const nodeAuthToken = params.nodeAuthToken?.trim();
|
||||
if (nodeAuthToken) {
|
||||
return { hasAuth: true, source: "node-auth-token" };
|
||||
}
|
||||
|
||||
const npmToken = params.npmToken?.trim();
|
||||
if (npmToken) {
|
||||
return { hasAuth: true, source: "npm-token" };
|
||||
}
|
||||
|
||||
return { hasAuth: false, source: "none" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user