mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
5
.changeset/tasty-lies-fold.md
Normal file
5
.changeset/tasty-lies-fold.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/config": patch
|
||||
---
|
||||
|
||||
When public-hoist-pattern is set to an empty string or a list with a single empty string, then it is considered to be undefined.
|
||||
5
.changeset/violet-jokes-pay.md
Normal file
5
.changeset/violet-jokes-pay.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/get-context": patch
|
||||
---
|
||||
|
||||
publicHoistPattern=undefined should be considered to be the same as publicHoistPattern='' (empty string).
|
||||
@@ -326,6 +326,18 @@ export default async (
|
||||
case true:
|
||||
pnpmConfig.publicHoistPattern = ['*']
|
||||
break
|
||||
default:
|
||||
if (
|
||||
!pnpmConfig.publicHoistPattern ||
|
||||
(
|
||||
Array.isArray(pnpmConfig.publicHoistPattern) &&
|
||||
pnpmConfig.publicHoistPattern.length === 1 &&
|
||||
pnpmConfig.publicHoistPattern[0] === ''
|
||||
)
|
||||
) {
|
||||
delete pnpmConfig.publicHoistPattern
|
||||
}
|
||||
break
|
||||
}
|
||||
if (typeof pnpmConfig['color'] === 'boolean') {
|
||||
switch (pnpmConfig['color']) {
|
||||
|
||||
@@ -422,6 +422,36 @@ test('throw error if --no-hoist is used with --hoist-pattern', async (t) => {
|
||||
}
|
||||
})
|
||||
|
||||
test('normalizing the value of public-hoist-pattern', async (t) => {
|
||||
{
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
'public-hoist-pattern': '',
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
version: '1.0.0',
|
||||
},
|
||||
})
|
||||
|
||||
t.equal(config.publicHoistPattern, undefined)
|
||||
}
|
||||
{
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
'public-hoist-pattern': [''],
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
version: '1.0.0',
|
||||
},
|
||||
})
|
||||
|
||||
t.equal(config.publicHoistPattern, undefined)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('rawLocalConfig in a workspace', async (t) => {
|
||||
const tmp = tempy.directory()
|
||||
t.comment(`temp dir created: ${tmp}`)
|
||||
|
||||
@@ -199,7 +199,10 @@ async function validateModules (
|
||||
}
|
||||
): Promise<{ purged: boolean }> {
|
||||
const rootProject = projects.find(({ id }) => id === '.')
|
||||
if (opts.forcePublicHoistPattern && !R.equals(modules.publicHoistPattern, opts.publicHoistPattern)) {
|
||||
if (
|
||||
opts.forcePublicHoistPattern &&
|
||||
!R.equals(modules.publicHoistPattern, opts.publicHoistPattern || undefined)
|
||||
) {
|
||||
if (opts.forceNewModules && rootProject) {
|
||||
await purgeModulesDirsOfImporter(rootProject)
|
||||
return { purged: true }
|
||||
|
||||
Reference in New Issue
Block a user