diff --git a/appveyor.yml b/appveyor.yml
index 00f7bb6..3813cea 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -18,7 +18,7 @@ build_script:
- npm run build
- ps: Pop-Location
artifacts:
- - path: templates\package-builder\dist\artifacts\*.nupkg
+ - path: templates\package-builder\artifacts\*.nupkg
name: Microsoft.AspNetCore.SpaTemplates
type: NuGetPackage
# - ps: .\build.ps1
diff --git a/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec b/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec
index 5d2159c..1d2178f 100644
--- a/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec
+++ b/templates/Microsoft.AspNetCore.SpaTemplates/Microsoft.AspNetCore.SpaTemplates.nuspec
@@ -14,4 +14,10 @@
+
+
+
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 604ed87..71ecb54 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
@@ -14,4 +14,10 @@
+
+
+
diff --git a/templates/package-builder/.gitignore b/templates/package-builder/.gitignore
index f0cef27..cbdf9d5 100644
--- a/templates/package-builder/.gitignore
+++ b/templates/package-builder/.gitignore
@@ -1,3 +1,4 @@
/node_modules/
/built/
-/dist/
+/artifacts/
+/tmp/
diff --git a/templates/package-builder/src/build/build.ts b/templates/package-builder/src/build/build.ts
index 4e88446..8b83447 100644
--- a/templates/package-builder/src/build/build.ts
+++ b/templates/package-builder/src/build/build.ts
@@ -15,28 +15,6 @@ const dotNetPackages = [
'Microsoft.AspNetCore.SpaTemplates'
];
-function writeFileEnsuringDirExists(root: string, filename: string, contents: string | Buffer) {
- let fullPath = path.join(root, filename);
- mkdirp.sync(path.dirname(fullPath));
- fs.writeFileSync(fullPath, contents);
-}
-
-function listFilesExcludingGitignored(root: string): string[] {
- let gitIgnorePath = path.join(root, '.gitignore');
- let gitignoreEvaluator = fs.existsSync(gitIgnorePath)
- ? gitignore.compile(fs.readFileSync(gitIgnorePath, 'utf8'))
- : { accepts: () => true };
- return glob.sync('**/*', { cwd: root, dot: true, nodir: true })
- .filter(fn => gitignoreEvaluator.accepts(fn));
-}
-
-function writeTemplate(sourceRoot: string, destRoot: string) {
- listFilesExcludingGitignored(sourceRoot).forEach(fn => {
- let 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;
@@ -52,35 +30,17 @@ function buildDotNetNewNuGetPackages(outputDir: string) {
const dotNetNewNupkgPath = buildDotNetNewNuGetPackage(packageId);
// Move the .nupkg file to the output dir
+ mkdirp.sync(outputDir);
fs.renameSync(dotNetNewNupkgPath, path.join(outputDir, path.basename(dotNetNewNupkgPath)));
});
}
function buildDotNetNewNuGetPackage(packageId: string) {
- const outputRoot = './dist/dotnetnew';
- rimraf.sync(outputRoot);
-
- // Copy template files
- const packageSourceRootDir = path.join('../', packageId);
- const templatesInPackage = fs.readdirSync(path.join(packageSourceRootDir, 'Content'));
-
- _.forEach(templatesInPackage, templateName => {
- const templateSourceDir = path.join(packageSourceRootDir, 'Content', templateName);
- const templateOutputDir = path.join(outputRoot, 'Content', templateName);
- writeTemplate(templateSourceDir, templateOutputDir);
- });
-
- // Create the .nuspec file
- const nuspecFilename = `${ packageId }.nuspec`;
- const nuspecContentTemplate = fs.readFileSync(path.join(packageSourceRootDir, nuspecFilename));
- writeFileEnsuringDirExists(outputRoot,
- nuspecFilename,
- nuspecContentTemplate
- );
-
// Invoke NuGet to create the final package
+ const packageSourceRootDir = path.join('../', packageId);
+ const nuspecFilename = `${ packageId }.nuspec`;
const nugetExe = path.join(process.cwd(), './bin/NuGet.exe');
- const nugetStartInfo = { cwd: outputRoot, stdio: 'inherit' };
+ const nugetStartInfo = { cwd: packageSourceRootDir, stdio: 'inherit' };
const packageVersion = `1.0.${ getBuildNumber() }`;
const nugetArgs = ['pack', nuspecFilename, '-Version', packageVersion];
if (isWindows) {
@@ -92,15 +52,7 @@ function buildDotNetNewNuGetPackage(packageId: string) {
childProcess.spawnSync('mono', nugetArgs, nugetStartInfo);
}
- // Clean up
- rimraf.sync('./tmp');
-
- return glob.sync(path.join(outputRoot, './*.nupkg'))[0];
+ return glob.sync(path.join(packageSourceRootDir, './*.nupkg'))[0];
}
-const distDir = './dist';
-const artifactsDir = path.join(distDir, 'artifacts');
-
-rimraf.sync(distDir);
-mkdirp.sync(artifactsDir);
-buildDotNetNewNuGetPackages(artifactsDir);
+buildDotNetNewNuGetPackages('./artifacts');