Skip to content

fix: remove compile-protos from prepare - #9690

Merged
shivanee-p merged 1 commit into
mainfrom
fix/gapic-prepare-scripts
Oct 21, 2026
Merged

shivanee-p merged 1 commit into
mainfrom
fix/gapic-prepare-scripts

Conversation

@shivanee-p

Copy link
Copy Markdown
Contributor

Fixes release failures for by aligning their prepare, compile, and postpack scripts with the rest of the monorepo packages.

Key Changes:

  • Updated "prepare" from "npm run compile-protos && npm run compile" to "npm run compile".
  • Updated "compile" from "tsc -p . && cp -r protos build/ && minifyProtoJson" to "tsc -p . && cp -r protos build/".
  • Added "postpack": "minifyProtoJson".

@shivanee-p
shivanee-p marked this pull request as ready for review October 21, 2026 20:13
@shivanee-p
shivanee-p requested a review from a team as a code owner October 21, 2026 20:13
@github-actions
github-actions Bot requested a review from feywind October 21, 2026 20:13

@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 updates the build and packaging scripts across multiple package.json files by removing the compile-protos step from the prepare script and moving the minifyProtoJson task from the compile script to a postpack lifecycle script. Feedback from the reviewer correctly highlights a critical issue: because postpack runs after the tarball has already been generated, any files minified during this step will not be included in the published npm packages. To ensure the minified proto JSON files are packaged correctly, the prepack lifecycle script should be used instead of postpack.

"fix": "gts fix",
"lint": "gts check",
"prepare": "npm run compile-protos && npm run compile",
"postpack": "minifyProtoJson",

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.

high

In npm, the postpack lifecycle script runs after the tarball has already been generated and packed. Any file modifications performed in postpack (such as running minifyProtoJson to minify the proto JSON files in the build directory) will not be included in the packed tarball that gets published to npm.

To ensure that the published packages actually contain the minified proto JSON files (thereby keeping the package size small), you should use the prepack lifecycle script instead of postpack.

Suggested change
"postpack": "minifyProtoJson",
"prepack": "minifyProtoJson",

"fix": "gts fix",
"lint": "gts check",
"prepare": "npm run compile-protos && npm run compile",
"prepare": "npm run compile",

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.

high

While reviewing the scripts here, note that the adjacent postpack script (on line 62) also runs minifyProtoJson after the tarball has already been packed. This means the minified files are not included in the published package.

Please consider changing postpack to prepack here as well to ensure the minified files are correctly included in the published ESM packages.

@shivanee-p
shivanee-p merged commit 1a4c864 into main Oct 21, 2026
75 of 76 checks passed
@shivanee-p
shivanee-p deleted the fix/gapic-prepare-scripts branch October 21, 2026 20:46
@release-please release-please Bot mentioned this pull request Oct 21, 2026
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