Re:I've Just Liberated My Modules
by jacobr on Wednesday March 23, 2016 @03:32AM
(#11342706)
You don't get any prepublish hook when pushing to a git repository though, so you can't do things like preprocess with babel, typescript, etc, unless you check in the compiled source.
[ Parent
| on HN ]
Re:I've Just Liberated My Modules
by nostrademons on Wednesday March 23, 2016 @01:18PM
(#11346389)
You do, actually, if you've setup the git repository correctly.
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
Check out the pre-push, pre-receive, update, and post-update hooks.
Re:I've Just Liberated My Modules
by jessaustin on Wednesday March 23, 2016 @02:34PM
(#11347036)
Those hooks aren't tracked in the repo though, are they? In many cases that will be inconvenient.
Re:I've Just Liberated My Modules
by nostrademons on Wednesday March 23, 2016 @02:51PM
(#11347174)
They're placed in the repo itself, under .git/hooks, rather than in the working tree. If you want to version them, you can always place a symlink in .git/hooks and have it point to a file inside the working tree. Note that this won't work for bare repositories (which have no working tree), but usually in that case you want a separate deploy process where a sysadmin (or build script) manually copies over files, to prevent a random dev from borking the repository, which a bad update hook can easily do.
(This doesn't help with the GitHub case. But then, as we saw from the recent CocoaPods story, using GitHub as your CDN is probably not a great idea either.)
Re:I've Just Liberated My Modules
by jessaustin on Wednesday March 23, 2016 @02:59PM
(#11347249)
Well, sure, but that's complicated, and ".scripts.prepublish" in package.json is not. I'd love to have the git knowledge to do what you've described here without googling and frowning, but I don't have that yet, and I've been using git for years. Whereas I could use package.json to accomplish the same task on basically the first day I used npm.