Skip to content

refactor(install): extract pnpm installation logic to internal/tool/pnpm - #7159

Merged
quirogas merged 6 commits into
googleapis:mainfrom
quirogas:refactor/6857-pnpm-install-tool
Aug 5, 2026
Merged

quirogas merged 6 commits into
googleapis:mainfrom
quirogas:refactor/6857-pnpm-install-tool

Conversation

@quirogas

@quirogas quirogas commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Extract generic pnpm package installation logic from internal/librarian/nodejs/install.go into a shared standalone package at internal/tool/pnpm.

Previously, PHP client library generation (internal/librarian/php/install.go) invoked nodejs.InstallPNPM, creating a cross-package dependency between PHP and Node.js toolchains. Extracting this functionality into internal/tool/pnpm—patterned after internal/tool/pip—centralizes binary resolution, caching, and error handling into a dedicated tool package that both language generators consume independently. This modular foundation cleanly paves the way for upcoming declarative upgrades to pnpm v8+.

For #6857

@quirogas quirogas self-assigned this Aug 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the installation of Node.js tools by delegating PNPM tool installation logic from the nodejs and php packages to a centralized internal/tool/pnpm package. It exports several error variables from the pnpm package, adds robust test coverage for the refactored pnpm package, and introduces new tests for staging package movements in nodejs. There are no review comments, and I have no feedback to provide.

Extract generic `pnpm` package installation logic from `internal/librarian/nodejs/install.go` into a shared standalone package at `internal/tool/pnpm`.

Previously, PHP client library generation (`internal/librarian/php/install.go`) invoked `nodejs.InstallPNPM`, creating an undesired cross-package coupling between the PHP and Node.js toolchains. Extracting this functionality into `internal/tool/pnpm`—patterned after `internal/tool/pip`—centralizes binary resolution, caching, and error handling into a dedicated tool package that both language generators consume independently. This modular foundation cleanly paves the way for upcoming declarative upgrades to pnpm v8+.

For googleapis#6857
@quirogas
quirogas force-pushed the refactor/6857-pnpm-install-tool branch from d738d15 to 5ec853b Compare August 1, 2026 06:08
@quirogas
quirogas marked this pull request as ready for review August 1, 2026 06:13
@quirogas
quirogas requested a review from a team as a code owner August 1, 2026 06:13
Comment thread internal/librarian/php/install.go Resolved
Comment thread internal/tool/pnpm/pnpm.go Resolved
Comment thread internal/tool/pnpm/pnpm.go Resolved
quirogas and others added 3 commits August 3, 2026 09:46
…nges

Remove redundant comment in PHP installation routine, rename internal environment getter function to `env` to eliminate package naming stutter, return an explicit error when `SrcDir` is empty instead of relying on Node-specific fallbacks, and revert unrelated generation unit tests to preserve PR atomicity.

For googleapis#6857
@quirogas
quirogas requested a review from JoeWang1127 August 4, 2026 00:46
@JoeWang1127

Copy link
Copy Markdown
Contributor

Can you fix the unit tests?

@quirogas
quirogas enabled auto-merge (squash) August 5, 2026 20:01
@quirogas
quirogas merged commit c50e9f7 into googleapis:main Aug 5, 2026
40 checks passed
sofisl pushed a commit to sofisl/librarian that referenced this pull request Aug 10, 2026
…npm (googleapis#7159)

Extract generic `pnpm` package installation logic from
`internal/librarian/nodejs/install.go` into a shared standalone package
at `internal/tool/pnpm`.

Previously, PHP client library generation
(`internal/librarian/php/install.go`) invoked `nodejs.InstallPNPM`,
creating a cross-package dependency between PHP and Node.js toolchains.
Extracting this functionality into `internal/tool/pnpm`—patterned after
`internal/tool/pip`—centralizes binary resolution, caching, and error
handling into a dedicated tool package that both language generators
consume independently. This modular foundation cleanly paves the way for
upcoming declarative upgrades to pnpm v8+.

For googleapis#6857
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