@pnpm/config
Advanced tools
Comparing version 4.1.4 to 5.0.0
@@ -12,8 +12,7 @@ import { IncludedDependencies, Registries } from '@pnpm/types'; | ||
rawConfig: Record<string, any>; | ||
globalPrefix: string; | ||
globalBin: string; | ||
dryRun?: boolean; | ||
global?: boolean; | ||
prefix: string; | ||
localPrefix: string; | ||
globalDir: string; | ||
dir: string; | ||
bin?: string; | ||
@@ -69,3 +68,3 @@ ignoreScripts?: boolean; | ||
alwaysAuth?: boolean; | ||
store?: string; | ||
storeDir?: string; | ||
virtualStoreDir?: string; | ||
@@ -88,3 +87,3 @@ verifyStoreIntegrity?: boolean; | ||
workspaceConcurrency: number; | ||
workspacePrefix?: string; | ||
workspaceDir?: string; | ||
reporter?: string; | ||
@@ -95,3 +94,3 @@ linkWorkspacePackages: boolean; | ||
pending: boolean; | ||
lockfileDirectory?: string; | ||
lockfileDir?: string; | ||
sharedWorkspaceLockfile?: boolean; | ||
@@ -108,2 +107,4 @@ useLockfile: boolean; | ||
frozenShrinkwrap?: boolean; | ||
globalPrefix?: string; | ||
lockfileDirectory?: string; | ||
shrinkwrapDirectory?: string; | ||
@@ -110,0 +111,0 @@ shrinkwrapOnly?: boolean; |
@@ -25,2 +25,3 @@ "use strict"; | ||
'dev': [null, true], | ||
'dir': String, | ||
'fetching-concurrency': Number, | ||
@@ -30,3 +31,4 @@ 'filter': [String, Array], | ||
'frozen-shrinkwrap': Boolean, | ||
'global-path': path, | ||
'global-dir': String, | ||
'global-path': String, | ||
'global-pnpmfile': String, | ||
@@ -45,3 +47,4 @@ 'hoist': Boolean, | ||
'lockfile': Boolean, | ||
'lockfile-directory': path, | ||
'lockfile-dir': String, | ||
'lockfile-directory': String, | ||
'lockfile-only': Boolean, | ||
@@ -67,3 +70,3 @@ 'network-concurrency': Number, | ||
'shared-workspace-shrinkwrap': Boolean, | ||
'shrinkwrap-directory': path, | ||
'shrinkwrap-directory': String, | ||
'shrinkwrap-only': Boolean, | ||
@@ -73,3 +76,4 @@ 'side-effects-cache': Boolean, | ||
'sort': Boolean, | ||
'store': path, | ||
'store': String, | ||
'store-dir': String, | ||
'strict-peer-dependencies': Boolean, | ||
@@ -83,9 +87,9 @@ 'table': Boolean, | ||
'workspace-concurrency': Number, | ||
'workspace-prefix': String, | ||
}, npmTypes.types); | ||
const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml'; | ||
exports.default = async (opts) => { | ||
const packageManager = opts && opts.packageManager || { name: 'pnpm', version: 'undefined' }; | ||
const cliArgs = opts && opts.cliArgs || {}; | ||
const command = opts.command || []; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
const packageManager = (_a = opts.packageManager, (_a !== null && _a !== void 0 ? _a : { name: 'pnpm', version: 'undefined' })); | ||
const cliArgs = (_b = opts.cliArgs, (_b !== null && _b !== void 0 ? _b : {})); | ||
const command = (_c = opts.command, (_c !== null && _c !== void 0 ? _c : [])); | ||
const warnings = new Array(); | ||
@@ -126,5 +130,6 @@ switch (command[command.length - 1]) { | ||
catch (err) { } // tslint:disable-line:no-empty | ||
const workspacePrefix = cliArgs['global'] // tslint:disable-line | ||
? null | ||
: (await findWorkspacePrefix(cliArgs['prefix'] || process.cwd()) || null); | ||
const dir = (_d = cliArgs['dir'], (_d !== null && _d !== void 0 ? _d : process.cwd())); | ||
const workspaceDir = cliArgs['global'] // tslint:disable-line | ||
? undefined | ||
: await findWorkspacePrefix(dir); | ||
const npmConfig = loadNpmConf(cliArgs, exports.types, { | ||
@@ -147,3 +152,2 @@ 'bail': true, | ||
'pending': false, | ||
'prefix': npmDefaults.prefix, | ||
'registry': npmDefaults.registry, | ||
@@ -164,3 +168,3 @@ 'resolution-strategy': 'fewer-dependencies', | ||
'workspace-concurrency': 4, | ||
'workspace-prefix': workspacePrefix, | ||
'workspace-prefix': workspaceDir, | ||
}); | ||
@@ -175,5 +179,7 @@ process.execPath = originalExecPath; | ||
}, {}); | ||
const cwd = (_e = (cliArgs['dir'] && path.resolve(cliArgs['dir'])), (_e !== null && _e !== void 0 ? _e : npmConfig.localPrefix)); // tslint:disable-line | ||
pnpmConfig.workspaceDir = workspaceDir; | ||
pnpmConfig.rawLocalConfig = Object.assign.apply(Object, [ | ||
{}, | ||
...npmConfig.list.slice(3, pnpmConfig.workspacePrefix && pnpmConfig.workspacePrefix !== pnpmConfig.localPrefix ? 5 : 4).reverse(), | ||
...npmConfig.list.slice(3, pnpmConfig.workspaceDir && pnpmConfig.workspaceDir !== cwd ? 5 : 4).reverse(), | ||
cliArgs, | ||
@@ -194,13 +200,10 @@ ]); // tslint:disable-line:no-any | ||
}; | ||
const npmGlobalPrefix = pnpmConfig.rawConfig['pnpm-prefix'] || | ||
(process.platform !== 'win32' | ||
? npmConfig.globalPrefix | ||
: findBestGlobalPrefixOnWindows_1.default(npmConfig.globalPrefix, process.env)); | ||
const npmGlobalPrefix = (_g = (_f = pnpmConfig.globalDir, (_f !== null && _f !== void 0 ? _f : pnpmConfig.rawConfig['pnpm-prefix'])), (_g !== null && _g !== void 0 ? _g : (process.platform !== 'win32' | ||
? npmConfig.globalPrefix | ||
: findBestGlobalPrefixOnWindows_1.default(npmConfig.globalPrefix, process.env)))); | ||
pnpmConfig.globalBin = process.platform === 'win32' | ||
? npmGlobalPrefix | ||
: path.resolve(npmGlobalPrefix, 'bin'); | ||
pnpmConfig.globalPrefix = path.join(npmGlobalPrefix, 'pnpm-global'); | ||
pnpmConfig.lockfileDirectory = typeof pnpmConfig['lockfileDirectory'] === 'undefined' | ||
? pnpmConfig.shrinkwrapDirectory | ||
: pnpmConfig['lockfileDirectory']; | ||
pnpmConfig.globalDir = pnpmConfig.globalDir ? npmGlobalPrefix : path.join(npmGlobalPrefix, 'pnpm-global'); | ||
pnpmConfig.lockfileDir = (_j = (_h = pnpmConfig.lockfileDir, (_h !== null && _h !== void 0 ? _h : pnpmConfig.lockfileDirectory)), (_j !== null && _j !== void 0 ? _j : pnpmConfig.shrinkwrapDirectory)); | ||
pnpmConfig.useLockfile = (() => { | ||
@@ -227,5 +230,4 @@ if (typeof pnpmConfig['lockfile'] === 'boolean') | ||
: pnpmConfig['sharedWorkspaceLockfile']; | ||
pnpmConfig.localPrefix = (cliArgs['prefix'] ? path.resolve(cliArgs['prefix']) : npmConfig.localPrefix); // tslint:disable-line | ||
if (pnpmConfig.global) { | ||
pnpmConfig.prefix = path.join(pnpmConfig.globalPrefix, constants_1.LAYOUT_VERSION.toString()); | ||
if (cliArgs['global']) { | ||
pnpmConfig.dir = path.join(pnpmConfig.globalDir, constants_1.LAYOUT_VERSION.toString()); | ||
pnpmConfig.bin = pnpmConfig.globalBin; | ||
@@ -256,3 +258,3 @@ pnpmConfig.allowNew = true; | ||
if (pnpmConfig.sharedWorkspaceLockfile) { | ||
if (opts.cliArgs['shared-workspace-lockfile'] || opts.cliArgs['shared-workspace-shrinkwrap']) { | ||
if (opts.cliArgs['shared-workspace-lockfile']) { | ||
throw new error_1.default('CONFIG_CONFLICT_SHARED_WORKSPACE_LOCKFILE_WITH_GLOBAL', 'Configuration conflict. "shared-workspace-lockfile" may not be used with "global"'); | ||
@@ -262,7 +264,7 @@ } | ||
} | ||
if (pnpmConfig.lockfileDirectory) { | ||
if (opts.cliArgs['lockfile-directory'] || opts.cliArgs['shrinkwrap-directory']) { | ||
throw new error_1.default('CONFIG_CONFLICT_LOCKFILE_DIRECTORY_WITH_GLOBAL', 'Configuration conflict. "lockfile-directory" may not be used with "global"'); | ||
if (pnpmConfig.lockfileDir) { | ||
if (opts.cliArgs['lockfile-dir']) { | ||
throw new error_1.default('CONFIG_CONFLICT_LOCKFILE_DIR_WITH_GLOBAL', 'Configuration conflict. "lockfile-dir" may not be used with "global"'); | ||
} | ||
delete pnpmConfig.lockfileDirectory; | ||
delete pnpmConfig.lockfileDir; | ||
} | ||
@@ -275,4 +277,4 @@ if (opts.cliArgs['virtual-store-dir']) { | ||
else { | ||
pnpmConfig.prefix = pnpmConfig.localPrefix; | ||
pnpmConfig.bin = path.join(pnpmConfig.prefix, 'node_modules', '.bin'); | ||
pnpmConfig.dir = cwd; | ||
pnpmConfig.bin = path.join(pnpmConfig.dir, 'node_modules', '.bin'); | ||
} | ||
@@ -288,4 +290,4 @@ if (opts.cliArgs['save-peer']) { | ||
} | ||
if (pnpmConfig.sharedWorkspaceLockfile && !pnpmConfig.lockfileDirectory) { | ||
pnpmConfig.lockfileDirectory = pnpmConfig.workspacePrefix || undefined; | ||
if (pnpmConfig.sharedWorkspaceLockfile && !pnpmConfig.lockfileDir && pnpmConfig.workspaceDir) { | ||
pnpmConfig.lockfileDir = pnpmConfig.workspaceDir; | ||
} | ||
@@ -316,4 +318,4 @@ pnpmConfig.packageManager = packageManager; | ||
pnpmConfig.sideEffectsCacheWrite = pnpmConfig.sideEffectsCache; | ||
if (!pnpmConfig.ignoreScripts && pnpmConfig.workspacePrefix) { | ||
pnpmConfig.extraBinPaths = [path.join(pnpmConfig.workspacePrefix, 'node_modules', '.bin')]; | ||
if (!pnpmConfig.ignoreScripts && pnpmConfig.workspaceDir) { | ||
pnpmConfig.extraBinPaths = [path.join(pnpmConfig.workspaceDir, 'node_modules', '.bin')]; | ||
} | ||
@@ -327,2 +329,6 @@ else { | ||
} | ||
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['hoist'] === false) { | ||
@@ -329,0 +335,0 @@ delete pnpmConfig.hoistPattern; |
{ | ||
"name": "@pnpm/config", | ||
"version": "4.1.4", | ||
"version": "5.0.0", | ||
"description": "Gets configuration options for pnpm", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@pnpm/constants": "2.0.0", | ||
"@pnpm/constants": "3.0.0", | ||
"@pnpm/error": "1.0.0", | ||
@@ -41,3 +41,2 @@ "@pnpm/types": "4.0.0", | ||
"is-subdir": "1.1.1", | ||
"path-absolute": "1.0.1", | ||
"which": "2.0.1" | ||
@@ -44,0 +43,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24084
8
503
+ Added@pnpm/constants@3.0.0(transitive)
- Removedpath-absolute@1.0.1
- Removed@pnpm/constants@2.0.0(transitive)
- Removedpath-absolute@1.0.1(transitive)
Updated@pnpm/constants@3.0.0