From aeca529deed61e9f8859a6b8a94e3abf3160c46f Mon Sep 17 00:00:00 2001 From: catalinaperalta Date: Tue, 19 Mar 2024 16:06:06 -0700 Subject: [PATCH] update readme (#7746) Co-authored-by: Catalina Peralta --- tools/tsp-client/README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/tsp-client/README.md b/tools/tsp-client/README.md index 25522bb09..5154f1c73 100644 --- a/tools/tsp-client/README.md +++ b/tools/tsp-client/README.md @@ -25,9 +25,11 @@ use it to look for relevant configuration files. To specify a different output d the `-o` or `--output-dir` option. ### init -Initialize the SDK project folder from a tspconfig.yaml. When using this command pass in a path to a local or remote tspconfig.yaml, using the `-c` or `--tsp-config` flag. +Initialize the client library directory using a tspconfig.yaml. When running this command pass in a path to a local or remote tspconfig.yaml with the `-c` or `--tsp-config` flag. -The command generates the appropriate SDK folder in the repository, creates a [tsp-location.yaml](#tsp-locationyaml) file to control generation, and performs an initial generation of the client library. If you want to skip client library generation, then pass the `--skip-sync-and-generate` flag. +The `init` command generates a directory structure following the standard pattern used across Azure SDK language repositories, creates a [tsp-location.yaml](#tsp-locationyaml) file to control generation, and performs an initial generation of the client library. If you want to skip client library generation, then pass the `--skip-sync-and-generate` flag. + +> IMPORTANT: This command should be run from the root of the repository. ### update Sync and generate client libraries from a TypeSpec project. The `update` command will look for a [tsp-location.yaml](#tsp-locationyaml) file in your current directory to sync a TypeSpec project and generate a client library. @@ -121,14 +123,12 @@ TempTypeSpecFiles/ ## Per repository set up -Each repository that intends to support `tsp-client` for generating and updating client libraries will need the following configuration files: +Each repository that intends to support `tsp-client` for generating and updating client libraries will need to set up an `emitter-package.json` file under the `eng/` directory at the root of the repository. Client libraries generated with this tool will be outputted based on the information in the tspconfig.yaml file of the TypeSpec specification. The service directory is specified through the `parameters.service-dir.default` parameter in the tspconfig.yaml, additionally the `package-dir` option for the specific emitter is appended to the end of the path. -### emitter-package-lock.json (Optional) +See the following example of a valid tspconfig.yaml file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml -`emitter-package-lock.json` will be used the same as a `package-lock.json`. The tool will run a clean npm installation before generating client libraries. This file allows consistent dependency trees and allows each repository to control their dependency installation. -The file should be checked into this location: `/eng/emitter-package-lock.json` +Using the tspconfig.yaml linked above, by default, the client libraries will be generated in the following directory for C#: `/sdk/contosowidgetmanager/Azure.Template.Contoso/`. -> NOTE: The tool will run `npm ci` to install dependencies, so ensure that the `emitter-package-lock.json` and `emitter-package.json` files both exist and are in sync with each other. ### emitter-package.json (Required) @@ -149,3 +149,10 @@ Example: > NOTE: tsp compile currently requires the "main" line to be there. > NOTE: This file replaces the package.json checked into the `azure-rest-api-spec` repository. + +### emitter-package-lock.json (Optional) + +`emitter-package-lock.json` will be used the same as a `package-lock.json`. The tool will run a clean npm installation before generating client libraries. This file allows consistent dependency trees and allows each repository to control their dependency installation. +The file should be checked into this location: `/eng/emitter-package-lock.json` + +> NOTE: The tool will run `npm ci` to install dependencies, so ensure that the `emitter-package-lock.json` and `emitter-package.json` files both exist and are in sync with each other.