npm-java-runner
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -9,4 +9,37 @@ #!/usr/bin/env node | ||
var path_1 = __importDefault(require("path")); | ||
var fs_1 = __importDefault(require("fs")); | ||
var child_process_1 = __importDefault(require("child_process")); | ||
function execute(command) { | ||
child_process_1.default.exec(command, function (error, stdout, stderr) { | ||
if (error) { | ||
console.error(error); | ||
} | ||
if (stderr) { | ||
console.error(stderr); | ||
} | ||
if (stdout) { | ||
console.log(stdout); | ||
} | ||
}); | ||
} | ||
function search(dir, regex) { | ||
var result = []; | ||
for (var file in fs_1.default.readdirSync(dir)) { | ||
var filePath = path_1.default.join(dir, file); | ||
var stat = fs_1.default.statSync(filePath); | ||
if (stat.isFile() && new RegExp(regex).test(filePath)) { | ||
result.push(filePath); | ||
} | ||
else if (stat.isDirectory()) { | ||
result = result.concat(search(filePath, regex)); | ||
} | ||
} | ||
return result; | ||
} | ||
function resolveRunnableJar(regexp, path) { | ||
throw "Cannot find " + regexp + " in " + path; | ||
var found = search(path, regexp); | ||
if (found.length > 1) { | ||
throw "Multiple matches of " + regexp + " in " + path + " " + JSON.stringify(found); | ||
} | ||
return found[0]; | ||
} | ||
@@ -22,5 +55,5 @@ function run(userPath) { | ||
var runnableJar = resolveRunnableJar(runnableJarRegexp, userPath); | ||
console.log("Runnable jar: " + runnableJar); | ||
execute("java -jar " + runnableJar); | ||
} | ||
exports.run = run; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "npm-java-runner", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"scripts": { | ||
"build": "npm run format && tsc -p .", | ||
"format": "prettier --write .", | ||
"release": "npm version patch && npm publish && git push --follow-tags" | ||
"release": "npm run build && npm version patch && npm publish && git push --follow-tags" | ||
}, | ||
@@ -9,0 +9,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5296
58
3
1