Skip to content

Commit

Permalink
Re-add patch target for pnpm (#1268).
Browse files Browse the repository at this point in the history
Regression: 8b38173
  • Loading branch information
raineorshine committed Feb 9, 2023
1 parent d925a0e commit 38c4053
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/lib/queryVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { VersionResult } from '../types/VersionResult'
import { VersionSpec } from '../types/VersionSpec'
import getPackageManager from './getPackageManager'
import keyValueBy from './keyValueBy'
import programError from './programError'
import { createNpmAlias, isGithubUrl, isPre, parseNpmAlias } from './version-util'

const supportedVersionTargets = ['latest', 'newest', 'greatest', 'minor', 'patch']
Expand Down Expand Up @@ -71,12 +72,12 @@ async function queryVersions(packageMap: Index<VersionSpec>, options: Options =

if (!getPackageVersion) {
const packageManagerSupportedVersionTargets = supportedVersionTargets.filter(t => t in packageManager)
return Promise.reject(
new Error(
`Unsupported target "${target}" for ${packageManagerName}. Supported version targets are: ` +
packageManagerSupportedVersionTargets.join(', ') +
(!isGithubDependency ? ' and custom distribution tags, following "@" (example: @next)' : ''),
),
programError(
options,
chalk.red(`\nUnsupported target "${target}" using ${packageManagerName}`) +
`\nSupported version targets are: ` +
packageManagerSupportedVersionTargets.join(', ') +
(!isGithubDependency ? ', and tags (e.g. @next)' : ''),
)
}

Expand Down
1 change: 1 addition & 0 deletions src/package-managers/pnpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export {
greatest,
latest,
minor,
patch,
newest,
packageAuthorChanged,
} from './npm'
4 changes: 2 additions & 2 deletions src/types/PackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Options } from './Options'
import { Version } from './Version'
import { VersionSpec } from './VersionSpec'

/** The package manager API that ncu uses to fetch versions and meta information for packages. Includes npm and yarn, and others can be added if needed. */
/** The package manager API that ncu uses to fetch versions and meta information for packages. Includes npm and yarn, and others can be added as needed. */
export interface PackageManager {
defaultPrefix?: (options: Options) => Promise<string | undefined>
list?: (options: Options) => Promise<Index<Version>>
latest: GetVersion
major?: GetVersion
minor?: GetVersion
newest?: GetVersion
patch?: GetVersion
greatest?: GetVersion
packageAuthorChanged?: (
packageName: string,
Expand Down

0 comments on commit 38c4053

Please sign in to comment.