aqua/npm/index-java.js
Dima 7556db0a93
Use .js file in aqua command by default (#278)
* move to `aqua` and `aqua-j`

* more updates

* update readme

* aqua-cli -> aqua

* don't publish aqua as aqua-cli

* update scala

Co-authored-by: Dmitry Kurinskiy <dmitry@fluence.one>
2021-09-08 13:37:59 +03:00

35 lines
672 B
JavaScript

#!/usr/bin/env node
"use strict";
const { exec } = require("child_process");
const path = require("path");
const fs = require('fs');
let importArgs = []
const nm = path.join("./", "node_modules")
if (fs.existsSync(nm) && fs.lstatSync(nm).isDirectory()) {
importArgs = ["-m", "node_modules"]
}
const args = [
"java",
"-jar",
path.join(__dirname, "aqua.jar"),
...importArgs,
...process.argv.slice(2),
];
const argsString = args.join(" ");
console.log("Aqua Java " + argsString);
exec(argsString, (err, stdout, stderr) => {
console.error("Aqua Java: " + stderr);
console.log("Aqua Java: " + stdout);
if (err) {
process.exit(err.code);
}
});