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

javascript: Add support for the pnpm package manager #18864

Merged
merged 15 commits into from May 2, 2023

Conversation

tobni
Copy link
Contributor

@tobni tobni commented Apr 30, 2023

Enable to configure pnpm at the nodejs project or repository level, via corepack.

Fixes #18527.



@dataclass(frozen=True)
class NodeJSProject:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this be implemented via a union?

I'm hesitant because I don't think users will want to extend this union themselves, but it might make the code cleaner w.r.t to the package manager specific properties.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

While it's totally fine to have "private" @unions, I don't think that seems necessary yet, no. And it's probably worth avoiding prematurely extracting interfaces in case #16763 comes along and makes it much easier to use @unions by allowing methods to be awaited.

But when in doubt, leaving a TODO comment behind posing the question can be helpful, as it might help the reader come to another conclusion.

@@ -72,7 +85,8 @@ def test_packages_sources_as_resource_using_build_tool(rule_runner: RuleRunner)
"devDependencies": {"parcel": "2.6.2"},
}
),
"src/js/package-lock.json": (Path(__file__).parent / "package-lock.json").read_text(),
"src/js/.npmrc": "strict-peer-dependencies=false",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Parcels dependency tree is broken.

Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!



@dataclass(frozen=True)
class NodeJSProject:
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

While it's totally fine to have "private" @unions, I don't think that seems necessary yet, no. And it's probably worth avoiding prematurely extracting interfaces in case #16763 comes along and makes it much easier to use @unions by allowing methods to be awaited.

But when in doubt, leaving a TODO comment behind posing the question can be helpful, as it might help the reader come to another conclusion.

@stuhood stuhood enabled auto-merge (squash) May 1, 2023 21:11
@benjyw
Copy link
Sponsor Contributor

benjyw commented May 2, 2023

Nice! You can run pants fmt src/python/pants/backend/javascript/goals/test_integration_test.py to fix the lint error

@tobni
Copy link
Contributor Author

tobni commented May 2, 2023

Nice! You can run pants fmt src/python/pants/backend/javascript/goals/test_integration_test.py to fix the lint error

Yeah, I think I managed to interactive rebase my way out of the pre-commit hooks 😅

All done now, though!

@stuhood I'll consider adding a todo in the pr, I'll be adding yarn support next, it'll be updates to the same classes I already worked on here anyway, so will see if the mood strikes.

auto-merge was automatically disabled May 2, 2023 17:12

Head branch was pushed to by a user without write access

@benjyw benjyw merged commit c3e20d7 into pantsbuild:main May 2, 2023
17 checks passed
@cczona cczona added the backend: JavaScript JavaScript backend-related issues label May 4, 2023
@tobni tobni deleted the add/support-pnpm branch May 16, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: JavaScript JavaScript backend-related issues category:new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for pnpm for the javascript backend
4 participants