Remove duplicate copy of react-meteor-data.d.ts from isopack#384
Remove duplicate copy of react-meteor-data.d.ts from isopack#384Grubba27 merged 1 commit intometeor:masterfrom
Conversation
|
This looks good. As an alternative, I think removing |
|
I'm a little afraid to do that because I still don't understand exactly why the source version of the |
|
Meteor compiles the files in the package when it builds an app that uses the package, which is where the filter you linked to is run. When publishing, Meteor includes all files with the extensions and filenames passed to Plugin.registerCompiler at https://github.com/meteor/meteor/blob/01a25e77c89ba6e4fc298695819e6b2d65754349/packages/typescript/plugin.js#L2. zodern:types only requires the app to be published with the .d.ts file; it doesn't matter if the file is actually compiled. |
|
Ah, and that doesn't happen with |
|
While I agree that the explicitness here is good, this is a package the community may look up for the integration example, and as such, it should be as simple as possible (and working, of course). How about that: we can remove this line and release a new version. Then check if it works, and add both only if needed. |
|
Err...wait, will that approach work? I think that if we remove the
|
So long as the `typescript` package is used by this package, then all TypeScript files (including definition files) will get included in the resulting build without needing to specify it as an asset. Including it twice (both as a source and an asset file) confuses `zodern:types` and causes it to skip over the package without including either. We also don't need the package-types.json file, as we were never including it in the isopack.
3dd46b6 to
79507d3
Compare
|
Aha. OK I remembered this morning that I figured out how to test this (copy the package into the
is that In fact, it seems like hash deduplication should be sufficient to have prevented this problem from ever occurring in the first place, but when I look at the isopack from Atmosphere, there's no hash for the asset version of the file: In any case, I've rewritten this branch to drop the asset (and the now-vestigial |
|
Is it ready now for being released? I'm planning on making a new meteor release candidate with the types changes as well and it would be nice to test all together |
|
I believe matches what @radekmie requested and is good to go. |
That's exactly that! Sorry for not being clear enough in the first place. |
This is a followup to #377 based on my best understanding of how
zodern:typesexpects type declarations to appear.(FYI @zodern @piotrpospiech @radekmie in case any of y'all see something I've missed)
As discussed on #377, the current configuration does not seem to allow
zodern:typesto detect the type declarations forreact-meteor-data. As I understand it, the current configuration doesn't work is becausereact-meteor-data.d.tsis being included as both an asset and as a source file. You can see this by looking at~/.meteor/packages/react-meteor-data/2.6.2/os.json(and similarly the files forweb.browser.jsonandweb.browser.legacy.json). This is because, in addition to explicitly including the definition file as an asset, thetypescriptpackage includes any.tsfile (.d.tsor not).When consuming types from Meteor packages,
zodern:typeslooks for.d.tsfiles and uses them to provide types for the package, but only if there's a single.d.tsfile. While it deduplicates by the hash of definition files, thereact-meteor-datapackage in Atmosphere does not seem to include the hash property for the asset version of the definition file, meaning it isn't deduped against the source versions. This means thatzodern:typessees 2 different definition files in the package, and skips over it as being ambiguous.We can fix this by not shipping the asset version of the definition file (since the non-asset version is already included). We also can drop the
package-types.jsonfile, which was never included in the resulting build and was thus vestigial.I was able to test this locally by copying the
react-meteor-datadirectory into a project, artificially bumping the version number (to2.6.2_1), and runningmeteor update react-meteor-datato verify that it picked up the later version. After runningmeteor lint, I was able to successfully pick up types forreact-meteor-data.Here's what I saw before:
After taking the update, that error message is gone.