5

Background info

I am writing a small JavaScript library and would like to make the contribution flow as easy as possible if others end up wanting to contribute. Currently, I am experiencing issues with versioning built files that go in the dist folder.

I am using:

  • Git for version control, and Github for repository management.
  • Gulp.js for building the source files and committing and pushing versioned files

Gulp runs a build task that concatenates, and minifies JavaScript files into a all.min.js file and places that file in a dist folder. The trouble I am having is making releases based on that folder.

Things I've tried

1. Let the normal git flow occur even with built files. What I mean by this is that when a user creates a pull-request to master, one of the diffs would be the all.min.js. This often will cause conflicts, and when the pull-request is confirmed, the all.min.js is no longer tagged with "version1.x.x".

2. My next idea was to add the dist folder to .gitignore and then use an npm package during the gulp build process to comment out the dist folder, commit and push, and then uncomment the line.

This of course does not work because as long as the dist folder exists in the repo, .gitignore will not work for that particular item.

3. The last idea is when the developer is developing, to build those files to a build folder, and add that folder to .gitignore. This way, when I use Gulp to "release" I don't have a conflict of files, and tagging is consistent. The release tasks, and only those tasks would push to the dist folder. However, I still feel that this way is too open for mistakes. But, maybe this solution is the best.

The Question: How can I improve any of these flows to get a consistent development cycle going?

KevBot
  • 17,900
  • 5
  • 50
  • 68

1 Answers1

0

… as long as the dist folder exists in the repo, .gitignore will not work for that particular item.

If you’ve already committed the dist and have committer’s remorse, you can use this answer by running:

git rm --cached <file-or-directory>

I’d be interested in knowing what you ended up doing though.

Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
abustamam
  • 1,597
  • 2
  • 13
  • 21