microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
packages/internal-build-utils/src/cli.ts
52lines · modecode
| 1 | import yargs from "yargs"; |
| 2 | import { generateThirdPartyNotice } from "./generate-third-party-notice.js"; |
| 3 | import { bumpVersionsForPR, bumpVersionsForPrerelease } from "./prerelease.js"; |
| 4 | |
| 5 | main().catch((e) => { |
| 6 | // eslint-disable-next-line no-console |
| 7 | console.error(e); |
| 8 | process.exit(1); |
| 9 | }); |
| 10 | |
| 11 | async function main() { |
| 12 | await yargs(process.argv.slice(2)) |
| 13 | .scriptName("typespec-build-tool") |
| 14 | .help() |
| 15 | .strict() |
| 16 | .command( |
| 17 | "generate-third-party-notices", |
| 18 | "Generate the third party notice", |
| 19 | () => {}, |
| 20 | () => generateThirdPartyNotice() |
| 21 | ) |
| 22 | .command( |
| 23 | "bump-version-preview <workspaceRoots...>", |
| 24 | "Bump all package version for the preview", |
| 25 | (cmd) => |
| 26 | cmd.positional("workspaceRoots", { |
| 27 | type: "string", |
| 28 | array: true, |
| 29 | demandOption: true, |
| 30 | }), |
| 31 | (args) => bumpVersionsForPrerelease(args.workspaceRoots) |
| 32 | ) |
| 33 | .command( |
| 34 | "bump-version-pr <workspaceRoot>", |
| 35 | "Bump all package version for the PR", |
| 36 | (cmd) => |
| 37 | cmd |
| 38 | .positional("workspaceRoot", { |
| 39 | type: "string", |
| 40 | demandOption: true, |
| 41 | }) |
| 42 | .option("pr", { |
| 43 | type: "number", |
| 44 | demandOption: true, |
| 45 | }) |
| 46 | .option("buildNumber", { |
| 47 | type: "string", |
| 48 | demandOption: true, |
| 49 | }), |
| 50 | (args) => bumpVersionsForPR(args.workspaceRoot, args.pr, args.buildNumber) |
| 51 | ).argv; |
| 52 | } |