diff --git a/src/package-managers/npm.ts b/src/package-managers/npm.ts index 7ac1ac77..0ad54580 100644 --- a/src/package-managers/npm.ts +++ b/src/package-managers/npm.ts @@ -361,7 +361,13 @@ async function viewMany( const npmConfigProjectPath = options.packageFile ? path.join(options.packageFile, '../.npmrc') : null const npmConfigProject = options.packageFile ? findNpmConfig(npmConfigProjectPath || undefined) : null const npmConfigCWDPath = options.cwd ? path.join(options.cwd, '.npmrc') : null + // const npmConfigLocal2 = findNpmConfig() + // const npmConfigLocal2 = findNpmConfig('./') + // const npmConfigLocal2 = findNpmConfig(process.cwd()) + console.log('!!!', process.cwd()) + const npmConfigLocal2 = findNpmConfig(path.join(process.cwd(), '.npmrc')) const npmConfigCWD = options.cwd ? findNpmConfig(npmConfigCWDPath!) : null + console.log({ npmConfigWorkspaceProject }) if (npmConfigWorkspaceProject && Object.keys(npmConfigWorkspaceProject).length > 0) { print(options, `\nnpm config (workspace project):`, 'verbose') @@ -373,13 +379,18 @@ async function viewMany( print(options, omit(npmConfig, 'cache'), 'verbose') } + if (npmConfigLocal2 && Object.keys(npmConfigLocal2).length > 0) { + print(options, `\nnpm config (local2):`, 'verbose') + print(options, omit(npmConfigLocal2, 'cache'), 'verbose') + } + if (npmConfigLocal && Object.keys(npmConfigLocal).length > 0) { print(options, `\nnpm config (local override):`, 'verbose') print(options, omit(npmConfigLocal, 'cache'), 'verbose') } if (npmConfigProject && Object.keys(npmConfigProject).length > 0) { - print(options, `\npm config (project: ${npmConfigProjectPath}):`, 'verbose') + print(options, `\nnpm config (project: ${npmConfigProjectPath}):`, 'verbose') print(options, omit(npmConfigProject, 'cache'), 'verbose') } @@ -393,6 +404,7 @@ async function viewMany( ...npmConfigWorkspaceProject, ...npmConfig, ...npmConfigLocal, + ...npmConfigLocal2, ...npmConfigProject, ...npmConfigCWD, ...(options.registry ? { registry: options.registry, silent: true } : null), @@ -400,7 +412,7 @@ async function viewMany( fullMetadata: fieldsExtended.includes('time'), } - const isMerged = npmConfigWorkspaceProject || npmConfigLocal || npmConfigProject || npmConfigCWD + const isMerged = npmConfigWorkspaceProject || npmConfigLocal || npmConfigLocal2 || npmConfigProject || npmConfigCWD print(options, `\nUsing${isMerged ? ' merged' : ''} npm config:`, 'verbose') // omit cache since it is added to every config print(options, omit(npmConfigMerged, 'cache'), 'verbose') diff --git a/src/package-managers/pnpm.ts b/src/package-managers/pnpm.ts index 3654208b..cec2d952 100644 --- a/src/package-managers/pnpm.ts +++ b/src/package-managers/pnpm.ts @@ -36,6 +36,7 @@ type PnpmList = { /** Reads the npmrc config file from the pnpm-workspace.yaml directory. */ const npmConfigFromPnpmWorkspace = memoize(async (options: Options): Promise => { const pnpmWorkspacePath = await findUp('pnpm-workspace.yaml') + console.log({ pnpmWorkspacePath }) if (!pnpmWorkspacePath) return {} const pnpmWorkspaceDir = path.dirname(pnpmWorkspacePath) diff --git a/test/workspaces.test.ts b/test/workspaces.test.ts index 2c865ac1..878b7e23 100644 --- a/test/workspaces.test.ts +++ b/test/workspaces.test.ts @@ -429,7 +429,7 @@ describe('stubbed', () => { }) describe('pnpm', () => { - it('read packages from pnpm-workspaces.yaml', async () => { + it('read packages from pnpm-workspace.yaml', async () => { const tempDir = await setup(['packages/**'], { pnpm: true }) try { const output = await spawn('node', [bin, '--jsonAll', '--workspaces'], { cwd: tempDir }).then(JSON.parse)