Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pass down strict out of sync flag to the lockfile parser #369

Merged
merged 1 commit into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ local.log
/dist
tmp
.DS_Store
package-lock.json
/package-lock.json
!/test/fixtures/**/package-lock.json
.idea
1 change: 0 additions & 1 deletion src/cli/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ async function test(...args) {
if (args.length === 0) {
args.unshift(process.cwd());
}

// org fallback to config unless specified
options.org = options.org || config.org;
// making `show-vulnerable-paths` true by default.
Expand Down
4 changes: 3 additions & 1 deletion src/lib/plugins/npm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fileSystem = require('fs');
const fs = require('then-fs');
const path = require('path');
const lockFileParser = require('snyk-nodejs-lockfile-parser');
const _ = require('lodash');

module.exports = {
inspect,
Expand Down Expand Up @@ -62,7 +63,8 @@ async function generateDependenciesFromLockfile(root, options, targetFile) {
const lockFile = await fs.readFile(lockFileFullPath, 'utf-8');
const defaultManifestFileName = path.relative(root, manifestFileFullPath);

const strictOutOfSync = _.get(options, 'strictOutOfSync', true);
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev,
lockFileParser.LockfileType.npm, true, defaultManifestFileName);
lockFileParser.LockfileType.npm, strictOutOfSync, defaultManifestFileName);
}

4 changes: 3 additions & 1 deletion src/lib/plugins/yarn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const fs = require('then-fs');
const path = require('path');
const lockFileParser = require('snyk-nodejs-lockfile-parser');
const debug = require('debug')('snyk');
const _ = require('lodash');

module.exports = {
inspect,
Expand Down Expand Up @@ -76,8 +77,9 @@ async function generateDependenciesFromLockfile(root, options, targetFile) {
const lockFile = await fs.readFile(lockFileFullPath, 'utf-8');
const defaultManifestFileName = path.relative(root, manifestFileFullPath);

const strictOutOfSync = _.get(options, 'strictOutOfSync', true);
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev,
lockFileParser.LockfileType.yarn, true, defaultManifestFileName);
lockFileParser.LockfileType.yarn, strictOutOfSync, defaultManifestFileName);
}

function getRuntimeVersion() {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/snyk-test/npm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ function generateDependenciesFromLockfile(root, options, targetFile) {
debug(resolveModuleSpinnerLabel);
return spinner(resolveModuleSpinnerLabel)
.then(() => {
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev, lockFileType);
const strictOutOfSync = _.get(options, 'strictOutOfSync', true);
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev, lockFileType, strictOutOfSync);
})
// clear spinner in case of success or failure
.then(spinner.clear(resolveModuleSpinnerLabel))
Expand Down
Loading