Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute precommit scripts right before the actual commit #26

Closed
rubennorte opened this issue Feb 27, 2015 · 6 comments
Closed

Execute precommit scripts right before the actual commit #26

rubennorte opened this issue Feb 27, 2015 · 6 comments

Comments

@rubennorte
Copy link

If precommit scripts were executed right before the commit (inside the update method, after the clean repo check) we could add files to the commit being created to do things like:

  • Generate an automatic changelog file
  • Generate API docs
  • Add distributable scripts only in release commits (like jQuery does)
@mikaelbr
Copy link
Owner

Good suggestion. I've been thinking of this as well! Fixed now. Would be great if you could try it out and give feedback!

@rubennorte
Copy link
Author

Wow, that was quick! Thank you very much.

I just saw something that could cause problems in the current implementation. All executions of hook scripts are asynchronous and the process waits for them to finish, except when executing the precommit scripts. In that case there's no callback and the commit is done right after the script execution, what may cause the commit to be done before the precommit scripts.

I'll try it out next monday.

@mikaelbr
Copy link
Owner

Yeah, I implemented support for that when doing #24 : 53a55e3

That will wait for pre-commit to wait before doing commit.

@rubennorte
Copy link
Author

Good work. Thanks!

@rubennorte
Copy link
Author

It worked great! I created a test project with a npm script to call mversion. In the precommit script I did the build (just copy src/index.js to dist/index.js) add the results to the index and let mversion do the commit. The dist directory was ignored in git so that was the only commit where the contents of dist where actually versioned, so now I have what I wanted.

When do you expect to release a new version to npm?

@mikaelbr
Copy link
Owner

I'd just like someone other than me to verify #24, and I'll do a minor release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants