Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tsp-client] Fix tool version #8818

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/tsp-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release

## 2024-08-12 - 0.11.2

- Fix `--version` flag. (#8814)

## 2024-08-08 - 0.11.1

- Removed `compare` command.
Expand Down
11 changes: 10 additions & 1 deletion tools/tsp-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ import {
syncCommand,
updateCommand,
} from "./commands.js";
import { normalizePath, resolvePath } from "@typespec/compiler";
import { joinPaths, normalizePath, resolvePath } from "@typespec/compiler";
import PromptSync from "prompt-sync";
import { readFile } from "fs/promises";
import { fileURLToPath } from "url";
import { dirname } from "path";

const __dirname = dirname(fileURLToPath(import.meta.url));

const { version } = JSON.parse(await readFile(joinPaths(__dirname, "..", "package.json"), "utf8"));

function commandPreamble(argv: any) {
checkDebugLogging(argv);
Expand Down Expand Up @@ -49,6 +56,8 @@ export function resolveOutputDir(argv: any): string {
}

const parser = yargs(hideBin(process.argv))
.version(version)
.alias("v", "version")
.scriptName("")
.usage(usageText)
.option("debug", {
Expand Down