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

Commit

Permalink
feat: log skipped modules
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
dominykas committed Jan 29, 2019
1 parent eecdb0f commit 72ad57a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
In `package.json`:
```
"allowScripts": {
"fsevents": "*",
"node-sass": "*"
"fsevents": "*", # allow install scripts in all versions
"node-sass": false # ignore install scripts
}
```

Expand Down
11 changes: 8 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const internals = {};

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

for (const [k, v] of tree.dependencies) {
for (const [, v] of tree.dependencies) {

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

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

return childPkg.scripts && (childPkg.scripts[cmd] || childPkg.scripts[`pre${cmd}`] || childPkg.scripts[`post${childPkg}`]);
})
.filter(([,childPkg]) => {
.filter(([path, childPkg]) => {

const name = childPkg.name;

if (allowed[name] === undefined) {
throw new Error(`No entry for ${name}`);
}

if (!allowed[name]) {
console.warn(`==========> skip ${path} (because it is not allowed in package.json)`);
}

return allowed[name];
})
.forEach(([path, childPkg]) => {
Expand Down

0 comments on commit 72ad57a

Please sign in to comment.