Skip to content

Commit

Permalink
fix(registry): fix crash when no package.json or site-audit-seo secti…
Browse files Browse the repository at this point in the history
…on in user node_modules
  • Loading branch information
popstas committed Mar 10, 2021
1 parent 3db580b commit e3e7319
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ function loadPluginsFromDir(dir) {

function getModuleInfo(dir) {
var packageJson = path.join(dir, 'package.json');
if (!fs.existsSync(packageJson)) return {};
// const pkg = require(packageJson);
const pkg = JSON.parse(fs.readFileSync(packageJson));
if (!pkg['site-audit-seo']) return;
if (!pkg['site-audit-seo']) return {};
return pkg['site-audit-seo'];
}

Expand Down

0 comments on commit e3e7319

Please sign in to comment.