@microsoft.azure/autorest.testserver
Version:
Autorest test server.
57 lines • 2.5 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = require("path");
const yargs_1 = __importDefault(require("yargs"));
const helpers_1 = require("yargs/helpers");
const coverage_1 = require("./coverage");
async function main() {
await (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
.option("coverageDirectory", {
description: "Path to the folder of the coverage files. Should be $pwd/coverage where $pwd is the directory where autorest.testserver was run from.",
default: (0, path_1.join)(process.cwd(), "coverage"),
type: "string",
})
.version(false)
.option("version", { description: "Version", type: "string" })
.command("publish", "Publish testserver coverage", (cmd) => {
return cmd
.option("repo", { type: "string", description: "Name of the Github Repo", demandOption: true })
.option("ref", { type: "string", description: "Ref to the branch/pr.", demandOption: true })
.option("githubToken", { type: "string", description: "Github token for authentication" })
.option("azStorageAccount", {
type: "string",
description: "Azure storager account name",
demandOption: true,
})
.option("azStorageAccessKey", {
type: "string",
description: "Authentication key for storage account",
demandOption: true,
});
}, (args) => {
var _a;
const pr = Number(args.ref.split("/")[2]);
return (0, coverage_1.immediatePush)(args.repo, pr.toString(), (_a = args.githubToken) !== null && _a !== void 0 ? _a : "", args.azStorageAccount, args.azStorageAccessKey, args.version, args.coverageDirectory);
})
.command("clear", "Clear the code coverage directory", () => null, async (args) => {
await fs_1.default.promises.rm(args.coverageDirectory, { recursive: true });
})
.fail(function (msg, err) {
if (err) {
throw err;
}
// eslint-disable-next-line no-console
console.log(msg);
process.exit(1);
}).argv;
}
main().catch((e) => {
// eslint-disable-next-line no-console
console.error(e);
});
//# sourceMappingURL=cli.js.map