Skip to content
This repository was archived by the owner on Aug 18, 2024. It is now read-only.

Commit 72ad57a

Browse files
committed
feat: log skipped modules
Closes #2
1 parent eecdb0f commit 72ad57a

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
In `package.json`:
44
```
55
"allowScripts": {
6-
"fsevents": "*",
7-
"node-sass": "*"
6+
"fsevents": "*", # allow install scripts in all versions
7+
"node-sass": false # ignore install scripts
88
}
99
```
1010

lib/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const internals = {};
1111

1212
internals.scan = (tree, parent, map = new Map(), scanned = new Set()) => {
1313

14-
for (const [k, v] of tree.dependencies) {
14+
for (const [, v] of tree.dependencies) {
1515

1616
if (v.hasCycle()) {
17-
console.warn(`Cycle in ${k} - skipping`);
17+
console.warn(`==========> skip ${v.path()} (because it has a cycle in dependencies)`);
1818
continue;
1919
}
2020

@@ -69,13 +69,18 @@ exports.run = (cmd = 'install') => {
6969

7070
return childPkg.scripts && (childPkg.scripts[cmd] || childPkg.scripts[`pre${cmd}`] || childPkg.scripts[`post${childPkg}`]);
7171
})
72-
.filter(([,childPkg]) => {
72+
.filter(([path, childPkg]) => {
7373

7474
const name = childPkg.name;
75+
7576
if (allowed[name] === undefined) {
7677
throw new Error(`No entry for ${name}`);
7778
}
7879

80+
if (!allowed[name]) {
81+
console.warn(`==========> skip ${path} (because it is not allowed in package.json)`);
82+
}
83+
7984
return allowed[name];
8085
})
8186
.forEach(([path, childPkg]) => {

0 commit comments

Comments
 (0)