Skip to content

Commit 287e107

Browse files
committed
initialise as global module
1 parent b6fe03c commit 287e107

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

cli.js

100644100755
File mode changed.

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const walkModules = ((path = 'node_modules') => {
1010

1111
if (item.name === 'package.json') {
1212
let pkg = JSON.parse(fs.readFileSync(item.path, 'utf8'));
13+
if (!pkg.scripts) return;
1314
let scripts = Object.keys(pkg.scripts);
1415
scripts.forEach((script) => {
1516
if (scriptTypes.includes(script)) {

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"name": "npm-viewscripts",
33
"version": "1.0.0",
4-
"bin": "cli.js",
4+
"bin": {
5+
"npm-viewscripts": "cli.js"
6+
},
7+
"main": "index.js",
58
"description": "",
69
"scripts": {
710
"test": "echo \"Error: no test specified\" && exit 1"
@@ -18,5 +21,6 @@
1821
"homepage": "https://github.com/js-kyle/npm-viewscripts#readme",
1922
"dependencies": {
2023
"directory-tree": "^2.2.4"
21-
}
24+
},
25+
"preferGlobal": true
2226
}

0 commit comments

Comments
 (0)