Skip to content

Commit

Permalink
fix: the -r option is not supported by all cmds
Browse files Browse the repository at this point in the history
ref #2396
  • Loading branch information
zkochan committed Mar 14, 2020
1 parent d1ccc43 commit ff7d8eb
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 137 deletions.
6 changes: 4 additions & 2 deletions packages/parse-cli-args/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default async function parseCliArgs (
const commandName = getCommandName(noptExploratoryResults.argv.remain)
let cmd = commandName ? opts.getCommandLongName(commandName) : null
const types = {
'recursive': Boolean,
...opts.universalOptionsTypes,
...opts.getTypesByCommandName(commandName),
} as any // tslint:disable-line:no-any
Expand All @@ -74,7 +73,10 @@ export default async function parseCliArgs (
}

const { argv, ...options } = nopt(
types,
{
'recursive': Boolean,
...types,
},
{
...opts.universalShorthands,
...opts.shorthandsByCommandName[commandName],
Expand Down
104 changes: 53 additions & 51 deletions packages/plugin-commands-installation/src/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,57 +9,59 @@ import { InstallCommandOptions } from './install'
import installDeps from './installDeps'

export function rcOptionsTypes () {
return R.pick([
'child-concurrency',
'engine-strict',
'force',
'global-dir',
'global-pnpmfile',
'global',
'hoist',
'hoist-pattern',
'ignore-pnpmfile',
'ignore-scripts',
'ignore-workspace-root-check',
'independent-leaves',
'link-workspace-packages',
'lock',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'npmPath',
'package-import-method',
'pnpmfile',
'prefer-offline',
'production',
'recursive',
'registry',
'reporter',
'resolution-strategy',
'save-dev',
'save-exact',
'save-optional',
'save-peer',
'save-prod',
'save-workspace-protocol',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'strict-peer-dependencies',
'unsafe-perm',
'offline',
'only',
'optional',
'use-running-store-server',
'use-store-server',
'verify-store-integrity',
'virtual-store-dir',
], allTypes)
return {
...R.pick([
'child-concurrency',
'engine-strict',
'force',
'global-dir',
'global-pnpmfile',
'global',
'hoist',
'hoist-pattern',
'ignore-pnpmfile',
'ignore-scripts',
'ignore-workspace-root-check',
'independent-leaves',
'link-workspace-packages',
'lock',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'npmPath',
'package-import-method',
'pnpmfile',
'prefer-offline',
'production',
'registry',
'reporter',
'resolution-strategy',
'save-dev',
'save-exact',
'save-optional',
'save-peer',
'save-prod',
'save-workspace-protocol',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'strict-peer-dependencies',
'unsafe-perm',
'offline',
'only',
'optional',
'use-running-store-server',
'use-store-server',
'verify-store-integrity',
'virtual-store-dir',
], allTypes),
recursive: Boolean,
}
}

export function cliOptionsTypes () {
Expand Down
94 changes: 48 additions & 46 deletions packages/plugin-commands-installation/src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,54 @@ import installDeps from './installDeps'
export const rcOptionsTypes = cliOptionsTypes

export function cliOptionsTypes () {
return R.pick([
'child-concurrency',
'dev',
'engine-strict',
'frozen-lockfile',
'force',
'global-dir',
'global-pnpmfile',
'global',
'hoist',
'hoist-pattern',
'ignore-pnpmfile',
'ignore-scripts',
'independent-leaves',
'link-workspace-packages',
'lock',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'package-import-method',
'pnpmfile',
'prefer-frozen-lockfile',
'prefer-offline',
'production',
'recursive',
'registry',
'reporter',
'resolution-strategy',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'strict-peer-dependencies',
'offline',
'only',
'optional',
'unsafe-perm',
'use-running-store-server',
'use-store-server',
'verify-store-integrity',
'virtual-store-dir',
], allTypes)
return {
...R.pick([
'child-concurrency',
'dev',
'engine-strict',
'frozen-lockfile',
'force',
'global-dir',
'global-pnpmfile',
'global',
'hoist',
'hoist-pattern',
'ignore-pnpmfile',
'ignore-scripts',
'independent-leaves',
'link-workspace-packages',
'lock',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'package-import-method',
'pnpmfile',
'prefer-frozen-lockfile',
'prefer-offline',
'production',
'registry',
'reporter',
'resolution-strategy',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'strict-peer-dependencies',
'offline',
'only',
'optional',
'unsafe-perm',
'use-running-store-server',
'use-store-server',
'verify-store-integrity',
'virtual-store-dir',
], allTypes),
recursive: Boolean,
}
}

export const shorthands = {
Expand Down
78 changes: 40 additions & 38 deletions packages/plugin-commands-installation/src/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,46 @@ import installDeps from '../installDeps'
import getUpdateChoices from './getUpdateChoices'

export function rcOptionsTypes () {
return R.pick([
'depth',
'dev',
'engine-strict',
'force',
'global-dir',
'global-pnpmfile',
'global',
'ignore-pnpmfile',
'ignore-scripts',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'npmPath',
'offline',
'only',
'optional',
'package-import-method',
'pnpmfile',
'prefer-offline',
'production',
'recursive',
'registry',
'reporter',
'resolution-strategy',
'save',
'save-exact',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'unsafe-perm',
'use-running-store-server',
], allTypes)
return {
...R.pick([
'depth',
'dev',
'engine-strict',
'force',
'global-dir',
'global-pnpmfile',
'global',
'ignore-pnpmfile',
'ignore-scripts',
'lockfile-dir',
'lockfile-directory',
'lockfile-only',
'lockfile',
'npmPath',
'offline',
'only',
'optional',
'package-import-method',
'pnpmfile',
'prefer-offline',
'production',
'registry',
'reporter',
'resolution-strategy',
'save',
'save-exact',
'shamefully-flatten',
'shamefully-hoist',
'shared-workspace-lockfile',
'side-effects-cache-readonly',
'side-effects-cache',
'store',
'store-dir',
'unsafe-perm',
'use-running-store-server',
], allTypes),
recursive: Boolean,
}
}

export function cliOptionsTypes () {
Expand Down

0 comments on commit ff7d8eb

Please sign in to comment.