mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-07 07:27:06 -04:00
refactor: localConfig=>rawLocalConfig
This commit is contained in:
@@ -7,7 +7,7 @@ export interface Config {
|
||||
useBetaCli: boolean,
|
||||
extraBinPaths: string[],
|
||||
filter: string[],
|
||||
localConfig: Record<string, any>, // tslint:disable-line
|
||||
rawLocalConfig: Record<string, any>, // tslint:disable-line
|
||||
rawConfig: Record<string, any>, // tslint:disable-line
|
||||
globalPrefix: string,
|
||||
globalBin: string,
|
||||
|
||||
@@ -181,13 +181,13 @@ export default async (
|
||||
: npmConfig.get(configKey)
|
||||
return acc
|
||||
}, {} as Config)
|
||||
pnpmConfig.localConfig = Object.assign.apply(Object, [
|
||||
pnpmConfig.rawLocalConfig = Object.assign.apply(Object, [
|
||||
{},
|
||||
...npmConfig.list.slice(3, pnpmConfig.workspacePrefix && pnpmConfig.workspacePrefix !== pnpmConfig.localPrefix ? 5 : 4),
|
||||
cliArgs,
|
||||
] as any) // tslint:disable-line:no-any
|
||||
pnpmConfig.userAgent = pnpmConfig.localConfig['user-agent']
|
||||
? pnpmConfig.localConfig['user-agent']
|
||||
pnpmConfig.userAgent = pnpmConfig.rawLocalConfig['user-agent']
|
||||
? pnpmConfig.rawLocalConfig['user-agent']
|
||||
: `${packageManager.name}/${packageManager.version} npm/? node/${process.version} ${process.platform} ${process.arch}`
|
||||
pnpmConfig.rawConfig = Object.assign.apply(Object, [
|
||||
{ registry: 'https://registry.npmjs.org/' },
|
||||
|
||||
@@ -629,7 +629,7 @@ test('do not throw error if --independent-leaves is used with --no-hoist', async
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('localConfig in a workspace', async (t) => {
|
||||
test('rawLocalConfig in a workspace', async (t) => {
|
||||
const tmp = tempy.directory()
|
||||
t.comment(`temp dir created: ${tmp}`)
|
||||
|
||||
@@ -650,7 +650,7 @@ test('localConfig in a workspace', async (t) => {
|
||||
},
|
||||
})
|
||||
|
||||
t.deepEqual(config.localConfig, {
|
||||
t.deepEqual(config.rawLocalConfig, {
|
||||
'hoist-pattern': 'eslint-*',
|
||||
'independent-leaves': true,
|
||||
'save-exact': true,
|
||||
@@ -658,7 +658,7 @@ test('localConfig in a workspace', async (t) => {
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('localConfig', async (t) => {
|
||||
test('rawLocalConfig', async (t) => {
|
||||
const tmp = tempy.directory()
|
||||
t.comment(`temp dir created: ${tmp}`)
|
||||
|
||||
@@ -675,7 +675,7 @@ test('localConfig', async (t) => {
|
||||
},
|
||||
})
|
||||
|
||||
t.deepEqual(config.localConfig, {
|
||||
t.deepEqual(config.rawLocalConfig, {
|
||||
'independent-leaves': true,
|
||||
'save-exact': true,
|
||||
})
|
||||
|
||||
@@ -58,9 +58,9 @@ export default async function installCmd (
|
||||
store: store.path,
|
||||
storeController: store.ctrl,
|
||||
|
||||
forceHoistPattern: typeof opts.localConfig['hoist-pattern'] !== 'undefined' || typeof opts.localConfig['hoist'] !== 'undefined',
|
||||
forceIndependentLeaves: typeof opts.localConfig['independent-leaves'] !== 'undefined',
|
||||
forceShamefullyHoist: typeof opts.localConfig['shamefully-hoist'] !== 'undefined',
|
||||
forceHoistPattern: typeof opts.rawLocalConfig['hoist-pattern'] !== 'undefined' || typeof opts.rawLocalConfig['hoist'] !== 'undefined',
|
||||
forceIndependentLeaves: typeof opts.rawLocalConfig['independent-leaves'] !== 'undefined',
|
||||
forceShamefullyHoist: typeof opts.rawLocalConfig['shamefully-hoist'] !== 'undefined',
|
||||
}
|
||||
|
||||
let { manifest, writeImporterManifest } = await tryReadImporterManifest(opts.prefix, opts)
|
||||
|
||||
@@ -199,9 +199,9 @@ export async function recursive (
|
||||
storeController,
|
||||
targetDependenciesField: getSaveType(opts),
|
||||
|
||||
forceHoistPattern: typeof opts.localConfig['hoist-pattern'] !== 'undefined' || typeof opts.localConfig['hoist'] !== 'undefined',
|
||||
forceIndependentLeaves: typeof opts.localConfig['independent-leaves'] !== 'undefined',
|
||||
forceShamefullyHoist: typeof opts.localConfig['shamefully-hoist'] !== 'undefined',
|
||||
forceHoistPattern: typeof opts.rawLocalConfig['hoist-pattern'] !== 'undefined' || typeof opts.rawLocalConfig['hoist'] !== 'undefined',
|
||||
forceIndependentLeaves: typeof opts.rawLocalConfig['independent-leaves'] !== 'undefined',
|
||||
forceShamefullyHoist: typeof opts.rawLocalConfig['shamefully-hoist'] !== 'undefined',
|
||||
}) as InstallOptions
|
||||
|
||||
const result = {
|
||||
|
||||
Reference in New Issue
Block a user