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 1 commit
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 (_fs2.default.statSyncNoException(ret) && (initScript.startsWith("/") || !_path2.default.resolve(_path2.default.dirname(ret), '..').match(/[\\\/]node_modules$/i))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these built-in module name changes intentional? There aren't any _fs2 or _path2 identifiers in this file.

return ret;
}

Expand Down