Skip to content

fix: remove compile-protos from prepare script in pubsub-api and developer-knowledge - #9666

Merged
shivanee-p merged 1 commit into
mainfrom
shivaneep-proto-compliation-fix
Oct 20, 2026
Merged

shivanee-p merged 1 commit into
mainfrom
shivaneep-proto-compliation-fix

Conversation

@shivanee-p

Copy link
Copy Markdown
Contributor

Fixes release failures for @google-cloud/pubsub-api and @google/developer-knowledge 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 20, 2026 01:03
@shivanee-p
shivanee-p requested a review from a team as a code owner October 20, 2026 01:03
@github-actions
github-actions Bot requested a review from feywind October 20, 2026 01:04

@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 scripts in package.json for both google-cloud-pubsub-api and google-developer-knowledge packages, moving the minifyProtoJson execution to the postpack lifecycle hook and simplifying the prepare script. However, executing minification during postpack occurs after the npm package tarball is created, which would result in publishing unminified files. It is recommended to use the prepack hook instead to ensure minified files are included in the package, and to add these files to the keep list (e.g., librarian.yaml) to prevent them from being overwritten during regeneration.

"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

Running minifyProtoJson in postpack occurs after the npm package tarball has already been created. This means the published package will contain the unminified proto JSON files, defeating the purpose of minification. It should be run in prepack instead so that the minified files are included in the packed tarball. Note that since this is an auto-generated package.json, you should add this file to the keep list (e.g., in librarian.yaml) to prevent it from being overwritten during regeneration.

Suggested change
"postpack": "minifyProtoJson",
"prepack": "minifyProtoJson",
References
  1. Manual edits to auto-generated files (such as package.json in client libraries) are acceptable if the file is added to the keep list (e.g., in librarian.yaml) to prevent it from being overwritten during regeneration.

"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

Running minifyProtoJson in postpack occurs after the npm package tarball has already been created. This means the published package will contain the unminified proto JSON files, defeating the purpose of minification. It should be run in prepack instead so that the minified files are included in the packed tarball. Note that since this is an auto-generated package.json, you should add this file to the keep list (e.g., in librarian.yaml) to prevent it from being overwritten during regeneration.

Suggested change
"postpack": "minifyProtoJson",
"prepack": "minifyProtoJson",
References
  1. Manual edits to auto-generated files (such as package.json in client libraries) are acceptable if the file is added to the keep list (e.g., in librarian.yaml) to prevent it from being overwritten during regeneration.

"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.

Nit: do we even need to run this anymore? I believe librarian should be generating proto files already so there shouldn't be a need to re-generate them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping "postpack": "minifyProtoJson" here to match the other ~225 generated packages in packages/ and core/packages/. We can evaluate removing or changing postpack across the monorepo templates separately.

@shivanee-p
shivanee-p merged commit 3fb024d into main Oct 20, 2026
47 checks passed
@shivanee-p
shivanee-p deleted the shivaneep-proto-compliation-fix branch October 20, 2026 01:29
@release-please release-please Bot mentioned this pull request Oct 20, 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