Improve resolve of AutoRest dependency path
This commit is contained in:
Родитель
cd6d3c2015
Коммит
ba9e579b11
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import url from "url";
|
||||||
import yargs from "yargs";
|
import yargs from "yargs";
|
||||||
import mkdirp from "mkdirp";
|
import mkdirp from "mkdirp";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
@ -91,16 +92,15 @@ async function main() {
|
||||||
|
|
||||||
if (args.client) {
|
if (args.client) {
|
||||||
const clientPath = path.resolve(args["output-path"], "client");
|
const clientPath = path.resolve(args["output-path"], "client");
|
||||||
const autoRestPath = path.resolve(
|
const autoRestBin =
|
||||||
"node_modules/.bin",
|
|
||||||
process.platform === "win32"
|
process.platform === "win32"
|
||||||
? "autorest.cmd"
|
? "autorest.cmd"
|
||||||
: "autorest"
|
: "autorest"
|
||||||
);
|
const autoRestPath = new url.URL(`../../node_modules/.bin/${autoRestBin}`, import.meta.url);
|
||||||
|
|
||||||
// Execute AutoRest on the output file
|
// Execute AutoRest on the output file
|
||||||
// TODO: Parameterize client language selection
|
// TODO: Parameterize client language selection
|
||||||
spawnSync(autoRestPath, [
|
spawnSync(url.fileURLToPath(autoRestPath), [
|
||||||
"--version:3.0.6367",
|
"--version:3.0.6367",
|
||||||
"--typescript",
|
"--typescript",
|
||||||
`--clear-output-folder=true`,
|
`--clear-output-folder=true`,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче