Skip to content

Commit

Permalink
Merge pull request #21 from snyk/feat/convert-to-typescript
Browse files Browse the repository at this point in the history
Feat/convert to typescript
  • Loading branch information
lili2311 authored Apr 28, 2019
2 parents b3c7803 + 7ec76ed commit 95b5369
Show file tree
Hide file tree
Showing 13 changed files with 9,255 additions and 85 deletions.
52 changes: 0 additions & 52 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/node_modules/
__pycache__/
*.pyc
/dist
package-lock.json
npm-debug.log
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function inspect(root, targetFile, options) {
}
var mvnArgs = buildArgs(root, targetFile, options.args);
return subProcess.execute('mvn', mvnArgs, {cwd: root})
.then(function (result) {
.then(function(result) {
var parseResult = parse(result, options.dev);
return {
plugin: {
Expand All @@ -27,7 +27,7 @@ function inspect(root, targetFile, options) {
package: parseResult.data,
};
})
.catch(function (error) {
.catch(function(error) {
error.message = error.message + '\n\n' +
'Please make sure that Apache Maven Dependency Plugin ' +
'version 2.2 or above is installed, and that ' +
Expand Down
1 change: 0 additions & 1 deletion lib/parse-mvn.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ function createPackage(pkgStr) {
return result;
}


function dequote(str) {
return str.slice(str.indexOf('"') + 1, str.lastIndexOf('"'));
}
Expand Down
10 changes: 5 additions & 5 deletions lib/sub-process.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
var childProcess = require('child_process');

module.exports.execute = function (command, args, options) {
module.exports.execute = function(command, args, options) {
var spawnOptions = {shell: true};
if (options && options.cwd) {
spawnOptions.cwd = options.cwd;
}

return new Promise(function (resolve, reject) {
return new Promise(function(resolve, reject) {
var stdout = '';
var stderr = '';

var proc = childProcess.spawn(command, args, spawnOptions);
proc.stdout.on('data', function (data) {
proc.stdout.on('data', function(data) {
stdout = stdout + data;
});
proc.stderr.on('data', function (data) {
proc.stderr.on('data', function(data) {
stderr = stderr + data;
});

proc.on('close', function (code) {
proc.on('close', function(code) {
if (code !== 0) {
return reject(new Error(stdout || stderr));
}
Expand Down
Loading

0 comments on commit 95b5369

Please sign in to comment.