diff --git a/.github/.git_commit_msg.txt b/.github/.git_commit_msg.txt new file mode 100644 index 00000000000..61119c08382 --- /dev/null +++ b/.github/.git_commit_msg.txt @@ -0,0 +1,33 @@ +# : (If applied, this commit will...) (Max 50 char) +# |<---- Using a Maximum Of 50 Characters ---->| Hard limit to 72 -->| + + +# Explain why this change is being made +# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| + +# Provide links to any relevant issues, articles, commits, or other +# pull requests +# Example: See #23, fixes #58 + +# --- COMMIT END --- +# can be +# feat (new feature) +# fix (bug fix) +# refactor (refactoring production code) +# style (formatting, missing semi colons, etc; no code change) +# test (adding or refactoring tests; no production code change) +# chore (updating npm scripts etc; no production code change) +# -------------------- +# Remember to +# Capitalize the subject line +# Use the imperative mood in the subject line +# Do not end the subject line with a period +# Separate subject from body with a blank line (comments don't count) +# Use the body to explain what and why vs. how +# Can use multiple lines with "-" for bullet points in body +# +# If you can't summarize your changes in a single line, they should +# probably be split into multiple commits +# -------------------- +# For more information about this template, check out +# https://gist.github.com/adeekshith/cd4c95a064977cdc6c50 diff --git a/.gitignore b/.gitignore index 5a051c582df..290eb2b8d0d 100755 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,6 @@ dev/*.js dev/*css !dev/index.js !dev/router.js +!dev/prepare-commit-message.js /es5 /dist diff --git a/dev/prepare-commit-message.js b/dev/prepare-commit-message.js new file mode 100644 index 00000000000..a02cd832234 --- /dev/null +++ b/dev/prepare-commit-message.js @@ -0,0 +1,14 @@ +const fs = require('fs') + +const [ + messageFile, + commitType, + commitHash +] = process.env.GIT_PARAMS.split(' ') + +if (commitType == null) { + const currentMessage = fs.readFileSync(messageFile) + const newMessage = fs.readFileSync('.github/.git_commit_msg.txt') + fs.writeFileSync(messageFile, newMessage) + fs.appendFileSync(messageFile, currentMessage) +} diff --git a/package.json b/package.json index e9c8f3fa618..37bf0c2d04f 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "version": "npm run build", "test": "cross-env NODE_ENV=test jest", "lint": "eslint --ext .js,.vue src", + "preparecommitmsg": "node dev/prepare-commit-message.js", "precommit": "yarn run lint && yarn test", "prepush": "yarn run lint && yarn test" },