Co-authored-by: Catalina Peralta <caperal@microsoft.com>
This commit is contained in:
catalinaperalta 2024-03-19 16:06:06 -07:00 коммит произвёл GitHub
Родитель c7004b835a
Коммит aeca529dee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -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: `<root of repo>/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#: `<repo>/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: `<root of repo>/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.