Conversation
e8f788e to
7db35a0
Compare
gluxon
commented
Jun 27, 2024
pkg-manager/core/test/catalogs.ts
Outdated
| */ | ||
| class CatalogTestsController { | ||
| private readonly workspaceDir: string | ||
| private projects: Record<ProjectId, ProjectManifest> |
Member
Author
There was a problem hiding this comment.
Added this in-memory map to keep to track of the most recent ProjectManifest since we no longer re-read packages from @pnpm/workspace.filter-packages-from-dir.
The ProjectManifest can be out of date after a updateProjectManifest call.
3 tasks
zkochan
reviewed
Jun 27, 2024
pkg-manager/core/test/catalogs.ts
Outdated
| const { selectedProjectsGraph } = await filterPackagesFromDir(this.workspaceDir, [{ parentDir: location }]) | ||
| await selectedProjectsGraph[path.join(this.workspaceDir, location)].package.writeProjectManifest(manifest) | ||
| updateProjectManifest (location: ProjectId, manifest: ProjectManifest): void { | ||
| fs.writeFileSync(path.join(this.workspaceDir, location, 'package.json'), JSON.stringify(manifest, null, 2)) |
Member
There was a problem hiding this comment.
there is no need to write the updated package.json files to fs. core doesn't read these files, it uses solely the objects passed to it.
Member
Author
There was a problem hiding this comment.
Gotcha. I wanted to make sure these were up to date "just in case", but it's nice to know we can just assume @pnpm/core operates off of the in-memory objects entirely.
7db35a0 to
00a85ac
Compare
zkochan
approved these changes
Jun 27, 2024
zkochan
added a commit
that referenced
this pull request
Jun 27, 2024
* feat: create new @pnpm/catalogs.types package (#8026) * feat: read catalog configs from workspace manifest (#8123) * refactor: move InvalidWorkspaceManifestError to its own file * feat: read catalogs config from workspace manifest * chore: add changeset for new catalog config parsing * feat: create new `@pnpm/catalogs.protocol-parser` package (#8124) This works around a problem with pnpm's CI setup not compiling packages that are not dependencies of the main pnpm package before running these tests. #8027 (comment) * refactor: factor out isWantedDepPrefSame to extend in a future commit (#8125) * feat: create new `@pnpm/catalogs.config` package (#8220) * refactor: remove single default catalog check This check will happen in `@pnpm/catalogs.config` instead. * feat: create new @pnpm/catalogs.config package * fix: work around CI setup not compiling orphan packages before testing This works around a problem with pnpm's CI setup not compiling packages that are not dependencies of the main pnpm package before running these tests. #8027 (comment) * feat: create new `@pnpm/catalogs.resolver` package (#8219) * feat: create new @pnpm/catalogs.resolver package * fix: work around CI setup not compiling orphan packages before testing This works around a problem with pnpm's CI setup not compiling packages that are not dependencies of the main pnpm package before running these tests. #8027 (comment) * feat: implement catalog protocol for publish (#8225) * feat: implement catalog protocol for install (#8221) * feat: add catalogs to @pnpm/config * refactor: factor out resolveDependenciesOfImporterDependency function * feat: implement catalog resolver and replace prefs * revert: work around CI setup not compiling orphan packages before testing * feat: record catalog lookup snapshots through propagated metadata * feat: update projects when catalogs config changes * test: add catalog protocol install tests * refactor: remove filter-packages-from-dir dependency from core tests (#8244) * refactor: remove filter-packages-from-dir dependency from core tests * test: refactor * test: refactor --------- Co-authored-by: Zoltan Kochan <z@kochan.io> --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Addressing feedback from: