Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
baronfel opened this issue Sep 28, 2023 · 1 comment
Labels
need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases

Comments

@baronfel
Copy link
Member

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 <appName> -- [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:

{
{
  "$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

@baronfel baronfel added the need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases label Sep 28, 2023
@baronfel
Copy link
Member Author

This capability (not necessarily the implementation) is requested by @danroth27 and the JS Project System team. It's hard to migrate/integrate a certain class of VS template to .NET SDK Templates without features like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases
Projects
None yet
Development

No branches or pull requests

1 participant