Closed alisianoi closed 7 years ago
Looks alright to me. Can we do this without adding the ends-with dependency?
I see two ways here: drop node 0.12
(which I know you secretly want to, wink-wink) or code it completely by hand. Your choice.
Let's drop node 0.12! Anything before 4.x has been dead to me for a while :shipit:
Can bump a major version to make that drop more obvious.
Ok, done. I've also manually tested installing/uninstalling commitplease which resulted in further changes to getProjectPath
, please try it out before you decide to merge. The install.js
script needed adjusting because path.relative
also relies on current working directory (source https://nodejs.org/api/path.html#path_path_relative_from_to) and silently failed to work properly too. Should be alright now though.
Spoke too soon. Travis tells me I have not accounted for self-install. Fair enough, let me hack a bit more.
Add early opt-out check for self-install, ready for review.
Let's land it.
Done, I've also written a short release summary:
https://github.com/jzaefferer/commitplease/releases/tag/v3.0.0
The v3.1.0
tag is there just not to bother with picking/rebasing the v3.0.0
tag.
Nice :-) Summary is looking good, helps explain the major version bump.
Previously, process.cwd() did the job just fine but with node v8.1.2 (compared to 7.10.0 at least) the output has changed. So, use the following hack: when installing a node package, npm adds it to PATH. Since we know: a) the suffix of that path entry (commitplease/node_modules/.bin) b) the fact that the other project is installing commitplease
then find that entry and use its prefix as parent project path
Refs: https://github.com/jquery/jquery/issues/3708