Skip to content

Commit

Permalink
- fix bug: node_modules lookup may fall into endless loop and halt…
Browse files Browse the repository at this point in the history
… the program.

 - bump version
  • Loading branch information
zbryikt committed Dec 16, 2022
1 parent 7c9b036 commit 666a9c1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Change Logs

## v1.1.9

- fix bug: `node_modules` lookup may fall into endless loop and halt the program.


## v1.1.8

- support modules from parent `node_modeuls`
- support modules from parent `node_modules`


## v1.1.7
Expand Down
4 changes: 2 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ cmds['default'] = {
root = localModule.path;
} else {
base = '.';
while (root !== '/') {
while (path.resolve(base) !== '/') {
root = path.resolve(path.join(base, 'node_modules', obj.name));
if (fs.existsSync(root)) {
if (fs.existsSync(path.join(root, 'package.json'))) {
break;
}
base = path.join(base, '..');
Expand Down
4 changes: 2 additions & 2 deletions lib/main.ls
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ cmds.default =
if local-module => root = local-module.path
else
base = '.'
while root != \/
while path.resolve(base) != \/
root = path.resolve(path.join base, \node_modules, obj.name)
if fs.exists-sync(root) => break
if fs.exists-sync(path.join(root, \package.json)) => break
base = path.join(base, \..)

info = JSON.parse(fs.read-file-sync path.join(root, "package.json") .toString!)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"cli.js"
],
"description": "Frontend dependency installer",
"version": "1.1.8",
"version": "1.1.9",
"homepage": "https://github.com/plotdb/fedep",
"repository": {
"type": "git",
Expand Down

0 comments on commit 666a9c1

Please sign in to comment.