dotnet / dotnet/templating

Make it easier to invoke templates from other ecosystems/tools as .NET templates

Open
#7,096 1 comment 0 reactions 0 assignees View on GitHub
need-pm-discussion triage:transfer-to-sdk
Dominant language
No language data
Stars
1.7k
Forks
399
Avg merge
3d 5h
Merged PRs (30d)
39

Description

### Is your feature request related to a problem? Please describe.

The JS Project System templates for Visual Studio have lightweight VS template wrappers that guide the invocation of various `npm init` templates. For example `npm init vue@latest -- [various flags]`.

It would be great if there was a way to 'delegate' the template invocation to another binary in this way. Ideally a template could be very lightweight and consist of a number of options/flags that the dotnet CLI could surface and transform, then pass to the command/tool that is going to be invoked. The actual generation would be delegated to the 'base command', and the template engine itself might not be invoked at all for content processing.

### Describe the solution you'd like.

I'd like a way to define a `template.json` that might do something like:

```json
{
{
"$schema": "http://json.schemastore.org/template",
"author": "Microsoft",
"classifications": [
"Vue",
"Javascript"
],
"name": "Vue application",
"description": "A project for creating a Vue JS application",
"shortName": "vue",
"tags": {
"language": "JS",
"type": "project"
},
"symbols": {
"UseTypescript": {
"type": "parameter",
"description": "Default to using Typescript instead of Javascript",
"defaultValue": "true",
"displayName": "Use TypeScript"
}
}
"baseCommand": "npm",
"arguments": [
"init",
"--yes",
"vue@latest",
{ "symbol": "name" },
"--",
"--eslint",
{
"condition": "UseTypeScript",
"value": "--typescript"
}
]
}
```

The idea being that we could define symbols and condition the include/exclude of arguments to the base command based on those symbols.

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.