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

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

wants to merge 2 commits into from

Conversation

wolfgang
Copy link

This is in reference to Issue #39 - Don't check for a node_modules parent if init script has an absolute path.

src/es6-init.js Outdated
@@ -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.

@wolfgang
Copy link
Author

Oh, sorry about that, my bad. Pushed the fix.

Copy link
Author

@wolfgang wolfgang left a comment

Choose a reason for hiding this comment

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

Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants