Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compileProtos: Generating for esm/src uses default root #1529

Closed
orgads opened this issue Dec 14, 2023 · 0 comments · Fixed by #1530
Closed

compileProtos: Generating for esm/src uses default root #1529

orgads opened this issue Dec 14, 2023 · 0 comments · Fixed by #1530
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@orgads
Copy link
Contributor

orgads commented Dec 14, 2023

Environment details

  • OS: Linux
  • Node.js version: 20.9.0
  • npm version: 10.1.0
  • gax-nodejs version: gapic-tools@0.2.0

Steps to reproduce

compileProtos esm/src --esm (generated by https://github.com/googleapis/gapic-generator-typescript when passing --format esm)

The generateRootName function tries to locate package.json one directory above the input path, but in this case it should hop through 2 parent directories. I wonder if it makes sense to just use package.json from the current directory, at least when the path is relative and doesn't start with ../.

@orgads orgads added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 14, 2023
orgads added a commit to orgads/gax-nodejs that referenced this issue 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#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
orgads added a commit to orgads/gax-nodejs that referenced this issue Jan 20, 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 googleapis#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
orgads added a commit to orgads/gax-nodejs that referenced this issue Feb 4, 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 googleapis#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
orgads added a commit to orgads/gax-nodejs that referenced this issue Feb 4, 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 googleapis#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
orgads added a commit to orgads/gax-nodejs that referenced this issue Feb 5, 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 googleapis#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
orgads added a commit to orgads/gax-nodejs that referenced this issue Feb 19, 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 googleapis#1529.

[1] https://github.com/npm/config/blob/77a48dbe22/lib/index.js#L632
sofisl added a commit that referenced this issue Mar 23, 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>
leahecole pushed a commit to leahecole/gax-nodejs that referenced this issue 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 googleapis#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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants