Skip to content

fix(generator): add long dependency to CJS template and update baselines#8685

Open
suztomo wants to merge 2 commits into
googleapis:mainfrom
suztomo:fix-generator-template-long
Open

fix(generator): add long dependency to CJS template and update baselines#8685
suztomo wants to merge 2 commits into
googleapis:mainfrom
suztomo:fix-generator-template-long

Conversation

@suztomo

@suztomo suztomo commented Jun 18, 2026

Copy link
Copy Markdown
Member

This PR adds the missing "long" dependency to the CommonJS package.json template in gapic-generator-typescript, and updates the baselines to match.

Why long is in devDependencies

long is only required during the compilation phase of the library itself to resolve type definitions in the generated protos/protos.d.ts (which has import Long = require("long");). It is not directly imported in the runtime JavaScript code. At runtime, long is transitively resolved via google-gax -> protobufjs, so it does not need to be a production dependency of the generated library.

GAX

It also updates the google-gax dependency version to ^5.0.0 in the template to match the recently introduced google-maps-mapmanagement package:
https://github.com/googleapis/google-cloud-node/blob/6f9710c504c5272dfb59a77c7da98235ed9cf3ff/packages/google-maps-mapmanagement/package.json. The latest (non-RC) GAX version is 5.0.7: https://www.npmjs.com/package/google-gax?activeTab=versions.

Last week, I ran generate -all in #8672 and package.json was not updated. Package.json file in the keep list

- package.json
. The effect is only to upcoming newly generated libraries.

@suztomo suztomo requested a review from a team as a code owner June 18, 2026 18:05

@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 adds the long package to devDependencies in multiple baseline and template package.json files. The reviewer correctly points out that since long is used at runtime by the generated GAPIC code, it must be declared under dependencies rather than devDependencies to avoid runtime MODULE_NOT_FOUND errors for consumers.

@quirogas quirogas added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 22, 2026
@quirogas quirogas self-requested a review June 22, 2026 15:30

@quirogas quirogas 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.

Reverting to 5.0.0 could introduce a significant number of changes to the generated code, as google-gax provides a transitive dependency used by protobufjs during client generation. Let's talk about this change before we merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants