From 2a032944f23c21638b1bc7d8e4452d2b744c4531 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Tue, 10 Dec 2024 17:52:39 +0000 Subject: [PATCH] [@typespec/spector] Update start server scenario paths (#5309) With my earlier PRs, I have already moved all the `scenarioPath` parameters to `scenarioPaths` parameter i.e. made that parameter from a single value to an array of values. But, this start script was missed earlier. But, the Go SDK generator uses this script and need this to be updated. This PR acoomplishes that. Please review and approve this PR. Thanks --- ...rtServerScenarioPaths-2024-11-9-11-3-38.md | 7 ++++ ...tServerScenarioPaths-2024-11-9-17-21-55.md | 7 ++++ packages/spec-coverage-sdk/CHANGELOG.md | 4 +++ packages/spec-coverage-sdk/package.json | 2 +- packages/spec-coverage-sdk/src/types.ts | 1 + packages/spec-dashboard/src/apis.ts | 36 ++++++++++--------- packages/spector/CHANGELOG.md | 4 +++ packages/spector/package.json | 2 +- packages/spector/src/actions/serve.ts | 6 ++-- packages/spector/src/cli/cli.ts | 9 ++--- packages/spector/src/coverage/common.ts | 1 + 11 files changed, 54 insertions(+), 25 deletions(-) create mode 100644 .chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-11-3-38.md create mode 100644 .chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-17-21-55.md diff --git a/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-11-3-38.md b/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-11-3-38.md new file mode 100644 index 0000000000..b12a7add0d --- /dev/null +++ b/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-11-3-38.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/spector" +--- + +Update `server start` script parameter - `scenarioPath` to `scenarioPaths`. \ No newline at end of file diff --git a/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-17-21-55.md b/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-17-21-55.md new file mode 100644 index 0000000000..7afadab420 --- /dev/null +++ b/.chronus/changes/UpdateStartServerScenarioPaths-2024-11-9-17-21-55.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/spec-coverage-sdk" +--- + +Added packageName property to metadata \ No newline at end of file diff --git a/packages/spec-coverage-sdk/CHANGELOG.md b/packages/spec-coverage-sdk/CHANGELOG.md index a4aa9dfce2..9cded5a7fd 100644 --- a/packages/spec-coverage-sdk/CHANGELOG.md +++ b/packages/spec-coverage-sdk/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log - @typespec/spec-coverage-sdk +## 0.1.0-alpha.2 + +- Added `packageName` to `scenariosMetadata`. + ## 0.1.0-alpha.1 No changes, version bump only. diff --git a/packages/spec-coverage-sdk/package.json b/packages/spec-coverage-sdk/package.json index 286eb09abb..759a183d2e 100644 --- a/packages/spec-coverage-sdk/package.json +++ b/packages/spec-coverage-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/spec-coverage-sdk", - "version": "0.1.0-alpha.1", + "version": "0.1.0-alpha.2", "description": "Spec utility to manage the reported coverage", "main": "dist/index.js", "type": "module", diff --git a/packages/spec-coverage-sdk/src/types.ts b/packages/spec-coverage-sdk/src/types.ts index 8347560e60..db80653900 100644 --- a/packages/spec-coverage-sdk/src/types.ts +++ b/packages/spec-coverage-sdk/src/types.ts @@ -58,6 +58,7 @@ export interface ResolvedCoverageReport extends CoverageReport { export interface ScenariosMetadata { version: string; commit: string; + packageName: string; } export interface GeneratorMetadata { diff --git a/packages/spec-dashboard/src/apis.ts b/packages/spec-dashboard/src/apis.ts index b731ff9ada..82ea1166ad 100644 --- a/packages/spec-dashboard/src/apis.ts +++ b/packages/spec-dashboard/src/apis.ts @@ -7,27 +7,31 @@ import { const storageAccountName = "typespec"; export type GeneratorNames = - | "python" - | "typescript/rlc" - | "typescript/modular" - | "csharp" + | "@typespec/http-client-python" + | "@azure-tools/typespec-python" + | "@azure-tools/typespec-go" + | "@azure-tools/typespec-csharp" | "@typespec/http-client-csharp" - | "java" - | "go" - | "cpp" - | "rust" + | "@azure-tools/typespec-ts-rlc" + | "@azure-tools/typespec-ts-modular" + | "@azure-tools/typespec-java" + | "@typespec/http-client-java" + | "@azure-tools/typespec-cpp" + | "@azure-tools/typespec-rust" | "test"; const query = new URLSearchParams(window.location.search); const generatorNames: GeneratorNames[] = [ - "python", - "typescript/rlc", - "typescript/modular", - "csharp", + "@typespec/http-client-python", + "@azure-tools/typespec-python", + "@azure-tools/typespec-go", + "@azure-tools/typespec-csharp", "@typespec/http-client-csharp", - "java", - "go", - "cpp", - "rust", + "@azure-tools/typespec-ts-rlc", + "@azure-tools/typespec-ts-modular", + "@azure-tools/typespec-java", + "@typespec/http-client-java", + "@azure-tools/typespec-cpp", + "@azure-tools/typespec-rust", ...(query.has("showtest") ? (["test"] as const) : []), ]; diff --git a/packages/spector/CHANGELOG.md b/packages/spector/CHANGELOG.md index 9c289f07cf..c3376411c5 100644 --- a/packages/spector/CHANGELOG.md +++ b/packages/spector/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log - @typespec/spector +## 0.1.0-alpha.4 + +- Update `server start` script parameter - `scenarioPath` to `scenarioPaths`. + ## 0.1.0-alpha.3 No changes, version bump only. diff --git a/packages/spector/package.json b/packages/spector/package.json index 7b25e966de..29099c4231 100644 --- a/packages/spector/package.json +++ b/packages/spector/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/spector", - "version": "0.1.0-alpha.3", + "version": "0.1.0-alpha.4", "description": "Typespec Core Tool to validate, run mock api, collect coverage.", "exports": { ".": { diff --git a/packages/spector/src/actions/serve.ts b/packages/spector/src/actions/serve.ts index 4655f218b8..ef03d7c481 100644 --- a/packages/spector/src/actions/serve.ts +++ b/packages/spector/src/actions/serve.ts @@ -39,14 +39,14 @@ export async function startInBackground(config: ServeConfig) { const [nodeExe, entrypoint] = process.argv; logger.info(`Starting server in background at port ${config.port}`); const scenariosPath = Array.isArray(config.scenariosPath) - ? config.scenariosPath.join(" ") - : config.scenariosPath; + ? config.scenariosPath + : [config.scenariosPath]; const cp = spawn( nodeExe, [ entrypoint, "serve", - scenariosPath, + ...scenariosPath, "--port", config.port.toString(), "--coverageFile", diff --git a/packages/spector/src/cli/cli.ts b/packages/spector/src/cli/cli.ts index 65be2b6f1a..4df5ba4419 100644 --- a/packages/spector/src/cli/cli.ts +++ b/packages/spector/src/cli/cli.ts @@ -92,13 +92,14 @@ async function main() { .command("server", "Server management", (cmd) => { cmd .command( - "start ", + "start ", "Start the server in the background.", (cmd) => { return cmd - .positional("scenariosPath", { - description: "Path to the scenarios and mock apis", + .positional("scenariosPaths", { + description: "Path(s) to the scenarios and mock apis", type: "string", + array: true, demandOption: true, }) .option("port", { @@ -115,7 +116,7 @@ async function main() { }, async (args) => startInBackground({ - scenariosPath: resolve(process.cwd(), args.scenariosPath), + scenariosPath: args.scenariosPaths, port: args.port, coverageFile: args.coverageFile, }), diff --git a/packages/spector/src/coverage/common.ts b/packages/spector/src/coverage/common.ts index fff4d080c9..a9d1ff8f93 100644 --- a/packages/spector/src/coverage/common.ts +++ b/packages/spector/src/coverage/common.ts @@ -6,5 +6,6 @@ export async function getScenarioMetadata(scenariosPath: string): Promise