Skip to content

Commit

Permalink
fix: update cosmiconfig to safe >=5 #599
Browse files Browse the repository at this point in the history
* fix: add @lerna/project to repository dependencies

* feat(load): update cosmiconfig #599

* fix: adapt to new cosmiconfig api
  • Loading branch information
escapedcat authored and marionebl committed Mar 28, 2019
1 parent 56f03ee commit f186fcb
Show file tree
Hide file tree
Showing 3 changed files with 7,149 additions and 244 deletions.
3 changes: 2 additions & 1 deletion @commitlint/load/package.json
Expand Up @@ -59,6 +59,7 @@
"devDependencies": {
"@commitlint/test": "^7.5.0",
"@commitlint/utils": "^7.5.0",
"alva": "^1.0.17",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^7.5.0",
Expand All @@ -73,7 +74,7 @@
"@commitlint/execute-rule": "^7.5.0",
"@commitlint/resolve-extends": "^7.5.0",
"babel-runtime": "^6.23.0",
"cosmiconfig": "^4.0.0",
"cosmiconfig": "^5.2.0",
"lodash": "4.17.11",
"resolve-from": "^4.0.0"
}
Expand Down
10 changes: 5 additions & 5 deletions @commitlint/load/src/index.js
Expand Up @@ -86,12 +86,12 @@ export default async (seed = {}, options = {cwd: process.cwd()}) => {
};

async function loadConfig(cwd, configPath) {
const explorer = cosmiconfig('commitlint', {
rcExtensions: true,
configPath: configPath ? path.resolve(cwd, configPath) : null
});
const explorer = cosmiconfig('commitlint');

const local = await explorer.load(cwd);
const explicitPath = configPath ? path.join(cwd, configPath) : undefined;
const explore = explicitPath ? explorer.load : explorer.search;
const searchPath = explicitPath ? explicitPath : cwd;
const local = await explore(searchPath);

if (local) {
return local;
Expand Down

0 comments on commit f186fcb

Please sign in to comment.