Skip to content

refactor: remove filter-packages-from-dir dependency from core tests#8244

Merged
zkochan merged 3 commits intocatalogsfrom
gluxon/catalog-remove-filterPackagesFromDir-from-core-test
Jun 27, 2024
Merged

refactor: remove filter-packages-from-dir dependency from core tests#8244
zkochan merged 3 commits intocatalogsfrom
gluxon/catalog-remove-filterPackagesFromDir-from-core-test

Conversation

@gluxon
Copy link
Member

@gluxon gluxon commented Jun 27, 2024

@gluxon gluxon force-pushed the gluxon/catalog-remove-filterPackagesFromDir-from-core-test branch from e8f788e to 7db35a0 Compare June 27, 2024 06:44
*/
class CatalogTestsController {
private readonly workspaceDir: string
private projects: Record<ProjectId, ProjectManifest>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gluxon gluxon marked this pull request as ready for review June 27, 2024 06:46
@gluxon gluxon requested a review from zkochan as a code owner June 27, 2024 06:46
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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gluxon gluxon force-pushed the gluxon/catalog-remove-filterPackagesFromDir-from-core-test branch from 7db35a0 to 00a85ac Compare June 27, 2024 07:13
@zkochan zkochan merged commit 85786d9 into catalogs Jun 27, 2024
@zkochan zkochan deleted the gluxon/catalog-remove-filterPackagesFromDir-from-core-test branch June 27, 2024 12:11
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants