Skip to content

Commit f186fcb

Browse files
escapedcatmarionebl
authored andcommitted
fix: update cosmiconfig to safe >=5 #599
* fix: add @lerna/project to repository dependencies * feat(load): update cosmiconfig #599 * fix: adapt to new cosmiconfig api
1 parent 56f03ee commit f186fcb

File tree

3 files changed

+7149
-244
lines changed

3 files changed

+7149
-244
lines changed

@commitlint/load/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"devDependencies": {
6060
"@commitlint/test": "^7.5.0",
6161
"@commitlint/utils": "^7.5.0",
62+
"alva": "^1.0.17",
6263
"ava": "0.22.0",
6364
"babel-cli": "6.26.0",
6465
"babel-preset-commitlint": "^7.5.0",
@@ -73,7 +74,7 @@
7374
"@commitlint/execute-rule": "^7.5.0",
7475
"@commitlint/resolve-extends": "^7.5.0",
7576
"babel-runtime": "^6.23.0",
76-
"cosmiconfig": "^4.0.0",
77+
"cosmiconfig": "^5.2.0",
7778
"lodash": "4.17.11",
7879
"resolve-from": "^4.0.0"
7980
}

@commitlint/load/src/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ export default async (seed = {}, options = {cwd: process.cwd()}) => {
8686
};
8787

8888
async function loadConfig(cwd, configPath) {
89-
const explorer = cosmiconfig('commitlint', {
90-
rcExtensions: true,
91-
configPath: configPath ? path.resolve(cwd, configPath) : null
92-
});
89+
const explorer = cosmiconfig('commitlint');
9390

94-
const local = await explorer.load(cwd);
91+
const explicitPath = configPath ? path.join(cwd, configPath) : undefined;
92+
const explore = explicitPath ? explorer.load : explorer.search;
93+
const searchPath = explicitPath ? explicitPath : cwd;
94+
const local = await explore(searchPath);
9595

9696
if (local) {
9797
return local;

0 commit comments

Comments
 (0)