-
Notifications
You must be signed in to change notification settings - Fork 94
Migrate to TypeScript #105
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
Conversation
This is not really meant to be switched to right now, because the types are mostly the same as the hand-written types from before. This is just a (mostly) 1:1 conversion of the JS code. It can be used as a starting point to experiment with the types to determine what could be changed with the APIs. |
Also, some things with the build might still need improvements - our next slacktime is in two weeks and we are looking forward to putting some more work in there. |
Codecov Report
@@ Coverage Diff @@
## next #105 +/- ##
==========================================
- Coverage 98.93% 97.79% -1.14%
==========================================
Files 8 8
Lines 375 408 +33
Branches 140 143 +3
==========================================
+ Hits 371 399 +28
- Misses 4 9 +5
Continue to review full report at Codecov.
|
Awesome work guys! Thanks for that. Big plans are emerging, and TS is part of that. |
Codecov Report
@@ Coverage Diff @@
## next #105 +/- ##
==========================================
- Coverage 98.72% 98.58% -0.15%
==========================================
Files 8 8
Lines 393 424 +31
Branches 143 148 +5
==========================================
+ Hits 388 418 +30
- Misses 5 6 +1
Continue to review full report at Codecov.
|
@slorber could you take a look? |
Oh, for better reviewing you might probably want to look at the diff excluding the "file rename" commit, as that's much cleaner: |
hi @phryneas and @ghengeveld I'm a big fan of react-async & typescript and would react really love to contribute to this PR |
@Avi98: A review would be highly welcome! Also, I believe there are still some TODOs in that code, you could tackle those if you wanted :) Those are all open points I can think of right now :) |
Also make sure it works with Pika: https://www.npmjs.com/package/@pika/plugin-ts-standard-pkg |
Yup. Although I believe that this would need a PR against pika or a new pika plugin. Current functionality does not cover the declaration-merging. For some pointers on how to implement something like that, there is some discussion over at tsdx as they are facing similar problems: jaredpalmer/tsdx#80 |
Hey y'all, maintainer of Pika here. Happy to help contribute however I can if something is lacking on the @pika/pack side of things |
@FredKSchott very cool! Could you take a look at that "bundle all .d.ts into one .d.ts" thing? The issue I linked above contains a few libraries that might be a solution. I've tried |
Sure thing, we actually already have a "bundle types" build plugin that should do what you need: https://github.com/pikapkg/builders/tree/master/packages/plugin-bundle-types Try that out, and then if anything's missing or broken let me know and I'd be happy to take a look |
Thanks! This seems to do exactly what we need - but there's a problem in the generated file. I've opened an issue! |
@phryneas are you suggesting to add webpack config and configure ts-loader |
No, this is about people using such a setup that would be unable to use this library if we shipped multiple definition files with re-exports.
I would not want to introduce webpack up the build process of this package 😁
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
|
@phryneas I think you can run examples by running following commands yarn && yarn build:packages
yarn bootstrap
yarn start:examples also if you can join discord channel so that I can get more inputs from you |
56e8d22
to
e3429ac
Compare
e3429ac
to
46bbabb
Compare
And we're all green 🎉 |
@FredKSchott could you shed some light on the recommended package setup? Right now our releases contain the following:
This PR, using
We would like to offer support for IE11, so people can safely use the package directly from a CDN. Probably adding
Is this a sensible setup? Do we really need all of them? What about the Also: what do we need to have the Pika CDN serve it properly so it can be used in a script tag? |
Do we still need |
Good point, I'll remove that dependency. PS: ah, no, still need that for the devtools package. |
2ee73c1
to
46bbabb
Compare
@ghengeveld yup, from a quick glance that looks good. Here a quick summary of each:
One suggestion (but not required) is that you could add CDN-specific entrypoints for some of the older JS CDNs. UNPKG (and JSDelivr, iirc) will both point to "main" instead of "module" by default for legacy reasons, so it can help to tell them to point to your web build explicitly: - ["@pika/plugin-build-web"],
+ ["@pika/plugin-build-web", { "entrypoint: ["module", "unpkg", "jsdeliver"] }], "source" is just like "esnext", either can be used to point to the most modern version of your source code. Neither are really used by anyone, but can be useful for the odd tool/bundling use-case. |
Once you publish, you can check out https://www.pika.dev/npm/react-async/cdn to see the result/status of the CDN build. I'll plug our Pika Package CI GitHub integration as well, which tests that no PR breaks your package from being properly bundled by the consumer (via Rollup/Webpack) and then gives you a preview install URL if you want to install and try any PR locally. If it passes that check, it's more or less guaranteed to build on our CDN as well. |
Thanks @FredKSchott that will work. I think this is what we should have:
Note that it should be |
Okay, now that part should be okay, too. |
e7f8f7e
to
3f7c51c
Compare
Co-Authored-By: Gert Hengeveld <info@ghengeveld.nl>
🚀 |
That is due to this coment: #105 (comment) |
So @phryneas and I had some slacktime ...