rollup / rollup-starter-lib

Bare-bones example of how to create a library using Rollup
MIT License
962 stars 230 forks source link

Should be `dist` commited? #8

Closed langpavel closed 6 years ago

langpavel commented 6 years ago

Hi, thanks for great kick in! but..

I think that dist should be ignored from version control, like build is excluded in many others projects.

I expected that there will be more opinions, but I did't found it there, no much opened issues, no debates.. so I'm trying kick up this with this one :slightly_smiling_face:

eventualbuddha commented 6 years ago

I agree. I’d merge a PR to add it to .gitignore.

avdeev commented 6 years ago

What about distribution through bower or CDN?

eventualbuddha commented 6 years ago

I would have thought bowed effectively dead, since it’s been deprecated for around 7 months. And you can use unpkg for CDN functionality.

Grsmto commented 6 years ago

I disagree with this. I think a lot of users still uses libraries by simply downloading the zip file from Github. If you gitignore the dist folder, they won't be able to do this anymore. Also ignoring the dist file doesn't really add any value here (it's not like you want to save space in Github's HD or anything).

langpavel commented 6 years ago

@Grsmto I cannot agree. Readable diffs are more important for code review workflow

eventualbuddha commented 6 years ago

I think a lot of users still uses libraries by simply downloading the zip file from Github.

For users who want to provide that, they can by all means do so. However, for the vast majority of users simply creating versions appropriate to the target and putting them in dist and publishing that to npm will enable downloading files for use in a project as you say or referencing them directly by using unpkg. For example, http://unpkg.com/lgtm@latest/dist/lgtm.js.

Also ignoring the dist file doesn't really add any value here.

@langpavel is correct: readable diffs are more important than the marginal utility of having dist checked into git. On top of that, you now have to make sure that the dist build properly matches the source files. This is a tedious and error-prone process, which would be best automated away if it weren't better to simply omit dist from git.

My own projects used to have the built version checked into dist for exactly the reasons you gave, but years of experience of the pain it causes plus the fall of bower and the rise of tools like unpkg have made it clear that checking build files into git is not currently the best approach for npm packages, or likely any software system with build artifacts.

avdeev commented 6 years ago

How i can create demo page for unpublished to NPM version of my lib? CDN works only with published versions.

eventualbuddha commented 6 years ago

Lots of ways:

There’s no shortage of good options.

langpavel commented 6 years ago

Nice, thanks!