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

feat: initial release #6

Merged
merged 13 commits into from Jan 31, 2020
Merged

feat: initial release #6

merged 13 commits into from Jan 31, 2020

Conversation

skeggse
Copy link
Contributor

@skeggse skeggse commented Jan 30, 2020

Introduces a couple of useful git hooks:

  • commit-msg, which checks that commit messages authored by git commit or git commit --amend comply with commitlint
  • pre-push, which checks (depending on the configured mode) whether all commits or just the unpushed commits on the branch pass commitlint

These are configured in ~/.config/mixmax/config:

[git.hooks]
commit_msg = true
pre_push = true
pre_push_mode = "all"

It'd be real neat to be able to have a more self-contained git-hooks module, but that isn't supported yet: typicode/husky#245.

ref CORE-1846

@skeggse skeggse requested review from a team, jpdstan, jhoffmanmixmax and shils and removed request for a team January 30, 2020 21:15
Eli Skeggs added 2 commits January 30, 2020 13:18
For intensive git operations, it can be problematic to have every git hook trigger every time -
this leads to a substantial reduction in performance. We should instead recommend just listing a
subset of hooks to include in the husky config file.
module.exports = require('@mixmaxhq/git-hooks');

// Husky explicitly greps for the hook itself to determine whether to run the hook. Here are the
// hooks, to bypass this check:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@jhoffmanmixmax jhoffmanmixmax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it was a ton of work!

I'm curious if we even really have any recourse for the divergent-history case that you have TODO'd. I'm not sure how we could make this smart enough to have a useful behavior there.

Also, some of this tooling pipeline is a bit over my head, but the hooks themselves read fine to me. I'd be willing to be a beta tester for these!

@skeggse
Copy link
Contributor Author

skeggse commented Jan 30, 2020

This looks like it was a ton of work!

It took me all morning!

I can absolutely fix the divergent-history case, but I feel like I should add unit tests before I do so. We can make it smart by just linting the commits that are on the local branch but not on the remote branch.

I'd be willing to be a beta tester for these!

I think that's probably exactly how this'll work! Unfortunately, we still need to install them in all the repositories, but I'll publish it and you're encouraged to take it for a spin in your next project - just follow the readme :)

src/bin/config.js Outdated Show resolved Hide resolved
switch (mode) {
case 'unpushed': {
const [localBranch, remoteBranch] = await Promise.all([
git('branch', '--show-current'),
Copy link

@jpdstan jpdstan Jan 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this flag new? i see it in the latest git docs but i've never seen it before nor does it work when i run it locally:

> git branch --show-current
error: unknown option `show-current' 

i'm on git version 2.20.1 btw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added in 2.22.x

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add some sort of safeguard for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotta love developing for macs :s

Copy link
Contributor

@shils shils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, outside of a few missing awaits.

Eli Skeggs and others added 2 commits January 30, 2020 15:51
Copy link

@jpdstan jpdstan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm sans the git versioning thing

@skeggse skeggse merged commit 7e62282 into master Jan 31, 2020
@skeggse skeggse deleted the eli/initial-release branch January 31, 2020 00:20
mixmax-bot pushed a commit that referenced this pull request Jan 31, 2020
## 1.0.0 (2020-01-31)

### Features

* initial release ([#6](#6)) ([7e62282](7e62282))
@mixmax-bot
Copy link
Collaborator

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

5 participants