Skip to content

Commit 478f448

Browse files
fix findAppRoot
1 parent bd1ebf4 commit 478f448

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bin/cf-openapi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ program
3939
specPath = path.resolve(process.cwd(), specPath);
4040

4141
try {
42-
if (!require.resolve(specPath)) {
42+
if (!fs.existsSync(specPath)) {
4343
throw new Error(`No spec file by path: ${specPath}`);
4444
}
4545
const openapi = require(specPath); // eslint-disable-line

lib/helpers/general.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function makeUrl(serviceConfig) {
99
}
1010

1111
function findAppRoot(dir = path.dirname(require.main.filename)) {
12-
return fs.existsSync(path.join(dir, 'package.json'))
12+
return !_.includes(dir, 'node_modules') && fs.existsSync(path.join(dir, 'package.json'))
1313
? dir
1414
: findAppRoot(path.resolve(dir, '..'));
1515
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefresh-io/cf-openapi",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"scripts": {
55
"test": "jest --runInBand",
66
"eslint": "eslint lib/**",

0 commit comments

Comments
 (0)