Skip to content

Include typings folder in npm publish. #140

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

Closed
parkerziegler opened this issue Jul 16, 2019 · 8 comments
Closed

Include typings folder in npm publish. #140

parkerziegler opened this issue Jul 16, 2019 · 8 comments
Labels
good first issue Good for newcomers

Comments

@parkerziegler
Copy link

parkerziegler commented Jul 16, 2019

Thanks for a helpful lib! It appears that the typings folder is not actually making it to npm, so the TS support isn't working. You can see that the typings folder isn't there by checking it out on runpkg: https://runpkg.com/?@testing-library/[email protected]/dist/index.js. Compare this to say, @testing-library/react, whose typings folder is published to npm: https://runpkg.com/?@testing-library/[email protected]/dist/index.js. Since there's no .npmignore nor a files field in the package.json, I believe everything that's on GitHub is ending up published to npm (which is strange that typings wouldn't also make it in this case), which even means your tests and source are getting bundled in folks' node_modules 😬 Finally, it appears the package.json version is out of lockstep with the npm published version. Happy to make a PR to help with these things if you like! Thanks again for a helpful lib.

@Gpx
Copy link
Member

Gpx commented Jul 20, 2019

Hi there. I'm actually not the one maintaining the types. They are published from https://github.com/DefinitelyTyped/DefinitelyTyped. I have nothing against migrating the code to TS and export types directly from here.

Would you be interested in doing the porting?

@Gpx Gpx assigned Gpx and unassigned Gpx Jul 20, 2019
@Gpx Gpx added the good first issue Good for newcomers label Jul 20, 2019
@calebeby
Copy link
Contributor

@parkerziegler
Copy link
Author

@Gpx I agree with @calebeby above. It's totally fine if the types are maintained on DefinitelyTyped! There's also no need to port the entire lib to TS. It's more that folks' tend to either ship types directly with their lib or rely on the types on DefinitelyTyped. In this case, you have the types in source here, but don't ship them along with the lib, and also rely on DefinitelyTyped. It'd be great to have one place where they were located so it was clear to end users where we should expect to get our types.

I'm happy to make a PR w/ a sample .npmignore you could use to ship types with the repo (and that would exclude your tests from being published) if that sounds useful.

@calebeby
Copy link
Contributor

calebeby commented Jul 22, 2019

There's also no need to port the entire lib to TS

You are right that there is no need, but if @Gpx is ok with this I'm willing to do it

@Gpx
Copy link
Member

Gpx commented Jul 23, 2019

😆 I actually forgot we added types in here.
I think it makes more sense if we maintain the types in here, it's probably going to be easier to maintain.

I would start with exporting the file we currently have and making sure it's up-to-date.

Does it make sense?

@weyert
Copy link

weyert commented Aug 12, 2019

I think you changed on this opinion? After noticing the change in the react / dom package? Where are removing it?

@Gpx
Copy link
Member

Gpx commented Aug 15, 2019

Let's see how the discussion on testing-library/react-testing-library#437 goes

@calebeby
Copy link
Contributor

calebeby commented May 6, 2020

@Gpx I think this issue can be closed. The typings folder is being published to npm:
https://unpkg.com/browse/@testing-library/[email protected]/typings/index.d.ts

@parkerziegler you were looking at 4.1.0 which was before the typings were added to this repo. The typings were published in 4.2.0: #134

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

No branches or pull requests

4 participants