Skip to content

Commit 0764be4

Browse files
committed
feat: stop ignoring filtered install
1 parent 2a29cf8 commit 0764be4

File tree

10 files changed

+1
-109
lines changed

10 files changed

+1
-109
lines changed

deps/status/src/checkLockfilesUpToDate.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ export async function checkLockfilesUpToDate (opts: CheckLockfilesUpToDateOption
8181
})
8282
}
8383

84-
if (packagesList.filtered) {
85-
globalWarn('Cannot verify dependencies for filtered install. Skipping check.')
86-
return
87-
}
88-
8984
if (!equals(
9085
filter(value => value != null, packagesList.catalogs ?? {}),
9186
filter(value => value != null, catalogs ?? {})
@@ -204,7 +199,6 @@ export async function checkLockfilesUpToDate (opts: CheckLockfilesUpToDateOption
204199
await updatePackagesList({
205200
allProjects,
206201
catalogs,
207-
filtered: false,
208202
lastValidatedTimestamp: Date.now(),
209203
workspaceDir,
210204
})

pkg-manager/plugin-commands-installation/src/installDeps.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ export type InstallDepsOptions = Pick<Config,
119119
includeOnlyPackageFiles?: boolean
120120
prepareExecutionEnv: PrepareExecutionEnv
121121
fetchFullMetadata?: boolean
122-
} & Partial<Pick<Config,
123-
| 'filter'
124-
| 'pnpmHomeDir'
125-
>>
122+
} & Partial<Pick<Config, 'pnpmHomeDir'>>
126123

127124
export async function installDeps (
128125
opts: InstallDepsOptions,
@@ -166,7 +163,6 @@ when running add/update with the --workspace option')
166163
await updatePackagesList({
167164
allProjects: opts.allProjects,
168165
catalogs: opts.catalogs,
169-
filtered: (opts.filter?.length ?? 0) > 0,
170166
lastValidatedTimestamp: Date.now(),
171167
workspaceDir: opts.workspaceDir,
172168
})

pnpm/test/verifyDepsBeforeRun/exec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ test('multi-project workspace', async () => {
169169
const packagesList = loadPackagesList(process.cwd())
170170
expect(packagesList).toStrictEqual({
171171
catalogs: {},
172-
filtered: false,
173172
lastValidatedTimestamp: expect.any(Number),
174173
projectRootDirs: [
175174
path.resolve('.'),
@@ -324,7 +323,6 @@ test('multi-project workspace', async () => {
324323
const packagesList = loadPackagesList(process.cwd())
325324
expect(packagesList).toStrictEqual({
326325
catalogs: {},
327-
filtered: false,
328326
lastValidatedTimestamp: expect.any(Number),
329327
projectRootDirs: [
330328
path.resolve('.'),

pnpm/test/verifyDepsBeforeRun/multiProjectWorkspace.ts

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ test('single dependency', async () => {
9292
const packagesList = loadPackagesList(process.cwd())
9393
expect(packagesList).toStrictEqual({
9494
catalogs: {},
95-
filtered: false,
9695
lastValidatedTimestamp: expect.any(Number),
9796
projectRootDirs: [
9897
path.resolve('.'),
@@ -261,7 +260,6 @@ test('single dependency', async () => {
261260
const packagesList = loadPackagesList(process.cwd())
262261
expect(packagesList).toStrictEqual({
263262
catalogs: {},
264-
filtered: false,
265263
lastValidatedTimestamp: expect.any(Number),
266264
projectRootDirs: [
267265
path.resolve('.'),
@@ -366,7 +364,6 @@ test('multiple lockfiles', async () => {
366364
const packagesList = loadPackagesList(process.cwd())
367365
expect(packagesList).toStrictEqual({
368366
catalogs: {},
369-
filtered: false,
370367
lastValidatedTimestamp: expect.any(Number),
371368
projectRootDirs: [
372369
path.resolve('.'),
@@ -530,7 +527,6 @@ test('multiple lockfiles', async () => {
530527
const packagesList = loadPackagesList(process.cwd())
531528
expect(packagesList).toStrictEqual({
532529
catalogs: {},
533-
filtered: false,
534530
lastValidatedTimestamp: expect.any(Number),
535531
projectRootDirs: [
536532
path.resolve('.'),
@@ -548,83 +544,6 @@ test('multiple lockfiles', async () => {
548544
}
549545
})
550546

551-
test('filtered install', async () => {
552-
const manifests: Record<string, ProjectManifest> = {
553-
root: {
554-
name: 'root',
555-
private: true,
556-
dependencies: {
557-
'@pnpm.e2e/foo': '=100.0.0',
558-
},
559-
scripts: {
560-
start: 'echo hello from root',
561-
},
562-
},
563-
foo: {
564-
name: 'foo',
565-
private: true,
566-
dependencies: {
567-
'@pnpm.e2e/foo': '=100.0.0',
568-
},
569-
scripts: {
570-
start: 'echo hello from foo',
571-
},
572-
},
573-
bar: {
574-
name: 'bar',
575-
private: true,
576-
dependencies: {
577-
'@pnpm.e2e/foo': '=100.0.0',
578-
},
579-
scripts: {
580-
start: 'echo hello from bar',
581-
},
582-
},
583-
}
584-
585-
preparePackages([
586-
{
587-
location: '.',
588-
package: manifests.root,
589-
},
590-
manifests.foo,
591-
manifests.bar,
592-
])
593-
594-
writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
595-
596-
// attempting to execute a script with filter without installing dependencies should fail
597-
{
598-
const { status, stdout } = execPnpmSync([...CONFIG, '--filter=foo', 'start'])
599-
expect(status).not.toBe(0)
600-
expect(stdout.toString()).toContain('ERR_PNPM_RUN_CHECK_DEPS_NO_CACHE')
601-
}
602-
603-
await execPnpm([...CONFIG, '--filter=foo', 'install'])
604-
605-
// pnpm install should update the packages list cache
606-
{
607-
const packagesList = loadPackagesList(process.cwd())
608-
expect(packagesList).toStrictEqual({
609-
catalogs: {},
610-
filtered: true,
611-
lastValidatedTimestamp: expect.any(Number),
612-
projectRootDirs: [
613-
path.resolve('.'),
614-
path.resolve('foo'),
615-
path.resolve('bar'),
616-
].sort(),
617-
})
618-
}
619-
620-
// should skip checking after a filtered install
621-
{
622-
const { stdout } = execPnpmSync([...CONFIG, '--filter=foo', 'start'], { expectSuccess: true })
623-
expect(stdout.toString()).toContain('hello from foo')
624-
expect(stdout.toString()).toContain('Cannot verify dependencies for filtered install. Skipping check.')
625-
}
626-
})
627-
628547
test('no dependencies', async () => {
629548
const manifests: Record<string, ProjectManifest> = {
630549
root: {
@@ -675,7 +594,6 @@ test('no dependencies', async () => {
675594
const packagesList = loadPackagesList(process.cwd())
676595
expect(packagesList).toStrictEqual({
677596
catalogs: {},
678-
filtered: false,
679597
lastValidatedTimestamp: expect.any(Number),
680598
projectRootDirs: [
681599
path.resolve('.'),
@@ -855,7 +773,6 @@ test('should check for outdated catalogs', async () => {
855773
catalogs: {
856774
default: workspaceManifest.catalog,
857775
},
858-
filtered: false,
859776
lastValidatedTimestamp: expect.any(Number),
860777
projectRootDirs: [
861778
path.resolve('.'),

workspace/packages-list-cache/src/createPackagesList.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import { type PackagesList, type ProjectsList } from './types'
44
export interface CreatePackagesListOptions {
55
allProjects: ProjectsList
66
catalogs: Catalogs | undefined
7-
filtered: boolean
87
lastValidatedTimestamp: number
98
}
109

1110
export const createPackagesList = (opts: CreatePackagesListOptions): PackagesList => ({
1211
catalogs: opts.catalogs,
13-
filtered: opts.filtered,
1412
lastValidatedTimestamp: opts.lastValidatedTimestamp,
1513
projectRootDirs: opts.allProjects.map(project => project.rootDir).sort(),
1614
})

workspace/packages-list-cache/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export type ProjectsList = Array<Pick<Project, 'rootDir'>>
55

66
export interface PackagesList {
77
catalogs: Catalogs | undefined
8-
filtered: boolean
98
lastValidatedTimestamp: number
109
projectRootDirs: ProjectRootDir[]
1110
}

workspace/packages-list-cache/src/updatePackagesList.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { type ProjectsList } from './types'
99
export interface UpdatePackagesListOptions {
1010
allProjects: ProjectsList
1111
catalogs: Catalogs | undefined
12-
filtered: boolean
1312
lastValidatedTimestamp: number
1413
workspaceDir: string
1514
}

workspace/packages-list-cache/test/createPackagesList.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ test('createPackagesList() on empty list', () => {
1212
createPackagesList({
1313
allProjects: [],
1414
catalogs: undefined,
15-
filtered: false,
1615
lastValidatedTimestamp,
1716
})
1817
).toStrictEqual({
1918
catalogs: undefined,
20-
filtered: false,
2119
lastValidatedTimestamp,
2220
projectRootDirs: [],
2321
})
@@ -37,7 +35,6 @@ test('createPackagesList() on non-empty list', () => {
3735
{ rootDir: path.resolve('packages/a') as ProjectRootDir },
3836
{ rootDir: path.resolve('packages/d') as ProjectRootDir },
3937
],
40-
filtered: false,
4138
lastValidatedTimestamp,
4239
catalogs: {
4340
default: {
@@ -51,7 +48,6 @@ test('createPackagesList() on non-empty list', () => {
5148
foo: '0.1.2',
5249
},
5350
},
54-
filtered: false,
5551
lastValidatedTimestamp,
5652
projectRootDirs: [
5753
path.resolve('packages/a'),

workspace/packages-list-cache/test/loadPackagesList.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ test('loadPackagesList() when cache file exists and is correct', async () => {
4646
foo: '0.1.2',
4747
},
4848
},
49-
filtered: false,
5049
lastValidatedTimestamp,
5150
projectRootDirs: [
5251
path.resolve('packages/a') as ProjectRootDir,

workspace/packages-list-cache/test/updatePackagesList.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ test('updatePackagesList()', async () => {
2626
lastValidatedTimestamp,
2727
workspaceDir,
2828
catalogs: undefined,
29-
filtered: false,
3029
allProjects: [],
3130
})
3231
expect((logger.debug as jest.Mock).mock.calls).toStrictEqual([[{ msg: 'updating packages list' }]])
3332
expect(loadPackagesList(workspaceDir)).toStrictEqual({
34-
filtered: false,
3533
lastValidatedTimestamp,
3634
projectRootDirs: [],
3735
})
@@ -45,7 +43,6 @@ test('updatePackagesList()', async () => {
4543
foo: '0.1.2',
4644
},
4745
},
48-
filtered: false,
4946
allProjects: [
5047
{ rootDir: path.resolve('packages/c') as ProjectRootDir },
5148
{ rootDir: path.resolve('packages/a') as ProjectRootDir },
@@ -60,7 +57,6 @@ test('updatePackagesList()', async () => {
6057
foo: '0.1.2',
6158
},
6259
},
63-
filtered: false,
6460
lastValidatedTimestamp,
6561
projectRootDirs: [
6662
path.resolve('packages/a'),

0 commit comments

Comments
 (0)