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

Setup .npmignore file #19

Closed
wants to merge 1 commit into from
Closed

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Apr 4, 2023

Public-Facing Changes

None

Description

Exclude unneeded files from npm package dist.

Mainly src directory. It confused my IDE (PhpStorm), so I added debug to the wrong code without noticing the package had src folder also included, not just dist.

This also decreases node_modules on installations. ftw!

Exclude un-needed from npm package dist
@CLAassistant
Copy link

CLAassistant commented Apr 4, 2023

CLA assistant check
All committers have signed the CLA.

@glensc
Copy link
Contributor Author

glensc commented Apr 4, 2023

NOTE: the patterns work with yarn, but break npm:

but as this project uses yarn, all is fine. just a reminder for the future when switching to npm for some reason.

@defunctzombie
Copy link
Contributor

defunctzombie commented Oct 24, 2023

Sorry for the delay. I think a better solution that yarn and npm support would be the files field in the package.json. If you want to make that change I'd merge that.

@jhurliman
Copy link
Contributor

FYI the src/ directory is included in the npm distribution on purpose. It's helpful to be able to click through a class or function name and see the original (unminified) TypeScript implementation. IMO the benefit of this outweighs a streamlined workflow for editing code in your node_modules/ directory.

@defunctzombie
Copy link
Contributor

Seems this went stale so I am closing it. If you do decide to pick this up at some later time and incorporate the suggestions we can revisit.

@glensc
Copy link
Contributor Author

glensc commented Jan 23, 2024

Rather opposite, bundling src make ide confused, and added breakpoints to wrong files (files not used at runtime). you want to browse source, you should clone the repository.

@defunctzombie
Copy link
Contributor

Rather opposite, bundling src make ide confused, and added breakpoints to wrong files (files not used at runtime). you want to browse source, you should clone the repository.

I am ok not shipping the source code in the build - but I think the way we want to do it is with an explicit files field in package.json that indicates the files we want. That is supported by yarn and npm (to my knowledge)

@glensc
Copy link
Contributor Author

glensc commented Jan 25, 2024

I find separate file more maintainable. you can compare more easily with other projects or copy while file.

also the .npmignore I submitted also only whitelists things (i.e first hides everything and then unhides)

as for npm/yarn, yarn doesn't have publish functionality, it invokes npm internally. at least that's what I think is happening behind the scenes. in short, it works the same way in npm/yarn.

but if you insist on package.json change, what is the section for that, root level "files" ?

@defunctzombie
Copy link
Contributor

root level "files" ?

Yep.

@glensc
Copy link
Contributor Author

glensc commented Jan 25, 2024

Created #20

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

Successfully merging this pull request may close these issues.

4 participants