Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request streamich#172 from streamich/recursive
Browse files Browse the repository at this point in the history
Recursive
  • Loading branch information
streamich authored May 16, 2020
2 parents f9573ff + fb05bfb commit b284b13
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ git cz

## Custom config

You can provide custom configuration in `changelog.config.js` file
in your repo. Below is default config:
You can provide a custom configuration in a `changelog.config.js` file in your repo, or in any parent folder.
git-cz will search for the closest config file.
Below is default config:

```js
module.exports = {
Expand Down Expand Up @@ -250,4 +251,3 @@ Installs in 0.6s vs 31.1s.
npm i -g mol-conventional-changelog
added 345 packages in 31.076s
```

10 changes: 8 additions & 2 deletions lib/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ const findOverrides = (root) => {
const dir = root || process.cwd();

for (const file of configFiles) {
const filename = path.join(dir, file);
const filename = path.resolve(dir, file);

if (fs.existsSync(filename)) {
if (fs.existsSync(filename) && fs.statSync(filename).isFile()) {
return require(filename);
}
}

const parent = path.resolve(dir, '..');

if (parent !== dir) {
return findOverrides(parent);
}

const pkgFilename = path.join(dir, 'package.json');

if (fs.existsSync(pkgFilename)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "git-cz",
"version": "4.4.1",
"version": "4.5.0",
"description": "Semantic emojified git commit, git-cz",
"main": "dist/cz.js",
"bin": {
Expand Down

0 comments on commit b284b13

Please sign in to comment.