generator-aspnetcore-spa support for selecting between project.json and .csproj

This commit is contained in:
SteveSandersonMS
2016-12-08 15:32:08 +00:00
parent 62b676174e
commit 2135d77189
4 changed files with 44 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ import * as rimraf from 'rimraf';
import * as childProcess from 'child_process';
const isWindows = /^win/.test(process.platform);
const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', 'Dockerfile', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx', '.xproj'];
const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', '.csproj', 'Dockerfile', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx', '.xproj'];
const yeomanGeneratorSource = './src/yeoman';
// For the Angular 2 template, we want to bundle prebuilt dist dev-mode files, because the VS template can't auto-run
@@ -88,14 +88,19 @@ function buildYeomanNpmPackage() {
// Copy template files
const filenameReplacements = [
{ from: /.*\.xproj$/, to: 'tokenreplace-namePascalCase.xproj' }
{ from: /.*\.xproj$/, to: 'tokenreplace-namePascalCase.xproj' },
{ from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' }
];
const contentReplacements = [
// .xproj items
{ from: /\bWebApplicationBasic\b/g, to: '<%= namePascalCase %>' },
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: '<ProjectGuid><%= projectGuid %></ProjectGuid>' },
{ from: /<RootNamespace>.*?<\/RootNamespace>/g, to: '<RootNamespace><%= namePascalCase %></RootNamespace>'},
{ from: /\s*<BaseIntermediateOutputPath.*?<\/BaseIntermediateOutputPath>/g, to: '' },
{ from: /\s*<OutputPath.*?<\/OutputPath>/g, to: '' },
// global.json items
{ from: /1\.0\.0-preview2-1-003177/, to: '<%= sdkVersion %>' }
];
_.forEach(templates, (templateConfig, templateName) => {
const outputDir = path.join(outputTemplatesRoot, templateName);
@@ -119,6 +124,7 @@ function buildDotNetNewNuGetPackage() {
const sourceProjectName = 'WebApplicationBasic';
const projectGuid = '00000000-0000-0000-0000-000000000000';
const filenameReplacements = [
// TODO: For dotnetnew templates, switch to csproj. No need for SDK choice as it can be Preview3+ only.
{ from: /.*\.xproj$/, to: `${sourceProjectName}.xproj` },
{ from: /\btemplate_gitignore$/, to: '.gitignore' }
];