Skip to content

Commit a302d8c

Browse files
committed
fix: avoid the overhead of local registry when testing against released version (incl. pkg.pr.new)
1 parent 2b0b6c6 commit a302d8c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

utils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export async function runInRepo(options: RunOptions & RepoOptions) {
329329
await testCommand?.(pkg.scripts)
330330
}
331331

332-
await applyPackageOverrides(dir, pkg, overrides)
332+
await applyPackageOverrides(dir, pkg, overrides, options.release)
333333
await beforeBuildCommand?.(pkg.scripts)
334334
await buildCommand?.(pkg.scripts)
335335
if (test) {
@@ -561,6 +561,7 @@ export async function applyPackageOverrides(
561561
dir: string,
562562
pkg: any,
563563
overrides: Overrides = {},
564+
useReleasedVersion?: string,
564565
) {
565566
const useFileProtocol = (v: string) =>
566567
isLocalOverride(v) ? `file:${path.resolve(v)}` : v
@@ -643,15 +644,18 @@ export async function applyPackageOverrides(
643644
// While `--registry` works for the `install` command,
644645
// we still need to persist the registry in `.npmrc` for any possible
645646
// subsequent commands that needs to connect to the registry.
646-
writeOrAppendNpmrc(dir, `registry=${REGISTRY_ADDRESS}\n`)
647+
// Skip this step if we are using a released version of the vue package to avoid the overhead
648+
if (!useReleasedVersion) {
649+
writeOrAppendNpmrc(dir, `registry=${REGISTRY_ADDRESS}\n`)
650+
}
647651

648652
// use of `ni` command here could cause lockfile violation errors so fall back to native commands that avoid these
649653
if (pm === 'pnpm') {
650-
await $`pnpm install --no-frozen-lockfile --no-strict-peer-dependencies --registry ${REGISTRY_ADDRESS}`
654+
await $`pnpm install --no-frozen-lockfile --no-strict-peer-dependencies`
651655
} else if (pm === 'yarn') {
652-
await $`yarn install --registry ${REGISTRY_ADDRESS}`
656+
await $`yarn install`
653657
} else if (pm === 'npm') {
654-
await $`npm install --registry ${REGISTRY_ADDRESS}`
658+
await $`npm install`
655659
}
656660
}
657661

0 commit comments

Comments
 (0)