Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/utils/detectMaturity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ export async function detectMaturityConfig(cwd: string): Promise<DetectedMaturit
const pnpmYamlPath = findUp('pnpm-workspace.yaml', { cwd })
const pnpmYaml = await readYamlTop(pnpmYamlPath)
const pnpmExclude = readStringList(pnpmYaml?.minimumReleaseAgeExclude)
if (pnpmYaml && typeof pnpmYaml.minimumReleaseAge === 'number' && pnpmYaml.minimumReleaseAge > 0) {
const days = pnpmYaml.minimumReleaseAge / 1440
debug(`maturityPeriod=${days}d from ${pnpmYamlPath} (minimumReleaseAge=${pnpmYaml.minimumReleaseAge}m, minimumReleaseAgeExclude=${JSON.stringify(pnpmExclude)})`)
return { maturityPeriod: days, maturityPeriodExclude: pnpmExclude }
if (pnpmYaml && typeof pnpmYaml.minimumReleaseAge === 'number') {
if (pnpmYaml.minimumReleaseAge > 0) {
const days = pnpmYaml.minimumReleaseAge / 1440
debug(`maturityPeriod=${days}d from ${pnpmYamlPath} (minimumReleaseAge=${pnpmYaml.minimumReleaseAge}m, minimumReleaseAgeExclude=${JSON.stringify(pnpmExclude)})`)
return { maturityPeriod: days, maturityPeriodExclude: pnpmExclude }
}

debug(`maturityPeriod disabled from ${pnpmYamlPath} (minimumReleaseAge=${pnpmYaml.minimumReleaseAge}m, minimumReleaseAgeExclude=${JSON.stringify(pnpmExclude)})`)
return { maturityPeriodExclude: pnpmExclude }
}

// 2. .yarnrc.yml → npmMinimalAgeGate (duration)
Expand Down
6 changes: 6 additions & 0 deletions test/maturityDetection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ describe('detectMaturityPeriod', () => {
expect(await detectMaturityPeriod(cwd)).toBeUndefined()
})

it('respects minimumReleaseAge 0 over pnpm@11 default', async () => {
write(cwd, 'package.json', JSON.stringify({ packageManager: 'pnpm@11.0.0' }))
write(cwd, 'pnpm-workspace.yaml', 'minimumReleaseAge: 0\n')
expect(await detectMaturityPeriod(cwd)).toBeUndefined()
})

it('falls through when the yaml exists without the field', async () => {
write(cwd, 'pnpm-workspace.yaml', 'packages:\n - "!**/test/**"\n')
expect(await detectMaturityPeriod(cwd)).toBeUndefined()
Expand Down