diff --git a/config/plugin-commands-config/src/configGet.ts b/config/plugin-commands-config/src/configGet.ts index e373a8a08b..7815e16379 100644 --- a/config/plugin-commands-config/src/configGet.ts +++ b/config/plugin-commands-config/src/configGet.ts @@ -1,7 +1,7 @@ import kebabCase from 'lodash.kebabcase' import { runNpm } from '@pnpm/run-npm' import { type ConfigCommandOptions } from './ConfigCommandOptions' -import { settingShouldFallBackToNpm } from './configSet' +import { settingShouldFallBackToNpm } from './settingShouldFallBackToNpm' export function configGet (opts: ConfigCommandOptions, key: string): { output: string, exitCode: number } { if (opts.global && settingShouldFallBackToNpm(key)) { diff --git a/config/plugin-commands-config/src/configSet.ts b/config/plugin-commands-config/src/configSet.ts index 102f07c3a0..4413e80ea8 100644 --- a/config/plugin-commands-config/src/configSet.ts +++ b/config/plugin-commands-config/src/configSet.ts @@ -9,6 +9,7 @@ import kebabCase from 'lodash.kebabcase' import { readIniFile } from 'read-ini-file' import { writeIniFile } from 'write-ini-file' import { type ConfigCommandOptions } from './ConfigCommandOptions' +import { settingShouldFallBackToNpm } from './settingShouldFallBackToNpm' export async function configSet (opts: ConfigCommandOptions, key: string, value: string | null): Promise { if (opts.global && settingShouldFallBackToNpm(key)) { @@ -72,14 +73,6 @@ function castField (value: unknown, key: string) { return value } -export function settingShouldFallBackToNpm (key: string): boolean { - return ( - ['registry', '_auth', '_authToken', 'username', '_password'].includes(key) || - key[0] === '@' || - key.startsWith('//') - ) -} - async function safeReadIniFile (configPath: string): Promise> { try { return await readIniFile(configPath) as Record diff --git a/config/plugin-commands-config/src/settingShouldFallBackToNpm.ts b/config/plugin-commands-config/src/settingShouldFallBackToNpm.ts new file mode 100644 index 0000000000..aa44437f9f --- /dev/null +++ b/config/plugin-commands-config/src/settingShouldFallBackToNpm.ts @@ -0,0 +1,7 @@ +export function settingShouldFallBackToNpm (key: string): boolean { + return ( + ['registry', '_auth', '_authToken', 'username', '_password'].includes(key) || + key[0] === '@' || + key.startsWith('//') + ) +}