fix(yarn): sub package use root npmrc

This commit is contained in:
Rhys Arkins 2021-05-22 15:24:35 +02:00
parent 7eb2c09b6e
commit 3de02c37e4
3 changed files with 7 additions and 0 deletions

View file

@ -168,6 +168,8 @@ Array [
exports[`manager/npm/extract/monorepo .extractPackageFile() uses yarn workspaces package settings without lerna 1`] = ` exports[`manager/npm/extract/monorepo .extractPackageFile() uses yarn workspaces package settings without lerna 1`] = `
Array [ Array [
Object { Object {
"npmrc": "@org:registry=//registry.some.org
",
"packageFile": "package.json", "packageFile": "package.json",
"yarnWorkspacesPackages": "packages/*", "yarnWorkspacesPackages": "packages/*",
}, },
@ -178,6 +180,8 @@ Array [
"lernaJsonFile": undefined, "lernaJsonFile": undefined,
}, },
"npmLock": undefined, "npmLock": undefined,
"npmrc": "@org:registry=//registry.some.org
",
"packageFile": "packages/a/package.json", "packageFile": "packages/a/package.json",
"packageJsonName": "@org/a", "packageJsonName": "@org/a",
"yarnLock": "yarn.lock", "yarnLock": "yarn.lock",

View file

@ -139,6 +139,7 @@ describe(getName(), () => {
const packageFiles = [ const packageFiles = [
{ {
packageFile: 'package.json', packageFile: 'package.json',
npmrc: '@org:registry=//registry.some.org\n',
yarnWorkspacesPackages: 'packages/*', yarnWorkspacesPackages: 'packages/*',
}, },
{ {

View file

@ -17,6 +17,7 @@ export async function detectMonorepos(
packageFile, packageFile,
npmLock, npmLock,
yarnLock, yarnLock,
npmrc,
managerData = {}, managerData = {},
lernaClient, lernaClient,
lernaPackages, lernaPackages,
@ -52,6 +53,7 @@ export async function detectMonorepos(
subPackage.npmLock = subPackage.npmLock || npmLock; subPackage.npmLock = subPackage.npmLock || npmLock;
if (subPackage.yarnLock) { if (subPackage.yarnLock) {
subPackage.hasYarnWorkspaces = !!yarnWorkspacesPackages; subPackage.hasYarnWorkspaces = !!yarnWorkspacesPackages;
subPackage.npmrc = subPackage.npmrc || npmrc;
} }
if (!updateInternalDeps) { if (!updateInternalDeps) {
subPackage.deps?.forEach((dep) => { subPackage.deps?.forEach((dep) => {