mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 23:58:07 -05:00
5
.changeset/tiny-nails-allow.md
Normal file
5
.changeset/tiny-nails-allow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": minor
|
||||
---
|
||||
|
||||
New setting added to turn back v6 directory filtering that doesn't require globs: `legacy-dir-filtering`.
|
||||
@@ -141,6 +141,7 @@ export interface Config {
|
||||
modulesCacheMaxAge: number
|
||||
embedReadme?: boolean
|
||||
gitShallowHosts?: string[]
|
||||
legacyDirFiltering?: boolean
|
||||
|
||||
registries: Registries
|
||||
ignoreWorkspaceRootCheck: boolean
|
||||
|
||||
@@ -58,6 +58,7 @@ export const types = Object.assign({
|
||||
'ignore-pnpmfile': Boolean,
|
||||
'ignore-workspace': Boolean,
|
||||
'ignore-workspace-root-check': Boolean,
|
||||
'legacy-dir-filtering': Boolean,
|
||||
'link-workspace-packages': [Boolean, 'deep'],
|
||||
lockfile: Boolean,
|
||||
'lockfile-dir': String,
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
In pnpm v7, a glob should be used: `--filter=./apps/**`
|
||||
|
||||
For easier upgrade, we have also added a setting to turn back filtering as it was in v6. Just set `legacy-dir-filtering=true` in `.npmrc`.
|
||||
|
||||
- The `NODE_PATH` env variable is not set in the command shims (the files in `node_modules/.bin`). This env variable was really long and frequently caused errors on Windows.
|
||||
|
||||
Also, the `extend-node-path` setting is removed.
|
||||
|
||||
@@ -200,7 +200,7 @@ export default async function run (inputArgv: string[]) {
|
||||
workspaceDir: wsDir,
|
||||
testPattern: config.testPattern,
|
||||
changedFilesIgnorePattern: config.changedFilesIgnorePattern,
|
||||
useGlobDirFiltering: true,
|
||||
useGlobDirFiltering: !config.legacyDirFiltering,
|
||||
})
|
||||
config.selectedProjectsGraph = filterResults.selectedProjectsGraph
|
||||
if (isEmpty(config.selectedProjectsGraph)) {
|
||||
|
||||
@@ -1498,3 +1498,64 @@ test('pnpm run should include the workspace root when --workspace-root option is
|
||||
expect(await exists('test')).toBeTruthy()
|
||||
expect(await exists('project/test')).toBeTruthy()
|
||||
})
|
||||
|
||||
test('legacy directory filtering', async () => {
|
||||
preparePackages([
|
||||
{
|
||||
location: 'packages/project-1',
|
||||
package: {
|
||||
name: 'project-1',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
{
|
||||
location: 'packages/project-2',
|
||||
package: {
|
||||
name: 'project-2',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
process.chdir('..')
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
await fs.writeFile('.npmrc', 'legacy-dir-filtering=true', 'utf8')
|
||||
|
||||
const { stdout } = execPnpmSync(['list', '--filter=./packages', '--parseable', '--depth=-1'])
|
||||
const output = stdout.toString()
|
||||
expect(output).toContain('project-1')
|
||||
expect(output).toContain('project-2')
|
||||
})
|
||||
|
||||
test('directory filtering', async () => {
|
||||
preparePackages([
|
||||
{
|
||||
location: 'packages/project-1',
|
||||
package: {
|
||||
name: 'project-1',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
{
|
||||
location: 'packages/project-2',
|
||||
package: {
|
||||
name: 'project-2',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
process.chdir('..')
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
|
||||
{
|
||||
const { stdout } = execPnpmSync(['list', '--filter=./packages', '--parseable', '--depth=-1'])
|
||||
expect(stdout.toString()).toEqual('')
|
||||
}
|
||||
{
|
||||
const { stdout } = execPnpmSync(['list', '--filter=./packages/**', '--parseable', '--depth=-1'])
|
||||
const output = stdout.toString()
|
||||
expect(output).toContain('project-1')
|
||||
expect(output).toContain('project-2')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user