+9
-3
@@ -62,4 +62,7 @@ var fs = require('fs'); | ||
| function getMainFiles(modulePath, override) { | ||
| var json = JSON.parse(fs.readFileSync(modulePath + '/package.json')); | ||
| var json; | ||
| var files = []; | ||
| try { | ||
| json = JSON.parse(fs.readFileSync(modulePath + '/package.json')); | ||
| } catch (e) { /* it's ok */ } | ||
@@ -84,3 +87,3 @@ if(override.ignore){ | ||
| //No main override | ||
| } else if(json.main){ | ||
| } else if(json && json.main){ | ||
| files = files.concat( | ||
@@ -91,3 +94,6 @@ glob.sync(path.resolve(modulePath + "/" + json.main)) | ||
| if (!files.length) { | ||
| console.warn('npmfiles: No main files found for module ' + path.relative(`${process.cwd()}/node_modules`, modulePath)); | ||
| } | ||
| return files; | ||
| } | ||
| } |
+1
-1
| { | ||
| "name": "npmfiles", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "Get all main files for your project's NPM modules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
10402
0.02%133
5.56%10
-9.09%