Update dotnet new template builder to match tooling preview 4 file structure

This commit is contained in:
SteveSandersonMS
2017-02-13 13:12:44 +00:00
parent 85dcc66723
commit fadc5d7b98
2 changed files with 20 additions and 18 deletions

View File

@@ -139,12 +139,14 @@ function buildDotNetNewNuGetPackage() {
{ from: /\s*<OutputPath.*?<\/OutputPath>/g, to: '' }, { from: /\s*<OutputPath.*?<\/OutputPath>/g, to: '' },
]; ];
_.forEach(templates, (templateConfig, templateName) => { _.forEach(templates, (templateConfig, templateName) => {
const templateOutputDir = path.join(outputRoot, 'templates', templateName); const templateOutputDir = path.join(outputRoot, 'Content', templateName);
const templateOutputProjectDir = path.join(templateOutputDir, sourceProjectName); writeTemplate(templateConfig.dir, templateOutputDir, contentReplacements, filenameReplacements, templateConfig.forceInclusion);
writeTemplate(templateConfig.dir, templateOutputProjectDir, contentReplacements, filenameReplacements, templateConfig.forceInclusion);
// Add a .netnew.json file // Add the .template.config dir and its contents
fs.writeFileSync(path.join(templateOutputDir, '.netnew.json'), JSON.stringify({ const templateConfigDir = path.join(templateOutputDir, '.template.config');
mkdirp.sync(templateConfigDir);
fs.writeFileSync(path.join(templateConfigDir, 'template.json'), JSON.stringify({
author: 'Microsoft', author: 'Microsoft',
classifications: [ 'Standard>>Quick Starts' ], classifications: [ 'Standard>>Quick Starts' ],
name: `ASP.NET Core SPA with ${templateConfig.displayName}`, name: `ASP.NET Core SPA with ${templateConfig.displayName}`,
@@ -155,6 +157,10 @@ function buildDotNetNewNuGetPackage() {
guids: [ projectGuid ], guids: [ projectGuid ],
sourceName: sourceProjectName sourceName: sourceProjectName
}, null, 2)); }, null, 2));
fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({
symbolInfo: {}
}, null, 2));
}); });
// Invoke NuGet to create the final package // Invoke NuGet to create the final package

View File

@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>Microsoft.AspNetCore.Spa.Templates</id> <id>Microsoft.AspNetCore.Spa.Templates</id>
<version>{version}</version> <version>{version}</version>
<title>Class Library and Console Application Templates for .NET Core</title> <description>Single Page Application templates for ASP.NET Core</description>
<authors>Microsoft</authors> <authors>Microsoft</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <language>en-US</language>
<description>My package description.</description> <projectUrl>https://github.com/aspnet/javascriptservices</projectUrl>
<dependencies> <licenseUrl>https://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</licenseUrl>
<group targetFramework=".NETCoreApp,Version=v1.0"> <packageTypes>
<dependency id="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" version="1.0.0" /> <packageType name="Template" />
</group> </packageTypes>
</dependencies>
</metadata> </metadata>
<files> </package>
<file src="templates/**" />
</files>
</package>