Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jlegrone committed Jul 21, 2017
0 parents commit e04bffe
Show file tree
Hide file tree
Showing 7 changed files with 2,291 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const { config } = require('./package.json')

const { types: typeKeys, scope } = config['validate-commit-msg']
const typeSet = new Set(typeKeys)

const types = [
{
value: 'feat',
name: 'feat: A new feature'
},
{
value: 'fix',
name: 'fix: A bug fix'
},
{
value: 'docs',
name: 'docs: Documentation only changes'
},
{
value: 'refactor',
name: 'refactor: A code change that neither fixes a bug nor adds a feature'
},
{
value: 'test',
name: 'test: Adding missing tests'
},
{
value: 'chore',
name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation'
},
{
value: 'revert',
name: 'revert: Revert to a commit'
},
{
value: 'WIP',
name: 'WIP: Work in progress'
}
].filter(type => typeSet.has(type.value))


const filteredScopes = new Set(['npm'])
const scopes = scope.allowed
.filter(name => !filteredScopes.has(name))
.map(name => ({ name }))

module.exports = {
types,
scopes,
scopeOverrides: {
chore: [
...scopes,
{ name: 'npm' }
]
},
allowCustomScopes: true,
allowBreakingChanges: [
'feat',
'fix',
'refactor'
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js
cache:
yarn: true
directories:
- node_modules
notifications:
email: false
node_js:
- '8'
after_success:
- yarn semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @jlegrone/git-config

```
$ npm install --global @jlegrone/git-config
```
62 changes: 62 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@jlegrone/git-config",
"version": "0.0.0-semantically-released",
"author": "Jacob LeGrone",
"license": "MIT",
"description": "Shared git configuration",
"repository": {
"type": "git",
"url": "https://github.com/jlegrone/git-config"
},
"scripts": {
"commit": "git-cz",
"commitmsg": "validate-commit-msg",
"remove-config": "sed -i.backup '/jlegrone.gitconfig/d' ~/.gitconfig",
"add-config": "git config --global --add include.path $PWD/src/jlegrone.gitconfig",
"postinstall": "npm run remove-config && npm run add-config",
"preuninstall": "npm run remove-config",
"semantic-release": "semantic-release pre && npm publish --access public && semantic-release post"
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
},
"cz-customizable": {
"config": ".cz-config.js"
},
"validate-commit-msg": {
"types": [
"feat",
"fix",
"docs",
"refactor",
"test",
"chore",
"revert"
],
"scope": {
"required": false,
"allowed": [
"aliases",
"repo",
"npm"
],
"validate": true,
"multiple": true
},
"warnOnFail": true,
"maxSubjectLength": 100,
"subjectPattern": ".+",
"subjectPatternErrorMsg": "subject does not match subject pattern!",
"helpMessage": "\nTry running `yarn commit` for help.",
"autoFix": true
}
},
"devDependencies": {
"commitizen": "^2.9.6",
"cz-customizable": "^5.0.0",
"husky": "^0.14.3",
"validate-commit-msg": "^2.12.2",
"semantic-release": "^6.3.6"
}
}
45 changes: 45 additions & 0 deletions src/jlegrone.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[alias]
# List all available git aliases
# Usage: git aliases
aliases = "!git config -l | grep alias | cut -c 7-"

# View all branches containing a given commit hash
# Usage: git contains <hash>
contains = branch -a --contains

# Update your current branch from develop
# ** Rewrites history **
# Usage: git up
up = pull --rebase --autostash origin develop

# Start a feature branch based off of latest develop branch
# Usage: git start <name-of-feature>
start = "!sh -c \"git checkout develop && git up && git cb feature/$1\" -"

# Start a hotfix branch based off of latest master branch
# Usage: git hotfix <name-of-production-patch>
hotfix = "!sh -c \"git checkout master && git up && git cb hotfix/$1\" -"

# Create a "work in progress" commit with your current changes
# Usage: git wip
wip = !git add . && git commit -am "WIP"

# Undo your last commit
# Usage: git undo
undo = reset --soft HEAD~1

# Amend your last commit to include current changes
# ** Rewrites history **
# Usage: git amend
amend = "!git add . && git commit --amend --no-edit"

# Push the current branch to the remote "origin", and set it to track the upstream branch
# Usage: git publish
publish = "!git push -u origin $(git branch-name)"

# Delete merged branches
# Usage: git cleanup
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"

# Get the current branch name (not so useful in itself, but used in other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
Loading

0 comments on commit e04bffe

Please sign in to comment.