kumavis / browserify-commit-sha

:1234: append the latest commit sha to the bundle
MIT License
1 stars 3 forks source link

Change to save version and date to global variables, instead of comments #2

Closed deathcap closed 9 years ago

deathcap commented 9 years ago

imho, it is more convenient to have the git version and dates available in global variables, rather than comments. Users can then open the browser console to print the values of these variables, or other code can be written to look at these variables and display them wherever appropriate (about dialogs, diagnostic reports, etc.). The values of course can still be visible by viewing the source.

This PR uses GIT_VERSION and CREATED_AT, but I'm not attached to these names (better alternatives to avoid possible naming clashes? something on a _browserify_commit_sha object? maybe it should be an option? idk)

(As a side-effect, this change also allows browserify-commit-sha to easily work with coffeeify, or other transforms from languages that have the same variable assignment and string literal syntax, but a comment syntax differing from JavaScript. If, for some reason, they run after this transform)

kumavis commented 9 years ago

I like this. I suggest:

I think we can assume that we'll get javascript, the user just has to think about the ordering of the transforms, which they should think about anyways if they are doing any transpiling.

kumavis commented 9 years ago

Added you as contributor on GH and as owner on npm :smile_cat: go nuts.

deathcap commented 9 years ago

Cool thanks, I'll treat it well