Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

fix: improve package.json lookup for root name#1530

Merged
sofisl merged 2 commits intogoogleapis:mainfrom
orgads:package-json-lookup
Mar 23, 2024
Merged

fix: improve package.json lookup for root name#1530
sofisl merged 2 commits intogoogleapis:mainfrom
orgads:package-json-lookup

Conversation

@orgads
Copy link
Contributor

@orgads orgads commented Dec 15, 2023

compileProtos seeks for package.json one directory above the one it accepts as input (typically src).

Running gapic-generator-typescript with --format=esm, generates the the sources in esm/src, then compileProtos can't find package.json.

When package.json is not found, the root name falls back to default and all the packages have the same root.

Use walk-up-path, which is also used by npm[1].

Fixes googleapis/google-cloud-node-core#233.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@orgads orgads requested a review from a team as a code owner December 15, 2023 08:23
@orgads orgads requested a review from a team December 15, 2023 08:23
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Dec 15, 2023
@orgads orgads force-pushed the package-json-lookup branch from aed4208 to 2561e4e Compare January 20, 2024 21:04
@orgads
Copy link
Contributor Author

orgads commented Jan 20, 2024

Rebased.

@orgads orgads force-pushed the package-json-lookup branch 2 times, most recently from 7173d84 to 13576ae Compare February 4, 2024 18:51
@orgads
Copy link
Contributor Author

orgads commented Feb 4, 2024

@sofisl Please review.

@orgads orgads force-pushed the package-json-lookup branch from 13576ae to d209b24 Compare February 5, 2024 06:13
compileProtos seeks for package.json one directory above the one it
accepts as input (typically src).

Running gapic-generator-typescript with --format=esm, generates the
the sources in esm/src, then compileProtos can't find package.json.

When package.json is not found, the root name falls back to default
and all the packages have the same root.

Use walk-up-path, which is also used by npm[1].

Fixes #1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
@orgads orgads force-pushed the package-json-lookup branch from d209b24 to e808529 Compare February 19, 2024 13:18
@orgads
Copy link
Contributor Author

orgads commented Feb 19, 2024

Rebased. @sofisl ping.

@orgads orgads force-pushed the package-json-lookup branch from e808529 to 8eb2919 Compare February 19, 2024 13:19
@sofisl sofisl self-requested a review March 23, 2024 02:15
@sofisl sofisl added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 23, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 23, 2024
@sofisl sofisl added automerge: exact Summon MOG for automerging, but approvals need to be against the latest commit owlbot:run Add this label to trigger the Owlbot post processor. labels Mar 23, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 23, 2024
@sofisl sofisl merged commit 3ec09cf into googleapis:main Mar 23, 2024
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge: exact Summon MOG for automerging, but approvals need to be against the latest commit label Mar 23, 2024
@release-please release-please bot mentioned this pull request Mar 23, 2024
@orgads orgads deleted the package-json-lookup branch March 23, 2024 18:24
leahecole pushed a commit to leahecole/gax-nodejs that referenced this pull request Mar 27, 2024
compileProtos seeks for package.json one directory above the one it
accepts as input (typically src).

Running gapic-generator-typescript with --format=esm, generates the
the sources in esm/src, then compileProtos can't find package.json.

When package.json is not found, the root name falls back to default
and all the packages have the same root.

Use walk-up-path, which is also used by npm[1].

Fixes #1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632

Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compileProtos: Generating for esm/src uses default root

3 participants