Skip to content

Commit

Permalink
chore: vulnerability fix - fork and componentize package-json-validat…
Browse files Browse the repository at this point in the history
…or (#8850)
  • Loading branch information
luvkapur committed May 3, 2024
1 parent 1faec8f commit 2c95fc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"@teambit/toolbox.fs.readdir-skip-system-files": "~0.0.2",
"@teambit/scope.modules.find-scope-path": "~0.0.1",
"@teambit/toolbox.object.sorter": "~0.0.2",
"@teambit/pkg.package-json.validator": "0.0.1",
"@viz-js/viz": "^3.4.0",
"@types/normalize-path": "^3.0.0",
"array-difference": "0.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/scope/version-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PJV } from 'package-json-validator';
import { PackageJsonValidator as PJV } from '@teambit/pkg.package-json.validator';
import R from 'ramda';
import { lt, gt } from 'semver';
import packageNameValidate from 'validate-npm-package-name';
Expand Down Expand Up @@ -227,7 +227,7 @@ ${duplicationStr}`);
}
const npmSpecs = PJV.getSpecMap('npm');
const validatePackageJsonField = (fieldName: string, fieldValue: any): string | null | undefined => {
if (!npmSpecs[fieldName]) {
if (!npmSpecs?.[fieldName]) {
// it's not a standard package.json field, can't validate
return null;
}
Expand Down

0 comments on commit 2c95fc7

Please sign in to comment.