Further update dotnet new template builder to produce correct template.son contents

This commit is contained in:
SteveSandersonMS
2017-02-13 14:05:36 +00:00
parent fadc5d7b98
commit 70ad900f59
2 changed files with 12 additions and 17 deletions

View File

@@ -128,16 +128,10 @@ function buildDotNetNewNuGetPackage() {
const sourceProjectName = 'WebApplicationBasic'; const sourceProjectName = 'WebApplicationBasic';
const projectGuid = '00000000-0000-0000-0000-000000000000'; const projectGuid = '00000000-0000-0000-0000-000000000000';
const filenameReplacements = [ const filenameReplacements = [
// TODO: For dotnetnew templates, switch to csproj. No need for SDK choice as it can be Preview3+ only. { from: /.*\.csproj$/, to: `${sourceProjectName}.csproj` },
{ from: /.*\.xproj$/, to: `${sourceProjectName}.xproj` },
{ from: /\btemplate_gitignore$/, to: '.gitignore' } { from: /\btemplate_gitignore$/, to: '.gitignore' }
]; ];
const contentReplacements = [ const contentReplacements = [];
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: `<ProjectGuid>${projectGuid}</ProjectGuid>` },
{ from: /<RootNamespace>.*?<\/RootNamespace>/g, to: `<RootNamespace>${sourceProjectName}</RootNamespace>`},
{ from: /\s*<BaseIntermediateOutputPath.*?<\/BaseIntermediateOutputPath>/g, to: '' },
{ from: /\s*<OutputPath.*?<\/OutputPath>/g, to: '' },
];
_.forEach(templates, (templateConfig, templateName) => { _.forEach(templates, (templateConfig, templateName) => {
const templateOutputDir = path.join(outputRoot, 'Content', templateName); const templateOutputDir = path.join(outputRoot, 'Content', templateName);
writeTemplate(templateConfig.dir, templateOutputDir, contentReplacements, filenameReplacements, templateConfig.forceInclusion); writeTemplate(templateConfig.dir, templateOutputDir, contentReplacements, filenameReplacements, templateConfig.forceInclusion);
@@ -148,14 +142,15 @@ function buildDotNetNewNuGetPackage() {
fs.writeFileSync(path.join(templateConfigDir, 'template.json'), JSON.stringify({ fs.writeFileSync(path.join(templateConfigDir, 'template.json'), JSON.stringify({
author: 'Microsoft', author: 'Microsoft',
classifications: [ 'Standard>>Quick Starts' ], classifications: ["Web", "MVC", "SPA"],
name: `ASP.NET Core SPA with ${templateConfig.displayName}`, name: `MVC ASP.NET Core with ${templateConfig.displayName}`,
groupIdentity: `Microsoft.AspNetCore.Spa.${templateConfig.dotNetNewId}`, groupIdentity: `Microsoft.AspNetCore.SpaTemplates.${templateConfig.dotNetNewId}`,
identity: `Microsoft.AspNetCore.Spa.${templateConfig.dotNetNewId}`, identity: `Microsoft.AspNetCore.SpaTemplates.${templateConfig.dotNetNewId}.CSharp`,
shortName: `aspnetcorespa-${templateConfig.dotNetNewId.toLowerCase()}`, shortName: `${templateConfig.dotNetNewId.toLowerCase()}`,
tags: { language: 'C#' }, tags: { language: 'C#', type: 'project' },
guids: [ projectGuid ], sourceName: sourceProjectName,
sourceName: sourceProjectName preferNameDirectory: true,
symbols: {}
}, null, 2)); }, null, 2));
fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({ fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>Microsoft.AspNetCore.Spa.Templates</id> <id>Microsoft.AspNetCore.SpaTemplates</id>
<version>{version}</version> <version>{version}</version>
<description>Single Page Application templates for ASP.NET Core</description> <description>Single Page Application templates for ASP.NET Core</description>
<authors>Microsoft</authors> <authors>Microsoft</authors>