Skip to content

Commit 637b0fe

Browse files
authoredJun 12, 2022
refactor: test for package version as well (#1146)
additionally to the name check to determine whether this is an actual package file
1 parent 017400d commit 637b0fe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/license-plugin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ class LicensePlugin {
180180
const license = pkgJson.license || pkgJson.licenses;
181181
const hasLicense = license && license.length > 0;
182182
const name = pkgJson.name;
183+
const version = pkgJson.version;
183184
const isValidPackageName = name && packageNameRegex.test(name);
184-
if (isValidPackageName || hasLicense) {
185+
if ((isValidPackageName && version) || hasLicense) {
185186
// We found it!
186187
pkg = pkgJson;
187188

0 commit comments

Comments
 (0)