forked from microsoft/typespec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added emitter support to init template (microsoft#5415)
Init template now supports a list of emitters for user to choose from to be included in the project. Artifacts affected: - `package.json` Emitters with optional package version are added - `tspconfig.yaml` emitters with options are added to `emit` and `options` section. **Currently options do not support token replacement** - optional messages are display after scaffolding for any additional environment setup instructions Here is a sample template. We will evaluate whether to make it a built-in template: ```JSON { "azure-core": { "title": "REST API with client or server project", "description": "Create a project representing a generic REST API with options to include client or server project", "compilerVersion": "0.63.0", "libraries": ["@typespec/http", "@typespec/rest", "@typespec/openapi3"], "config": {}, "emitters": { "@typespec/openapi3": { "selected": true, "description": "Generate OpenAPI 3.0 or 3.1 specification", "options": { "emitter-output-dir": "{project-root}/openapi/" }, "version": "0.49.0" }, "@typespec/http-client-csharp": { "description": "Client: generate CSharp client", "options": { "emitter-output-dir": "{project-root}/client/csharp/generated" }, "message": "Please ensure dotnet SDK has been installed. Download from https://dotnet.microsoft.com/download" }, "@typespec/http-server-csharp": { "description": "Server: generate ASP.NET Core server", "options": { "emitter-output-dir": "{project-root}/servers/aspnet/generated" }, "message": "Please ensure dotnet SDK has been installed. Download from https://dotnet.microsoft.com/download" } } } } ``` --------- Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
- Loading branch information
1 parent
8214ed6
commit 70f8ea5
Showing
6 changed files
with
125 additions
and
7 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.chronus/changes/azhang_InitTemplateWithEmitterSupport-2024-11-19-14-44-8.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: internal | ||
packages: | ||
- typespec-vscode | ||
--- | ||
|
||
Updated the init project template to include the new emitter definition |
7 changes: 7 additions & 0 deletions
7
.chronus/changes/azhang_InitTemplateWithEmitterSupport-2024-11-19-9-37-2.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
changeKind: feature | ||
packages: | ||
- "@typespec/compiler" | ||
--- | ||
|
||
Added support for emitter selections for init template. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters