From 6619edbe827081b1e569a0d57cb1be23a8c79336 Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Fri, 10 Oct 2025 13:54:38 -0700 Subject: [PATCH 1/3] Revise tsp-client usage instructions in README Updated usage instructions to use 'npm exec --prefix' for running tsp-client commands. The reason is `tsp-client` needs to resolve the input parameters based on the root folder of SDK repository. --- eng/common/tsp-client/README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eng/common/tsp-client/README.md b/eng/common/tsp-client/README.md index c0a6076a4b..eea57869f8 100644 --- a/eng/common/tsp-client/README.md +++ b/eng/common/tsp-client/README.md @@ -25,30 +25,31 @@ npm ci ## Usage -After installation, you can run tsp-client by navigating to the directory and using npm exec: +After installation, you can run tsp-client using `npm exec --prefix` from the root directory of your SDK repository. ```bash -cd eng/common/tsp-client +# Set the tsp-client directory path relative to your current working directory +_TspClientDir=eng/common/tsp-client # Get help -npm exec --no -- tsp-client --help +npm exec --prefix $(_TspClientDir) --no -- tsp-client --help # Check version -npm exec --no -- tsp-client version +npm exec --prefix $(_TspClientDir) --no -- tsp-client version # Generate client code -npm exec --no -- tsp-client generate --output-dir ./generated +npm exec --prefix $(_TspClientDir) --no -- tsp-client generate --output-dir ./generated # Initialize a new project -npm exec --no -- tsp-client init --tsp-config ./tspconfig.yaml +npm exec --prefix $(_TspClientDir) --no -- tsp-client init --tsp-config ./tspconfig.yaml ``` ## CI/CD Best Practices ```bash -cd eng/common/tsp-client -npm ci -npm exec --no -- tsp-client init --update-if-exists --tsp-config https://github.com/Azure/azure-rest-api-specs/blob/dee71463cbde1d416c47cf544e34f7966a94ddcb/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml +_TspClientDir=eng/common/tsp-client +npm ci --prefix $(_TspClientDir) +npm exec --prefix $(_TspClientDir) --no -- tsp-client init --update-if-exists --tsp-config https://github.com/Azure/azure-rest-api-specs/blob/dee71463cbde1d416c47cf544e34f7966a94ddcb/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml ``` ## Package Management From e78c678924e4c058f5a2110e1e9f349371a68c4f Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Fri, 10 Oct 2025 13:59:46 -0700 Subject: [PATCH 2/3] Update README.md to use brace expansion for variables --- eng/common/tsp-client/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/common/tsp-client/README.md b/eng/common/tsp-client/README.md index eea57869f8..3ae76ceb7e 100644 --- a/eng/common/tsp-client/README.md +++ b/eng/common/tsp-client/README.md @@ -32,24 +32,24 @@ After installation, you can run tsp-client using `npm exec --prefix` from the ro _TspClientDir=eng/common/tsp-client # Get help -npm exec --prefix $(_TspClientDir) --no -- tsp-client --help +npm exec --prefix ${_TspClientDir} --no -- tsp-client --help # Check version -npm exec --prefix $(_TspClientDir) --no -- tsp-client version +npm exec --prefix ${_TspClientDir} --no -- tsp-client version # Generate client code -npm exec --prefix $(_TspClientDir) --no -- tsp-client generate --output-dir ./generated +npm exec --prefix ${_TspClientDir} --no -- tsp-client generate --output-dir ./generated # Initialize a new project -npm exec --prefix $(_TspClientDir) --no -- tsp-client init --tsp-config ./tspconfig.yaml +npm exec --prefix ${_TspClientDir} --no -- tsp-client init --tsp-config ./tspconfig.yaml ``` ## CI/CD Best Practices ```bash _TspClientDir=eng/common/tsp-client -npm ci --prefix $(_TspClientDir) -npm exec --prefix $(_TspClientDir) --no -- tsp-client init --update-if-exists --tsp-config https://github.com/Azure/azure-rest-api-specs/blob/dee71463cbde1d416c47cf544e34f7966a94ddcb/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml +npm ci --prefix ${_TspClientDir} +npm exec --prefix ${_TspClientDir} --no -- tsp-client init --update-if-exists --tsp-config https://github.com/Azure/azure-rest-api-specs/blob/dee71463cbde1d416c47cf544e34f7966a94ddcb/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml ``` ## Package Management From 73733fef547ff7b08f840eee163f98274ec40826 Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Fri, 10 Oct 2025 14:55:20 -0700 Subject: [PATCH 3/3] Update README.md --- eng/common/tsp-client/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/common/tsp-client/README.md b/eng/common/tsp-client/README.md index 3ae76ceb7e..6f88d536c9 100644 --- a/eng/common/tsp-client/README.md +++ b/eng/common/tsp-client/README.md @@ -25,7 +25,8 @@ npm ci ## Usage -After installation, you can run tsp-client using `npm exec --prefix` from the root directory of your SDK repository. +After installation, you can run `tsp-client` using `npm exec --prefix {path_to_the_eng/common/tsp-client}`. +Note that you should *not* navigate into the `eng/common/tsp-client` folder, since several `tsp-client` commands require the current working directory to be the client library's root. ```bash # Set the tsp-client directory path relative to your current working directory