diff --git a/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec b/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec index e873687..5d2159c 100644 --- a/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec +++ b/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec @@ -2,7 +2,7 @@ Microsoft.AspNetCore.SpaTemplates - 1.0.{buildnumber} + 0.0.0 Single Page Application templates for ASP.NET Core Microsoft en-US diff --git a/templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.nuspec b/templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.nuspec index 05690b8..604ed87 100644 --- a/templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.nuspec +++ b/templates/Microsoft.DotNet.Web.Spa.ProjectTemplates/Microsoft.DotNet.Web.Spa.ProjectTemplates.nuspec @@ -2,7 +2,7 @@ Microsoft.DotNet.Web.Spa.ProjectTemplates - 1.0.{buildnumber} + 0.0.0 Single Page Application templates for ASP.NET Core Microsoft en-US diff --git a/templates/package-builder/src/build/build.ts b/templates/package-builder/src/build/build.ts index 05611e0..4e88446 100644 --- a/templates/package-builder/src/build/build.ts +++ b/templates/package-builder/src/build/build.ts @@ -30,15 +30,6 @@ function listFilesExcludingGitignored(root: string): string[] { .filter(fn => gitignoreEvaluator.accepts(fn)); } -function applyContentReplacements(sourceContent: Buffer, contentReplacements: { from: RegExp, to: string }[]) { - let sourceText = sourceContent.toString('utf8'); - contentReplacements.forEach(replacement => { - sourceText = sourceText.replace(replacement.from, replacement.to); - }); - - return new Buffer(sourceText, 'utf8'); -} - function writeTemplate(sourceRoot: string, destRoot: string) { listFilesExcludingGitignored(sourceRoot).forEach(fn => { let sourceContent = fs.readFileSync(path.join(sourceRoot, fn)); @@ -46,14 +37,6 @@ function writeTemplate(sourceRoot: string, destRoot: string) { }); } -function copyRecursive(sourceRoot: string, destRoot: string, matchGlob: string) { - glob.sync(matchGlob, { cwd: sourceRoot, dot: true, nodir: true }) - .forEach(fn => { - const sourceContent = fs.readFileSync(path.join(sourceRoot, fn)); - writeFileEnsuringDirExists(destRoot, fn, sourceContent); - }); -} - function getBuildNumber(): string { if (process.env.APPVEYOR_BUILD_NUMBER) { return process.env.APPVEYOR_BUILD_NUMBER; @@ -88,23 +71,25 @@ function buildDotNetNewNuGetPackage(packageId: string) { }); // Create the .nuspec file - const nuspecContentTemplate = fs.readFileSync(path.join(packageSourceRootDir, `${ packageId }.nuspec`)); + const nuspecFilename = `${ packageId }.nuspec`; + const nuspecContentTemplate = fs.readFileSync(path.join(packageSourceRootDir, nuspecFilename)); writeFileEnsuringDirExists(outputRoot, - `${ packageId }.nuspec`, - applyContentReplacements(nuspecContentTemplate, [ - { from: /\{buildnumber\}/g, to: getBuildNumber() }, - ]) + nuspecFilename, + nuspecContentTemplate ); // Invoke NuGet to create the final package const nugetExe = path.join(process.cwd(), './bin/NuGet.exe'); const nugetStartInfo = { cwd: outputRoot, stdio: 'inherit' }; + const packageVersion = `1.0.${ getBuildNumber() }`; + const nugetArgs = ['pack', nuspecFilename, '-Version', packageVersion]; if (isWindows) { // Invoke NuGet.exe directly - childProcess.spawnSync(nugetExe, ['pack'], nugetStartInfo); + childProcess.spawnSync(nugetExe, nugetArgs, nugetStartInfo); } else { // Invoke via Mono (relying on that being available) - childProcess.spawnSync('mono', [nugetExe, 'pack'], nugetStartInfo); + nugetArgs.unshift(nugetExe); + childProcess.spawnSync('mono', nugetArgs, nugetStartInfo); } // Clean up