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

fix: Fix version loading in new dist layout. #1091

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

stephenh
Copy link
Owner

No description provided.

@stephenh stephenh merged commit f1c23d2 into main Aug 16, 2024
6 checks passed
@stephenh stephenh deleted the fix-package-loading branch August 16, 2024 15:55
stephenh pushed a commit that referenced this pull request Aug 16, 2024
## [2.0.2](v2.0.1...v2.0.2) (2024-08-16)

### Bug Fixes

* Fix version loading in new dist layout. ([#1091](#1091)) ([f1c23d2](f1c23d2))
@stephenh
Copy link
Owner Author

🎉 This issue has been resolved in version 2.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cmd-johnson
Copy link
Contributor

Hi there!
I'm wanted to work on a small PR, but the yarn build:test command keeps failing every test with the following message:

Test ./grpc-js-use-date-true
FAILED!Cannot find module '/package.json' imported from /ts-proto/src/utils.ts
Did you mean to import "../package.json"?Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/package.json' imported from /ts-proto/src/utils.ts
Did you mean to import "../package.json"?
    at finalizeResolution (node:internal/modules/esm/resolve:257:11)
    at moduleResolve (node:internal/modules/esm/resolve:914:10)
    at defaultResolve (node:internal/modules/esm/resolve:1039:11)
    at nextResolve (node:internal/modules/esm/hooks:746:28)
    at resolveBase (file:///ts-proto/node_modules/tsx/dist/esm/index.mjs?1724162387184:2:3126)
    at async resolveDirectory (file:///ts-proto/node_modules/tsx/dist/esm/index.mjs?1724162387184:2:3492)
    at async resolve (file:///ts-proto/node_modules/tsx/dist/esm/index.mjs?1724162387184:2:4355)
    at async nextResolve (node:internal/modules/esm/hooks:746:22)
    at async Hooks.resolve (node:internal/modules/esm/hooks:238:24)
    at async handleMessage (node:internal/modules/esm/worker:199:18)--ts_proto_out: protoc-gen-ts_proto: Plugin failed with status code 1.

I'm not quite sure what's happening, but a quick git bisect pointed me to the commit in this PR as the culprit. Using the commit directly before this one (5e058bb), the tests work fine 🤷

I've already cleaned and reinstalled all dependencies and also forced a rebuild on the docker image.


Actually, now that I've looked into this a bit more, it looks like the build output is located at build/src/utils.js, which correctly manages to resolve the package.json using ../../package.json, but when running the ts code directly (which I assume the tests do), the utils.ts file is located in src/utils.ts, resulting in ../../package.json path pointing to the directory above the actual project root (which is / when running inside the container).

@stephenh
Copy link
Owner Author

@cmd-johnson ah shoot, thanks for pointing this out! 😬 I've got a fix up in #1097 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants