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 generating TypeScript type definitions #236

Merged
merged 2 commits into from
Dec 31, 2023

Conversation

endel
Copy link
Contributor

@endel endel commented Dec 31, 2023

Hi @martenrichter,

I've made some changes to tsconfig.json and changed to generate type definitions only before publishing (prepublishOnly)

I'm still getting used to the codebase, let me know if I'm missing something.

Before

Screenshot 2023-12-31 at 10 32 22 Screenshot 2023-12-31 at 10 32 07

After

image image

All the best and happy new year ✨

@martenrichter
Copy link
Member

Also happy new year to you! (In a couple of hours I suppose).
Regarding the change, I actually would like to keep the "types" command, so that I can verify, that the types are ok, before I hit
The rest I will comment within the commit.

package.json Outdated
@@ -27,7 +27,6 @@
"test:firefox:http2:ponyfill": "npm run test:firefox:http2:ponyfill --workspace main",
"oldtest": "npm run oldtest --workspace main",
"oldtesthttp2": "npm run oldtesthttp2 --workspace main",
"types": "tsc --build",
Copy link
Member

Choose a reason for hiding this comment

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

Does this generate a problem? The version release today, does it still have problem with types?

Copy link
Contributor Author

@endel endel Dec 31, 2023

Choose a reason for hiding this comment

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

Just checked the version of today (1.0.8) and #233 still persists due to the path to ./dist/lib/index.d.ts that is failing.

A potential solution could be pointing "types": "./dist/main/lib/index.d.ts", but I believe having both projects compiled under dist was not intentional.

Below is a screenshot of both modules (1.0.8) after being installed via NPM (@fails-components/webtransport and @fails-components/webtransport-transport-http3-quiche), you can see both projects have the same output under dist folder, whereas they should only contain their own output (which this PR addresses):

Screenshot 2023-12-31 at 12 43 12

Copy link
Member

Choose a reason for hiding this comment

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

Ok, the screenshots match my development environment.
Yes, it was not intentional.
But I had to trouble with the crossreferencing of the two packages in types.
Does a run of tsc --build at workspace level run fine with your changes?

@@ -20,7 +20,8 @@
"rebuild-debug": "node build.js rebuild-debug -D",
"build-debug": "node build.js build-debug",
"prebuild": "node build.js prebuild",
"lint": "eslint lib"
"lint": "eslint lib",
"prepublishOnly": "tsc"
Copy link
Member

Choose a reason for hiding this comment

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

Please look also at the github action for the actual publishing...

@endel
Copy link
Contributor Author

endel commented Dec 31, 2023

Thanks for the review, I've just updated bringing back the "types" script and removing the prepublishOnly, I believe publishing should work as before now 🙌

@martenrichter
Copy link
Member

Ok, I will then hit the CI/CD jobs to see if they run, and maybe merge it later. I will probably wait for a release (or do the types not work at all?) until another issue pops up.

@martenrichter martenrichter merged commit 3a702fb into fails-components:master Dec 31, 2023
4 checks passed
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