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(config): add 'extends' configuration option #181

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: CI

on:
pull_request:
push:

"on":
pull_request: null
push: null
jobs:

build:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -16,25 +13,23 @@ jobs:
- 14
- 16
- 17
os: [ubuntu-latest, macos-latest, windows-latest]

os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: ⬇️ Checkout
uses: actions/checkout@v2

uses: actions/checkout@v3
- name: ⎔ Setup node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm

- name: 📥 Download deps
run: npm ci

- name: Test
run: npm test
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var engine = require('./engine');
var conventionalCommitTypes = require('conventional-commit-types');
var configLoader = require('commitizen').configLoader;
var merge = require('lodash.merge');

var config = configLoader.load() || {};
var options = {
Expand All @@ -28,6 +29,13 @@ var options = {
100
};

if (!!config.extends) {
options = merge(
options,
typeof config.extends == 'string' ? require(config.extends) : config.extends
);
}

(function(options) {
try {
var commitlintLoad = require('@commitlint/load');
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"commitizen": "^4.0.3",
"conventional-commit-types": "^3.0.0",
"lodash.map": "^4.5.1",
"lodash.merge": "^4.6.2",
"longest": "^2.0.1",
"word-wrap": "^1.0.3"
},
Expand Down