mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 03:51:40 -04:00
feat: minimumReleaseAgeExclude support patterns (#9984)
close #9983 --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
14
.changeset/vast-yaks-cut.md
Normal file
14
.changeset/vast-yaks-cut.md
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
"pnpm": patch
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
---
|
||||
|
||||
`minimumReleaseAgeExclude` config support patterns. For instance:
|
||||
|
||||
```yaml
|
||||
minimumReleaseAge: 1440
|
||||
minimumReleaseAgeExclude:
|
||||
- '@eslint/*'
|
||||
```
|
||||
|
||||
Related PR: [#9984](https://github.com/pnpm/pnpm/pull/9984).
|
||||
@@ -22,3 +22,12 @@ test('minimumReleaseAge is ignored for packages in the minimumReleaseAgeExclude
|
||||
|
||||
expect(manifest.dependencies!['is-odd']).toEqual('~0.1.2')
|
||||
})
|
||||
|
||||
test('minimumReleaseAge is ignored for packages in the minimumReleaseAgeExclude array, using a pattern', async () => {
|
||||
prepareEmpty()
|
||||
|
||||
const opts = testDefaults({ minimumReleaseAge, minimumReleaseAgeExclude: ['is-*'] })
|
||||
const { updatedManifest: manifest } = await addDependenciesToPackage({}, ['is-odd@0.1'], opts)
|
||||
|
||||
expect(manifest.dependencies!['is-odd']).toEqual('~0.1.2')
|
||||
})
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"@pnpm/lockfile.types": "workspace:*",
|
||||
"@pnpm/lockfile.utils": "workspace:*",
|
||||
"@pnpm/manifest-utils": "workspace:*",
|
||||
"@pnpm/matcher": "workspace:*",
|
||||
"@pnpm/npm-resolver": "workspace:*",
|
||||
"@pnpm/patching.config": "workspace:*",
|
||||
"@pnpm/patching.types": "workspace:*",
|
||||
|
||||
@@ -177,7 +177,7 @@ export interface ResolutionContext {
|
||||
missingPeersOfChildrenByPkgId: Record<PkgResolutionId, { depth: number, missingPeersOfChildren: MissingPeersOfChildren }>
|
||||
hoistPeers?: boolean
|
||||
maximumPublishedBy?: Date
|
||||
minimumReleaseAgeExclude?: string[]
|
||||
minimumReleaseAgeExclude?: (pkgName: string) => boolean
|
||||
}
|
||||
|
||||
export interface MissingPeerInfo {
|
||||
@@ -1311,7 +1311,7 @@ async function resolveDependency (
|
||||
(
|
||||
ctx.minimumReleaseAgeExclude == null ||
|
||||
wantedDependency.alias == null ||
|
||||
!ctx.minimumReleaseAgeExclude.includes(wantedDependency.alias)
|
||||
!ctx.minimumReleaseAgeExclude(wantedDependency.alias)
|
||||
)
|
||||
) {
|
||||
publishedBy = options.publishedBy
|
||||
|
||||
@@ -2,6 +2,7 @@ import { resolveFromCatalog } from '@pnpm/catalogs.resolver'
|
||||
import { type Catalogs } from '@pnpm/catalogs.types'
|
||||
import { type LockfileObject } from '@pnpm/lockfile.types'
|
||||
import { globalWarn } from '@pnpm/logger'
|
||||
import { createMatcher } from '@pnpm/matcher'
|
||||
import { type PatchGroupRecord } from '@pnpm/patching.config'
|
||||
import { type PreferredVersions, type Resolution, type WorkspacePackages } from '@pnpm/resolver-base'
|
||||
import { type StoreController } from '@pnpm/store-controller-types'
|
||||
@@ -196,7 +197,7 @@ export async function resolveDependencyTree<T> (
|
||||
hoistPeers: autoInstallPeers || opts.dedupePeerDependents,
|
||||
allPeerDepNames: new Set(),
|
||||
maximumPublishedBy: opts.minimumReleaseAge ? new Date(Date.now() - opts.minimumReleaseAge * 60 * 1000) : undefined,
|
||||
minimumReleaseAgeExclude: opts.minimumReleaseAgeExclude,
|
||||
minimumReleaseAgeExclude: opts.minimumReleaseAgeExclude ? createMatcher(opts.minimumReleaseAgeExclude) : undefined,
|
||||
}
|
||||
|
||||
const resolveArgs: ImporterToResolve[] = importers.map((importer) => {
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
{
|
||||
"path": "../../catalogs/types"
|
||||
},
|
||||
{
|
||||
"path": "../../config/matcher"
|
||||
},
|
||||
{
|
||||
"path": "../../fetching/pick-fetcher"
|
||||
},
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -6044,6 +6044,9 @@ importers:
|
||||
'@pnpm/manifest-utils':
|
||||
specifier: workspace:*
|
||||
version: link:../../pkg-manifest/manifest-utils
|
||||
'@pnpm/matcher':
|
||||
specifier: workspace:*
|
||||
version: link:../../config/matcher
|
||||
'@pnpm/npm-resolver':
|
||||
specifier: workspace:*
|
||||
version: link:../../resolving/npm-resolver
|
||||
|
||||
Reference in New Issue
Block a user