Skip to content

Commit

Permalink
feat: add debugging (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-es authored Dec 1, 2020
1 parent 5ee371e commit 35d8faf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node

var debug = require('debug')('index')
var fs = require('fs');
var snykFilter = require('./lib/snyk-filter.js');
var argv = require('minimist')(process.argv.slice(2));
Expand Down
3 changes: 3 additions & 0 deletions lib/snyk-display.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
var debug = require('debug')('snyk-display')

const chalk = require('chalk');

Expand All @@ -9,6 +10,8 @@ module.exports = {displayResult: displayResult };

function displayResult(res, options) {

debug('options: ' + options)

var meta = metaForDisplay(res, options) + '\n\n';
var packageManager = options.packageManager;
var summary = 'Tested ';
Expand Down
5 changes: 4 additions & 1 deletion lib/snyk-filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node

var debug = require('debug')('snyk-filter')
const yaml = require('js-yaml');
const fs = require('fs');
const path = require('path');
Expand All @@ -14,6 +14,7 @@ var options = {"showVulnPaths": true, "path": path.dirname(__dirname).split(path

function onDataCallback(data, reportCallback) {

debug('data: ' + data)

const jqFilterString = customFilters.filter;
const jqPassString = customFilters.pass;
Expand Down Expand Up @@ -60,6 +61,7 @@ function run(source, reportCallback, filters, cliOptions = null) {
try {
var ymlFileInJSON = yaml.safeLoad(fs.readFileSync(filters, 'utf8'));
customFilters = ymlFileInJSON.customFilters;
debug(customFilters)
} catch (e) {
console.log("Error loading yml file" + e);
}
Expand All @@ -74,6 +76,7 @@ function run(source, reportCallback, filters, cliOptions = null) {
}
} catch (error) {
console.log('out');
debug('error reading input: ' + error)
}
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"chalk": "^2.3.2",
"debug": "^4.3.1",
"is-relative": "^1.0.0",
"js-yaml": "^3.13.1",
"lodash": "^4.17.20",
Expand All @@ -26,4 +27,4 @@
"mocha": "^5.0.4"
},
"snyk": true
}
}

0 comments on commit 35d8faf

Please sign in to comment.