2021-04-14 15:00:51 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const { exec } = require("child_process");
|
|
|
|
const path = require("path");
|
2021-05-24 15:58:21 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
let importArgs = []
|
|
|
|
|
2021-05-24 16:54:53 +00:00
|
|
|
const nm = path.join("./", "node_modules")
|
2021-05-24 15:58:21 +00:00
|
|
|
if (fs.existsSync(nm) && fs.lstatSync(nm).isDirectory()) {
|
|
|
|
importArgs = ["-m", "node_modules"]
|
|
|
|
}
|
2021-04-14 15:00:51 +00:00
|
|
|
|
|
|
|
const args = [
|
|
|
|
"java",
|
|
|
|
"-jar",
|
2021-04-14 16:13:07 +00:00
|
|
|
path.join(__dirname, "aqua-cli.jar"),
|
2021-05-24 15:58:21 +00:00
|
|
|
...importArgs,
|
2021-04-14 15:00:51 +00:00
|
|
|
...process.argv.slice(2),
|
|
|
|
];
|
|
|
|
|
|
|
|
const argsString = args.join(" ");
|
|
|
|
|
|
|
|
console.log(argsString);
|
|
|
|
exec(argsString, (err, stdout, stderr) => {
|
|
|
|
console.error(stderr);
|
|
|
|
console.log(stdout);
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
process.exit(err.code);
|
|
|
|
}
|
|
|
|
});
|