Improve resolve of AutoRest dependency path

This commit is contained in:
David Wilson (AZURE SDK) 2021-01-22 13:57:50 -08:00 коммит произвёл David Wilson
Родитель cd6d3c2015
Коммит ba9e579b11
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -1,5 +1,6 @@
#!/usr/bin/env node
import url from "url";
import yargs from "yargs";
import mkdirp from "mkdirp";
import * as path from "path";
@ -91,16 +92,15 @@ async function main() {
if (args.client) {
const clientPath = path.resolve(args["output-path"], "client");
const autoRestPath = path.resolve(
"node_modules/.bin",
const autoRestBin =
process.platform === "win32"
? "autorest.cmd"
: "autorest"
);
const autoRestPath = new url.URL(`../../node_modules/.bin/${autoRestBin}`, import.meta.url);
// Execute AutoRest on the output file
// TODO: Parameterize client language selection
spawnSync(autoRestPath, [
spawnSync(url.fileURLToPath(autoRestPath), [
"--version:3.0.6367",
"--typescript",
`--clear-output-folder=true`,