Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(managers/npm): support pnpm catalogs #33376

Merged
merged 46 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b22fd55
WIP: prototype extraction in its own manager
fpapado Dec 31, 2024
610add0
Move pnpm catalog extraction to npm manager
fpapado Jan 1, 2025
c09e7bc
Remove pnpmCatalog from api.ts
fpapado Jan 1, 2025
a3a5250
Implement updatePnpmCatalogDependency in updateDependency
fpapado Jan 1, 2025
e38151c
refactor: move updatePnpmCatalogDependency to its own module
fpapado Jan 1, 2025
437ad81
refactor(npm): move git and npm alias resolution to common module
fpapado Jan 1, 2025
5c38828
chore: small test and typechecking fixups
fpapado Jan 1, 2025
6de942c
refactor(npm,utils): split out parseSingleYamlDocument
fpapado Jan 1, 2025
6418f78
fix(npm): set either implicit or named default catalog
fpapado Jan 1, 2025
a77ba84
chore: remove TODO
fpapado Jan 1, 2025
9204b3a
chore(npm): tidy up TODOs for review
fpapado Jan 1, 2025
5d39917
test(npm): add tests for pnpm catalog updates
fpapado Jan 2, 2025
2d9c8bc
feat(npm): implement replacement for pnpm catalog updates
fpapado Jan 2, 2025
03e44e1
chore: remove done TODO
fpapado Jan 2, 2025
d62d7d1
test(npm): mirror specifier tests to catalog update
fpapado Jan 2, 2025
2f56199
chore: tidy up pnpm extraction test and TODO
fpapado Jan 2, 2025
59f0a83
Batch apply suggestions from code review
fpapado Jan 10, 2025
f61958a
chore: inline expectations in pnpm update spec
fpapado Jan 10, 2025
2262d4b
fix: use a CST for updating catalogs, in order to preserve formatting
fpapado Jan 12, 2025
0a48dc7
fix: avoid double-parsing in update
fpapado Jan 12, 2025
f3eea08
test: shuffle update tests, remove yamlCodeBlock
fpapado Jan 12, 2025
3312747
refactor: move PnpmCatalog interface to shared types.ts
fpapado Jan 12, 2025
fbb488b
refactor: move pnpmCatalogsSchema to schema.ts
fpapado Jan 12, 2025
190458f
types: drop Partial from PnpmWorkspaceFile
fpapado Jan 12, 2025
77cf2fe
feat: duck-type pnpm workspace files via schema, to allow renaming
fpapado Jan 12, 2025
283ada5
feat: use a depName of pnpm.catalog.<name>, to allow pattern matching
fpapado Jan 12, 2025
6c4ee60
docs: add mention of `pnpm.catalog` depName in npm readme.md
fpapado Jan 12, 2025
bfdae64
fix: ensure that pnpm-workspace.yaml duck-typing uses full schema
fpapado Jan 13, 2025
993af1c
fix: ensure that pnpm-workspace.yaml updates trigger lockfile updates
fpapado Jan 14, 2025
9b7807d
test: fix pnpm tests, by awaiting and by changing the object shape
fpapado Jan 14, 2025
8b596f3
test: fix tests that do assertions on the shape of npm manager config
fpapado Jan 14, 2025
1b349e9
test: address coverage in lib/modules/manager/npm/update
fpapado Jan 14, 2025
5b90887
chore: remove done TODO
fpapado Jan 14, 2025
77678e1
test: address coverage in lib/modules/manager/npm/extract/
fpapado Jan 14, 2025
668c511
feat: extract locked versions from catalogs
fpapado Jan 14, 2025
6cfd893
chore: remove done TODO
fpapado Jan 14, 2025
b886aa6
test: tidy up coverage
fpapado Jan 14, 2025
1555235
fix: ensure that pnpm-workspace.yaml artifacts get written prior to l…
fpapado Jan 14, 2025
ea535e9
test: add explicit tests for comments in pnpm workspace updates
fpapado Jan 14, 2025
d6820f7
chore: remove errant logging
fpapado Jan 14, 2025
bfcc4e9
Apply suggestions from code review
fpapado Jan 19, 2025
c8062e0
test: inline npm/__fixtures__/lockfile-parsing/pnpm-lock-v9.yaml
fpapado Jan 19, 2025
c3e69f2
test: use fs from test utils in npm/extract/pnpm.spec.ts
fpapado Jan 19, 2025
c671036
perf: avoid double-parsing when detecting workspace file
fpapado Jan 19, 2025
35c8707
chore: add explicit type annotation inside pnpmCatalogsToArray
fpapado Jan 19, 2025
a3fb8df
test: explicitly test lockfile acquisition in pnpm-workspace extraction
fpapado Jan 19, 2025
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Sebastian Poxhofer <[email protected]>
fpapado and secustor committed Jan 28, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bfcc4e98b933f399ffec77461c7b4d06844568b2
6 changes: 2 additions & 4 deletions lib/modules/manager/npm/extract/index.ts
Original file line number Diff line number Diff line change
@@ -233,9 +233,7 @@ export async function extractAllPackageFiles(
// pnpm workspace files are their own package file, defined via fileMatch.
// We duck-type the content here, to allow users to rename the file itself.
if (isPnpmWorkspaceYaml(content)) {
logger.trace(
`${packageFile} will be extracted as a pnpm workspace YAML file`,
);
logger.trace({packageFile}, `Extracting file as a pnpm workspace YAML file`);
const deps = await extractPnpmWorkspaceFile(content, packageFile);
if (deps) {
npmFiles.push({
@@ -244,7 +242,7 @@ export async function extractAllPackageFiles(
});
}
} else {
logger.trace(`${packageFile} will be extracted as a package.json file`);
logger.trace({ packageFile }, `Extracting as a package.json file`);
const deps = await extractPackageFile(content, packageFile, config);
if (deps) {
npmFiles.push({