Remove the Yeoman-specific gitignore workaround

This commit is contained in:
Steve Sanderson
2017-08-23 15:04:04 -07:00
parent 0291686b20
commit 8d6119f31d
7 changed files with 3 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ import * as childProcess from 'child_process';
import * as targz from 'tar.gz'; import * as targz from 'tar.gz';
const isWindows = /^win/.test(process.platform); const isWindows = /^win/.test(process.platform);
const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', '.csproj', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx']; const textFileExtensions = ['.gitignore', '.config', '.cs', '.cshtml', '.csproj', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx'];
const dotNetPackages = [ const dotNetPackages = [
'Microsoft.DotNet.Web.Spa.ProjectTemplates', 'Microsoft.DotNet.Web.Spa.ProjectTemplates',
@@ -28,10 +28,7 @@ function writeFileEnsuringDirExists(root: string, filename: string, contents: st
} }
function listFilesExcludingGitignored(root: string): string[] { function listFilesExcludingGitignored(root: string): string[] {
// Note that the gitignore files, prior to be written by the generator, are called 'template_gitignore' let gitIgnorePath = path.join(root, '.gitignore');
// instead of '.gitignore'. This is a workaround for Yeoman doing strange stuff with .gitignore files
// (it renames them to .npmignore, which is not helpful).
let gitIgnorePath = path.join(root, 'template_gitignore');
let gitignoreEvaluator = fs.existsSync(gitIgnorePath) let gitignoreEvaluator = fs.existsSync(gitIgnorePath)
? gitignore.compile(fs.readFileSync(gitIgnorePath, 'utf8')) ? gitignore.compile(fs.readFileSync(gitIgnorePath, 'utf8'))
: { accepts: () => true }; : { accepts: () => true };
@@ -99,8 +96,7 @@ function buildDotNetNewNuGetPackage(packageId: string) {
const sourceProjectName = 'WebApplicationBasic'; const sourceProjectName = 'WebApplicationBasic';
const projectGuid = '00000000-0000-0000-0000-000000000000'; const projectGuid = '00000000-0000-0000-0000-000000000000';
const filenameReplacements = [ const filenameReplacements = [
{ from: /.*\.csproj$/, to: `${sourceProjectName}.csproj` }, { from: /.*\.csproj$/, to: `${sourceProjectName}.csproj` }
{ from: /\btemplate_gitignore$/, to: '.gitignore' }
]; ];
const contentReplacements = []; const contentReplacements = [];