Skip to content

Commit

Permalink
chore: commitlint and standard version setup
Browse files Browse the repository at this point in the history
  • Loading branch information
westeezy committed Feb 28, 2022
1 parent 7ed15b4 commit 6d9b587
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -24,6 +24,9 @@ jobs:
with:
useLockFile: false

- name: 👕 Lint commit messages
uses: wagoid/commitlint-github-action@v4

- name: ▶️ Run flow-typed script
run: npm run flow-typed

Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,32 @@
name: "publish to npm"
on: workflow_dispatch
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0

- name: ⎔ Setup node
# sets up the .npmrc file to publish to npm
uses: actions/setup-node@v2
with:
node-version: "14"
registry-url: "https://registry.npmjs.org"

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: Configure git user
run: |
git config --global user.email ${{ github.actor }}@users.noreply.github.com
git config --global user.name ${{ github.actor }}
- name: ▶️ Run release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/commit-msg
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
6 changes: 6 additions & 0 deletions commitlint.config.js
@@ -0,0 +1,6 @@
/* @flow */
/* eslint import/no-commonjs: off */

module.exports = {
extends: [ '@commitlint/config-conventional' ]
};
56 changes: 50 additions & 6 deletions package.json
Expand Up @@ -14,13 +14,53 @@
"webpack": "babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/webpack --progress",
"test": "npm run lint && npm run flow-typed && npm run flow && npm run karma",
"build": "npm run test && npm run babel && npm run webpack",
"release": "./publish.sh",
"release:patch": "./publish.sh patch",
"release:minor": "./publish.sh minor",
"release:major": "./publish.sh major",
"clean": "rimraf dist coverage",
"reinstall": "rimraf flow-typed && rimraf node_modules && npm install && flow-typed install",
"debug": "cross-env NODE_ENV=debug"
"debug": "cross-env NODE_ENV=debug",
"prepare": "husky install",
"prerelease": "npm run clean && npm run build && git add dist && git commit -m 'ci: check in dist folder' || echo 'Nothing to distribute'",
"release": "standard-version",
"postrelease": "git push && git push --follow-tags && npm publish"
},
"standard-version": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"hidden": false
},
{
"type": "docs",
"hidden": false
},
{
"type": "style",
"hidden": false
},
{
"type": "refactor",
"hidden": false
},
{
"type": "perf",
"hidden": false
},
{
"type": "test",
"hidden": false
},
{
"type": "ci",
"hidden": true
}
]
},
"files": [
"dist/",
Expand Down Expand Up @@ -48,8 +88,12 @@
],
"readmeFilename": "README.md",
"devDependencies": {
"@commitlint/cli": "^16.2.1",
"@commitlint/config-conventional": "^16.2.1",
"flow-bin": "0.135.0",
"grumbler-scripts": "^5.0.3",
"mocha": "^4.1.0"
"husky": "^7.0.4",
"mocha": "^4.1.0",
"standard-version": "^9.3.2"
}
}

0 comments on commit 6d9b587

Please sign in to comment.