diff --git a/tools/tsp-client/CHANGELOG.md b/tools/tsp-client/CHANGELOG.md index 3ef73ac6028..c2ff5ea6274 100644 --- a/tools/tsp-client/CHANGELOG.md +++ b/tools/tsp-client/CHANGELOG.md @@ -1,5 +1,9 @@ # Release +## 2024-06-07 - 0.8.1 + +- Normalize and clean up the directory property in tsp-location.yaml. + ## 2024-05-29 - 0.8.0 - Create unique directories for sparse spec checkout. diff --git a/tools/tsp-client/package-lock.json b/tools/tsp-client/package-lock.json index d89d76321a1..c8d1ed0d3fc 100644 --- a/tools/tsp-client/package-lock.json +++ b/tools/tsp-client/package-lock.json @@ -1,12 +1,12 @@ { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.8.0", + "version": "0.8.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.8.0", + "version": "0.8.1", "license": "MIT", "dependencies": { "@azure/core-rest-pipeline": "^1.12.0", diff --git a/tools/tsp-client/package.json b/tools/tsp-client/package.json index ea28d42a856..88bde429c99 100644 --- a/tools/tsp-client/package.json +++ b/tools/tsp-client/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.8.0", + "version": "0.8.1", "description": "A tool to generate Azure SDKs from TypeSpec", "main": "dist/index.js", "homepage": "https://github.com/Azure/azure-sdk-tools/tree/main/tools/tsp-client#readme", diff --git a/tools/tsp-client/src/fs.ts b/tools/tsp-client/src/fs.ts index 9863b112646..bddd6893048 100644 --- a/tools/tsp-client/src/fs.ts +++ b/tools/tsp-client/src/fs.ts @@ -2,7 +2,7 @@ import { mkdir, rm, stat, readFile, access } from "node:fs/promises"; import { Logger } from "./log.js"; import { parse as parseYaml } from "yaml"; import { TspLocation } from "./typespec.js"; -import { joinPaths, resolvePath } from "@typespec/compiler"; +import { joinPaths, normalizePath, resolvePath } from "@typespec/compiler"; export async function ensureDirectory(path: string) { await mkdir(path, { recursive: true }); @@ -32,6 +32,11 @@ export async function readTspLocation(rootDir: string): Promise { if (!tspLocation.additionalDirectories) { tspLocation.additionalDirectories = []; } + + // Normalize the directory path and remove trailing slash + tspLocation.directory = normalizeDirectory(tspLocation.directory); + tspLocation.additionalDirectories = tspLocation.additionalDirectories.map(normalizeDirectory); + return tspLocation; } throw new Error("Could not find tsp-location.yaml"); @@ -59,3 +64,8 @@ export async function getEmitterFromRepoConfig(emitterPath: string): Promise