From f2710d2ffdfd819be6bb2c32dbcfd578bfd8aa64 Mon Sep 17 00:00:00 2001 From: John Darryl Date: Wed, 2 Dec 2020 20:51:59 +0100 Subject: [PATCH] feat: add commit-lint config --- .commitlintrc.js | 7 +-- .github/workflows/npm-publish.yml | 5 +++ .versionrc | 4 ++ README.md | 1 + docs/TODOS.md | 1 - packages/commitlint-config/.commitlintrc.js | 6 +++ packages/commitlint-config/README.md | 43 +++++++++++++++++++ packages/commitlint-config/__tests__/index.js | 10 +++++ packages/commitlint-config/index.js | 1 + packages/commitlint-config/package.json | 37 ++++++++++++++++ 10 files changed, 108 insertions(+), 7 deletions(-) create mode 100644 packages/commitlint-config/.commitlintrc.js create mode 100644 packages/commitlint-config/README.md create mode 100644 packages/commitlint-config/__tests__/index.js create mode 100644 packages/commitlint-config/index.js create mode 100644 packages/commitlint-config/package.json diff --git a/.commitlintrc.js b/.commitlintrc.js index cb330ca..088031d 100644 --- a/.commitlintrc.js +++ b/.commitlintrc.js @@ -1,6 +1 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], - rules: { - 'header-max-length': [0, 'always', 120], - }, -} +module.exports = require('./packages/commitlint-config') diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 882d5eb..73d4cc2 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -16,6 +16,11 @@ jobs: node-version: 14 - name: Install dependencies with yarn run: yarn install --frozen-lockfile + - name: Publish commitlint-config + uses: JS-DevTools/npm-publish@v1 + with: + package: './packages/commitlint-config/package.json' + token: ${{ secrets.NPM_AUTH_TOKEN }} - name: Publish eslint-config uses: JS-DevTools/npm-publish@v1 with: diff --git a/.versionrc b/.versionrc index 536978a..a76bc47 100644 --- a/.versionrc +++ b/.versionrc @@ -4,6 +4,10 @@ "filename": "package.json", "type": "json" }, + { + "filename": "packages/commitlint-config/package.json", + "type": "json" + }, { "filename": "packages/eslint-config/package.json", "type": "json" diff --git a/README.md b/README.md index 9e8dc91..9b219eb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ My custom configurations when dealing with JavaScript applications. ## Script Configurations +- [commitlint-config](./packages/commitlint-config) - [eslint-config](./packages/eslint-config) - [eslint-config-typescript](./packages/eslint-config-typescript) - [eslint-config-typescript-react](./packages/eslint-config-typescript-react) diff --git a/docs/TODOS.md b/docs/TODOS.md index 5653e36..b81dd5f 100644 --- a/docs/TODOS.md +++ b/docs/TODOS.md @@ -1,5 +1,4 @@ # TODOs - add stylelint configuration -- add commitlint configuration - add css reset diff --git a/packages/commitlint-config/.commitlintrc.js b/packages/commitlint-config/.commitlintrc.js new file mode 100644 index 0000000..cb330ca --- /dev/null +++ b/packages/commitlint-config/.commitlintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'header-max-length': [0, 'always', 120], + }, +} diff --git a/packages/commitlint-config/README.md b/packages/commitlint-config/README.md new file mode 100644 index 0000000..484f394 --- /dev/null +++ b/packages/commitlint-config/README.md @@ -0,0 +1,43 @@ +# @jdp-dev/commitlint-config [![GitHub Build Status][shield-github-build-status]][shield-github-build-status] [![npm][shield-npm]][npm] [![MIT License][shield-license]][license] + +My shareable [commitlint](https://commitlint.js.org/) +[config](https://commitlint.js.org/#/reference-configuration). + +## Installation + +```shell script +npm install --save-dev @jdp-dev/commitlint-config +``` + +or + +```shell script +yarn add --dev @jdp-dev/commitlint-config +``` + +## Usage + +Add `@jdp-dev/commitlint-config` to the `"extends"` array in your `.commitlintrc.*` +file. + + +```javascript +module.exports = { + extends: ['@jdp-dev/commitlint-config'] +} +``` + +Or, you can use it in other ways as described in the +[official documentation](https://commitlint.js.org/#/reference-configuration?id=shareable-configuration). + +## License + +[MIT][license] © [John Darryl Pelingo][me] + +[license]: ../../LICENSE +[me]: https://johndpelingo.com/ +[npm]: https://npmjs.org/package/@jdp-dev/commitlint-config +[shield-github-build-status]: + https://github.com/john-d-pelingo/jdp-scripts/workflows/npm-publish/badge.svg +[shield-license]: https://img.shields.io/badge/License-MIT-lavender.svg +[shield-npm]: https://img.shields.io/npm/v/@jdp-dev/commitlint-config.svg diff --git a/packages/commitlint-config/__tests__/index.js b/packages/commitlint-config/__tests__/index.js new file mode 100644 index 0000000..8f25709 --- /dev/null +++ b/packages/commitlint-config/__tests__/index.js @@ -0,0 +1,10 @@ +const test = require('tape') + +test('config files parse', (t) => { + t.doesNotThrow(() => require('..'), 'index does not throw') + t.doesNotThrow( + () => require('../.commitlintrc.js'), + '.commitlintrc.js does not throw', + ) + t.end() +}) diff --git a/packages/commitlint-config/index.js b/packages/commitlint-config/index.js new file mode 100644 index 0000000..0d4caf2 --- /dev/null +++ b/packages/commitlint-config/index.js @@ -0,0 +1 @@ +module.exports = require('./.commitlintrc.js') diff --git a/packages/commitlint-config/package.json b/packages/commitlint-config/package.json new file mode 100644 index 0000000..978b5e5 --- /dev/null +++ b/packages/commitlint-config/package.json @@ -0,0 +1,37 @@ +{ + "name": "@jdp-dev/commitlint-config", + "version": "0.0.8", + "description": "My shareable commitlint config.", + "private": false, + "homepage": "https://github.com/john-d-pelingo/jdp-scripts", + "author": { + "email": "johndarrylpelingo@gmail.com", + "name": "John Darryl Pelingo", + "url": "https://johndpelingo.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/john-d-pelingo/jdp-scripts", + "directory": "packages/tsconfig" + }, + "bugs": { + "url": "https://github.com/john-d-pelingo/jdp-scripts/issues" + }, + "keywords": [ + "commitlint", + "commitlintrc" + ], + "main": "index.js", + "scripts": { + "prepublishOnly": "npm run test", + "test": "tape __tests__/*.js" + }, + "peerDependencies": { + "@commitlint/cli": ">= 11.0.0", + "@commitlint/config-conventional": ">= 11.0.0" + }, + "devDependencies": { + "tape": "^5.0.1" + } +}