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

Allow node_modules parent folders if init script is an absolute path #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/es6-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function findPackageJson(initScript) {
// Walk up the parent directories until we find package.json. Make sure that
// we're not actually stumbling upon a parent npm package
let ret = path.join(initScript, 'package.json')
if (fs.statSyncNoException(ret) && !path.resolve(path.dirname(ret), '..').match(/[\\\/]node_modules$/i)) {
if (fs.statSyncNoException(ret) && (initScript.startsWith("/") || !path.resolve(path.dirname(ret), '..').match(/[\\\/]node_modules$/i))) {
return ret;
}

Expand Down