Skip to content

Commit

Permalink
feat: remove deprecated settings (#4519)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Apr 1, 2022
1 parent 8dac029 commit 4bed585
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 38 deletions.
14 changes: 14 additions & 0 deletions .changeset/tall-berries-know.md
@@ -0,0 +1,14 @@
---
"@pnpm/config": major
"pnpm": major
---

The next deprecated settings were removed:

* frozen-shrinkwrap
* prefer-frozen-shrinkwrap
* shared-workspace-shrinkwrap
* shrinkwrap-directory
* lockfile-directory
* shrinkwrap-only
* store
6 changes: 0 additions & 6 deletions packages/config/src/Config.ts
Expand Up @@ -152,12 +152,6 @@ export interface Config {
}

export interface ConfigWithDeprecatedSettings extends Config {
frozenShrinkwrap?: boolean
globalPrefix?: string
proxy?: string
lockfileDirectory?: string
preferFrozenShrinkwrap?: boolean
sharedWorkspaceShrinkwrap?: boolean
shrinkwrapDirectory?: string
shrinkwrapOnly?: boolean
}
26 changes: 0 additions & 26 deletions packages/config/src/index.ts
Expand Up @@ -46,7 +46,6 @@ export const types = Object.assign({
filter: [String, Array],
'filter-prod': [String, Array],
'frozen-lockfile': Boolean,
'frozen-shrinkwrap': Boolean,
'git-checks': Boolean,
'global-bin-dir': String,
'global-dir': String,
Expand Down Expand Up @@ -74,7 +73,6 @@ export const types = Object.assign({
'package-import-method': ['auto', 'hardlink', 'clone', 'copy'],
pnpmfile: String,
'prefer-frozen-lockfile': Boolean,
'prefer-frozen-shrinkwrap': Boolean,
'prefer-offline': Boolean,
'prefer-workspace-packages': Boolean,
production: [null, true],
Expand All @@ -89,16 +87,12 @@ export const types = Object.assign({
'shamefully-flatten': Boolean,
'shamefully-hoist': Boolean,
'shared-workspace-lockfile': Boolean,
'shared-workspace-shrinkwrap': Boolean,
'shell-emulator': Boolean,
'shrinkwrap-directory': String,
'shrinkwrap-only': Boolean,
'side-effects-cache': Boolean,
'side-effects-cache-readonly': Boolean,
symlink: Boolean,
sort: Boolean,
'state-dir': String,
store: String, // TODO: deprecate
'store-dir': String,
stream: Boolean,
'strict-peer-dependencies': Boolean,
Expand Down Expand Up @@ -200,9 +194,7 @@ export default async (
'side-effects-cache': true,
symlink: true,
'shared-workspace-lockfile': true,
'shared-workspace-shrinkwrap': true,
'shell-emulator': false,
shrinkwrap: npmDefaults.shrinkwrap,
reverse: false,
sort: true,
'strict-peer-dependencies': true,
Expand Down Expand Up @@ -252,25 +244,11 @@ export default async (
default: normalizeRegistryUrl(pnpmConfig.rawConfig.registry),
...getScopeRegistries(pnpmConfig.rawConfig),
}
pnpmConfig.lockfileDir = pnpmConfig.lockfileDir ?? pnpmConfig.lockfileDirectory ?? pnpmConfig.shrinkwrapDirectory
pnpmConfig.useLockfile = (() => {
if (typeof pnpmConfig['lockfile'] === 'boolean') return pnpmConfig['lockfile']
if (typeof pnpmConfig['packageLock'] === 'boolean') return pnpmConfig['packageLock']
if (typeof pnpmConfig['shrinkwrap'] === 'boolean') return pnpmConfig['shrinkwrap']
return false
})()
pnpmConfig.lockfileOnly = typeof pnpmConfig['lockfileOnly'] === 'undefined'
? pnpmConfig.shrinkwrapOnly
: pnpmConfig['lockfileOnly']
pnpmConfig.frozenLockfile = typeof pnpmConfig['frozenLockfile'] === 'undefined'
? pnpmConfig.frozenShrinkwrap
: pnpmConfig['frozenLockfile']
pnpmConfig.preferFrozenLockfile = typeof pnpmConfig['preferFrozenLockfile'] === 'undefined'
? pnpmConfig.preferFrozenShrinkwrap
: pnpmConfig['preferFrozenLockfile']
pnpmConfig.sharedWorkspaceLockfile = typeof pnpmConfig['sharedWorkspaceLockfile'] === 'undefined'
? pnpmConfig.sharedWorkspaceShrinkwrap
: pnpmConfig['sharedWorkspaceLockfile']
pnpmConfig.pnpmHomeDir = getDataDir(process)

if (cliOptions['global']) {
Expand Down Expand Up @@ -377,10 +355,6 @@ export default async (
warnings.push('The "shamefully-flatten" setting has been renamed to "shamefully-hoist". Also, in most cases you won\'t need "shamefully-hoist". Since v4, a semistrict node_modules structure is on by default (via hoist-pattern=[*]).')
pnpmConfig.shamefullyHoist = true
}
if (!pnpmConfig.storeDir && pnpmConfig['store']) {
warnings.push('The "store" setting has been renamed to "store-dir". Please use the new name.')
pnpmConfig.storeDir = pnpmConfig['store']
}
if (!pnpmConfig.cacheDir) {
pnpmConfig.cacheDir = getCacheDir(process)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/config/test/index.ts
Expand Up @@ -148,13 +148,13 @@ test('throw error if --virtual-store-dir is used with --global', async () => {
}
})

test('when using --global, link-workspace-packages, shared-workspace-shrinwrap and lockfile-directory are false even if it is set to true in a .npmrc file', async () => {
test('when using --global, link-workspace-packages, shared-workspace-lockfile and lockfile-dir are false even if it is set to true in a .npmrc file', async () => {
prepareEmpty()

const npmrc = [
'link-workspace-packages=true',
'shared-workspace-lockfile=true',
'lockfile-directory=/home/src',
'lockfile-dir=/home/src',
].join('\n')
await fs.writeFile('.npmrc', npmrc, 'utf8')
await fs.writeFile('pnpm-workspace.yaml', '', 'utf8')
Expand Down
4 changes: 0 additions & 4 deletions packages/pnpm/src/shorthands.ts
Expand Up @@ -29,10 +29,6 @@ export default {
E: '--save-exact',
O: '--save-optional',
C: '--dir',
'shrinkwrap-only': '--lockfile-only',
'shared-workspace-shrinkwrap': '--shared-workspace-lockfile',
'frozen-shrinkwrap': '--frozen-lockfile',
'prefer-frozen-shrinkwrap': '--prefer-frozen-lockfile',
w: '--workspace-root',
i: '--interactive',
F: '--filter',
Expand Down

0 comments on commit 4bed585

Please sign in to comment.