Closed tripu closed 5 years ago
the reason I don't like generated files in the version control:
Maybe they could be generated automatically in a separate "prod" branch (or this could be done as an intermediary scripted step in a separate space on the target server)
Anyway, I won't die on that hill, so I'll let you assess the trade-off - at least for midgard, it's not like we had so much active development on it.
Same here: not a big deal either way. I'm just interested in finding out what's the best approach, in general. We face the same trade-offs in other projects.
Solutions I see:
They create useless conflicts if you work across several branches in parallel
Those conflicts are the easiest to resolve: you resolve conflicts in source files first (if there are any), then rebuild, and whatever generated files that produces, those are “the good ones”, right? One cannot combine changes by hand in compressed, minified or uglified files anyway.
They create noise in reviewing diffs
GH excludes many generated files automatically from diffs. It seems that when that heuristic fails (eg) we can force it with a .gitattributes
file (eg, a line public/js/app.js linguist-generated=true
). Not sure if there's a similar mechanism in Git, though.
Deferring to @dontcallmedom's opinion on this, since he and/or others are inheriting maintenance of this project.
After following @dontcallmedom's suggestion on #23 (ie, do not include JS or CSS generated files in Git), I re-deployed, and realised that there's an advantage to having those files under version control: one does not need to install all
devDependencies
in production to generate those files.In this case, one cannot do
npm install --production
and thennpm run build
— the latter fails.If those files were included in the build,
npm install --production
is possible, and we avoid the overhead/risk ofdevDependencies
in production servers.Practical example: visit Midgard in Labs and open the JS console: there are warnings coming from
watchify
. Butwatchify
is not needed in production.