@pnpm/manifest-utils
Advanced tools
Comparing version 3.0.6 to 3.1.0
@@ -6,2 +6,5 @@ export declare type PinnedVersion = 'major' | 'minor' | 'patch' | 'none'; | ||
}): string; | ||
export declare function createVersionSpec(version: string | undefined, pinnedVersion?: PinnedVersion): string; | ||
export declare function createVersionSpec(version: string | undefined, opts: { | ||
pinnedVersion?: PinnedVersion; | ||
rolling?: boolean; | ||
}): string; |
@@ -12,19 +12,23 @@ "use strict"; | ||
const prefix = (0, exports.getPrefix)(alias, name); | ||
return `${prefix}${createVersionSpec(version, opts.pinnedVersion)}`; | ||
return `${prefix}${createVersionSpec(version, { pinnedVersion: opts.pinnedVersion })}`; | ||
} | ||
exports.getPref = getPref; | ||
function createVersionSpec(version, pinnedVersion) { | ||
if (!version) | ||
return '*'; | ||
switch (pinnedVersion ?? 'major') { | ||
function createVersionSpec(version, opts) { | ||
switch (opts.pinnedVersion ?? 'major') { | ||
case 'none': | ||
return '*'; | ||
case 'major': | ||
return `^${version}`; | ||
if (opts.rolling) | ||
return '^'; | ||
return !version ? '*' : `^${version}`; | ||
case 'minor': | ||
return `~${version}`; | ||
if (opts.rolling) | ||
return '~'; | ||
return !version ? '*' : `~${version}`; | ||
case 'patch': | ||
return `${version}`; | ||
if (opts.rolling) | ||
return '*'; | ||
return !version ? '*' : `${version}`; | ||
default: | ||
throw new error_1.default('BAD_PINNED_VERSION', `Cannot pin '${pinnedVersion ?? 'undefined'}'`); | ||
throw new error_1.default('BAD_PINNED_VERSION', `Cannot pin '${opts.pinnedVersion ?? 'undefined'}'`); | ||
} | ||
@@ -31,0 +35,0 @@ } |
{ | ||
"name": "@pnpm/manifest-utils", | ||
"description": "Utils for dealing with package manifest", | ||
"version": "3.0.6", | ||
"version": "3.1.0", | ||
"bugs": { | ||
@@ -30,3 +30,3 @@ "url": "https://github.com/pnpm/pnpm/issues" | ||
"devDependencies": { | ||
"@pnpm/manifest-utils": "3.0.6" | ||
"@pnpm/manifest-utils": "3.1.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17504
202