lockfile-lint-api
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -38,8 +38,4 @@ const ValidatorHost = require('../src/validators/ValidateHost') | ||
{ | ||
message: 'detected invalid origin for package: @babel/code-frame', | ||
message: 'detected invalid host for package: @babel/code-frame', | ||
package: '@babel/code-frame' | ||
}, | ||
{ | ||
message: 'detected invalid origin for package: meow', | ||
package: 'meow' | ||
} | ||
@@ -125,2 +121,27 @@ ] | ||
}) | ||
it('validator should allow for git-based URLs', () => { | ||
const mockedPackages = { | ||
'@babel/code-frame': { | ||
resolved: 'https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz' | ||
}, | ||
meow: { | ||
resolved: 'git+ssh://lirantal@github.com/lirantal/dockly.git#1234567890' | ||
}, | ||
'@babel/generator': { | ||
resolved: 'https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz' | ||
} | ||
} | ||
const validator = new ValidatorHost({packages: mockedPackages}) | ||
expect(validator.validate(['npm', 'github.com'])).toEqual({ | ||
type: 'error', | ||
errors: [ | ||
{ | ||
message: 'detected invalid host for package: @babel/code-frame', | ||
package: '@babel/code-frame' | ||
} | ||
] | ||
}) | ||
}) | ||
}) |
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.1.0](https://github.com/lirantal/lockfile-lint/compare/lockfile-lint-api@2.0.0...lockfile-lint-api@2.1.0) (2019-10-12) | ||
### Features | ||
* **schema:** support protocol schema and refactor host validators ([#12](https://github.com/lirantal/lockfile-lint/issues/12)) ([a483115](https://github.com/lirantal/lockfile-lint/commit/a483115)) | ||
# [2.0.0](https://github.com/lirantal/lockfile-lint/compare/lockfile-lint-api@1.0.7...lockfile-lint-api@2.0.0) (2019-07-22) | ||
@@ -8,0 +19,0 @@ |
@@ -5,2 +5,3 @@ 'use strict' | ||
const ValidateHttps = require('./src/validators/ValidateHttps') | ||
const ValidateScheme = require('./src/validators/ValidateScheme') | ||
const ParseLockfile = require('./src/ParseLockfile') | ||
@@ -11,3 +12,4 @@ | ||
ValidateHost, | ||
ValidateHttps | ||
ValidateHttps, | ||
ValidateScheme | ||
} |
{ | ||
"name": "lockfile-lint-api", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Lint an npm or yarn lockfile to analyze and detect issues", | ||
@@ -178,3 +178,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "3739ad92ae0f272605c6f76f023e48cd2ce31003" | ||
"gitHead": "463ed503352b660a11512c199b87e37ea03ac043" | ||
} |
@@ -97,3 +97,3 @@ /* eslint-disable security/detect-object-injection */ | ||
version: depMetadata.version, | ||
resolved: depMetadata.resolved, | ||
resolved: depMetadata.resolved ? depMetadata.resolved : depMetadata.version, | ||
integrity: depMetadata.integrity, | ||
@@ -100,0 +100,0 @@ requires: depMetadata.requires |
@@ -6,5 +6,5 @@ 'use strict' | ||
const REGISTRY = { | ||
npm: 'https://registry.npmjs.org', | ||
yarn: 'https://registry.yarnpkg.com', | ||
verdaccio: 'https://registry.verdaccio.org' | ||
npm: 'registry.npmjs.org', | ||
yarn: 'registry.yarnpkg.com', | ||
verdaccio: 'registry.verdaccio.org' | ||
} | ||
@@ -39,6 +39,6 @@ | ||
if (allowedHosts.indexOf(packageResolvedURL.origin) === -1) { | ||
if (allowedHosts.indexOf(packageResolvedURL.host) === -1) { | ||
// throw new Error(`detected invalid origin for package: ${packageName}`) | ||
validationResult.errors.push({ | ||
message: `detected invalid origin for package: ${packageName}`, | ||
message: `detected invalid host for package: ${packageName}`, | ||
package: packageName | ||
@@ -45,0 +45,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45788
21
642