fix(generator): add long dependency to CJS template and update baselines - #8685
Conversation
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
|
@quirogas For google-gax version I found that the latest version 5.0.x versions are descendants (having the changes) of 5.1.1-rc.1. See b/527420531#comment3. Would you confirm this address your concern and remove do-not-merge label? |
Thank you so much for all your work! Yes, I agree that we should be good to remove the labels. However, could you perform one final sanity check before merging the PR and review the generated changes to ensure they won't cause any issues? Feel free to send me the generated branch, and I can help look them over. @pearigee WDYT? |
|
@quirogas With |
feywind
left a comment
There was a problem hiding this comment.
Thanks for throwing in the gax version fix too.
I had a PR to fix that, a while back, but it didn't end up getting merged for unrelated reasons, so I'm glad to see it in here. The rc is much older than the 5.0.x releases. Our plan is eventually to just bump gax to 5.2.x so we can avoid future weirdness with the rc. |
This PR adds the missing "long" dependency to the CommonJS package.json template in gapic-generator-typescript, and updates the baselines to match.
Why
longis indevDependencieslongis only required during the compilation phase of the library itself to resolve type definitions in the generatedprotos/protos.d.ts(which hasimport Long = require("long");). It is not directly imported in the runtime JavaScript code. At runtime,longis transitively resolved viagoogle-gax->protobufjs, so it does not need to be a production dependency of the generated library.GAX
It also updates the
google-gaxdependency version to^5.0.0in the template to match the recently introducedgoogle-maps-mapmanagementpackage: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
google-cloud-node/librarian.yaml
Line 24 in ed701c6