mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
feat: --ignore-workspace option
This commit is contained in:
7
.changeset/six-eagles-allow.md
Normal file
7
.changeset/six-eagles-allow.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/config": minor
|
||||
"@pnpm/parse-cli-args": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
New CLI option: `--ignore-workspace`. When used, pnpm ignores any workspace configuration found in the current or parent directories.
|
||||
@@ -61,6 +61,7 @@ export const types = Object.assign({
|
||||
hoist: Boolean,
|
||||
'hoist-pattern': Array,
|
||||
'ignore-pnpmfile': Boolean,
|
||||
'ignore-workspace': Boolean,
|
||||
'ignore-workspace-root-check': Boolean,
|
||||
'link-workspace-packages': [Boolean, 'deep'],
|
||||
lockfile: Boolean,
|
||||
|
||||
@@ -120,7 +120,7 @@ export default async function parseCliArgs (
|
||||
}
|
||||
}
|
||||
const dir = options['dir'] ?? process.cwd()
|
||||
const workspaceDir = options['global'] // eslint-disable-line
|
||||
const workspaceDir = options['global'] || options['ignore-workspace'] // eslint-disable-line
|
||||
? undefined
|
||||
: await findWorkspaceDir(dir)
|
||||
if (options['workspace-root']) {
|
||||
|
||||
@@ -66,6 +66,14 @@ test('when runnning a global command inside a workspace, the workspace should be
|
||||
expect(workspaceDir).toBeFalsy()
|
||||
})
|
||||
|
||||
test('when runnning with --ignore-workspace option inside a workspace, the workspace should be ignored', async () => {
|
||||
const { workspaceDir } = await parseCliArgs({
|
||||
...DEFAULT_OPTS,
|
||||
universalOptionsTypes: { global: Boolean },
|
||||
}, ['--ignore-workspace', 'add', 'foo'])
|
||||
expect(workspaceDir).toBeFalsy()
|
||||
})
|
||||
|
||||
test('command is used recursively', async () => {
|
||||
const { cmd, options } = await parseCliArgs({
|
||||
...DEFAULT_OPTS,
|
||||
|
||||
@@ -42,6 +42,7 @@ export const GLOBAL_OPTIONS = pick([
|
||||
'test-pattern',
|
||||
'changed-files-ignore-pattern',
|
||||
'use-stderr',
|
||||
'ignore-workspace',
|
||||
'workspace-packages',
|
||||
'workspace-root',
|
||||
], allTypes)
|
||||
|
||||
Reference in New Issue
Block a user