diff --git a/templates/package-builder/README.md b/templates/package-builder/README.md index 74d42ab..a4b9d47 100644 --- a/templates/package-builder/README.md +++ b/templates/package-builder/README.md @@ -1,5 +1,5 @@ -To generator the Yeoman generator, execute: +To generator the package generator, execute: npm run build -Output will appear in the `generator-aspnetcore-spa` directory. +Output will appear in the `dist/artifacts` directory. diff --git a/templates/package-builder/package.json b/templates/package-builder/package.json index 4b91c7a..d3b248c 100644 --- a/templates/package-builder/package.json +++ b/templates/package-builder/package.json @@ -1,11 +1,11 @@ { "name": "generator-aspnetcore-spa-generator", "version": "1.0.0", - "description": "Creates the Yeoman generator and 'dotnet new' package for ASP.NET Core SPA templates", + "description": "Creates the 'dotnet new' package for ASP.NET Core SPA templates", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "tsc && node ./tmp/build/build.js" + "build": "tsc && node ./tmp/build.js" }, "author": "Microsoft", "license": "Apache-2.0", @@ -28,7 +28,6 @@ "@types/node": "^6.0.45", "@types/node-uuid": "0.0.28", "@types/rimraf": "0.0.28", - "@types/yeoman-generator": "0.0.30", "typescript": "^2.0.0" } } diff --git a/templates/package-builder/src/build/build.ts b/templates/package-builder/src/build/build.ts index fab6d48..c0827de 100644 --- a/templates/package-builder/src/build/build.ts +++ b/templates/package-builder/src/build/build.ts @@ -10,7 +10,6 @@ import * as targz from 'tar.gz'; const isWindows = /^win/.test(process.platform); const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', '.csproj', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx']; -const yeomanGeneratorSource = './src/yeoman'; const webToolsVSPackageGuid = '{0CD94836-1526-4E85-87D3-FB5274C5AFC9}'; const dotNetPackages = { @@ -100,31 +99,6 @@ function getBuildNumber(): string { return Math.floor((new Date().valueOf() - new Date(2017, 0, 1).valueOf()) / (60*1000)) + '-local'; } -function buildYeomanNpmPackage(outputRoot: string) { - const outputTemplatesRoot = path.join(outputRoot, 'app/templates'); - rimraf.sync(outputTemplatesRoot); - - // Copy template files - const filenameReplacements = [ - { from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' } - ]; - const contentReplacements = [ - // Currently, there are none - ]; - _.forEach(templates, (templateConfig, templateName) => { - const outputDir = path.join(outputTemplatesRoot, templateName); - writeTemplate(templateConfig.dir, outputDir, contentReplacements, filenameReplacements); - }); - - // Also copy the generator files (that's the compiled .js files, plus all other non-.ts files) - const tempRoot = './tmp'; - copyRecursive(path.join(tempRoot, 'yeoman'), outputRoot, '**/*.js'); - copyRecursive(yeomanGeneratorSource, outputRoot, '**/!(*.ts)'); - - // Clean up - rimraf.sync(tempRoot); -} - function buildDotNetNewNuGetPackages(outputDir: string) { const dotNetPackageIds = _.values(dotNetPackages); dotNetPackageIds.forEach(packageId => { @@ -275,12 +249,10 @@ function buildDotNetNewNuGetPackage(packageId: string) { }); // Create the .nuspec file - const yeomanPackageVersion = JSON.parse(fs.readFileSync(path.join(yeomanGeneratorSource, 'package.json'), 'utf8')).version; const nuspecContentTemplate = fs.readFileSync(`./src/dotnetnew/${ packageId }.nuspec`); writeFileEnsuringDirExists(outputRoot, `${ packageId }.nuspec`, applyContentReplacements(nuspecContentTemplate, [ - { from: /\{yeomanversion\}/g, to: yeomanPackageVersion }, { from: /\{buildnumber\}/g, to: getBuildNumber() }, ]) ); @@ -313,16 +285,7 @@ function runPrepublishScripts(rootDir: string, scripts: string[]) { const distDir = './dist'; const artifactsDir = path.join(distDir, 'artifacts'); -const yeomanOutputRoot = path.join(distDir, 'generator-aspnetcore-spa'); rimraf.sync(distDir); mkdirp.sync(artifactsDir); -buildYeomanNpmPackage(yeomanOutputRoot); buildDotNetNewNuGetPackages(artifactsDir); - -// Finally, create a .tar.gz file containing the built generator-aspnetcore-spa. -// The CI system can treat this as the final built artifact. -// Note that the targz APIs only come in async flavor. -targz().compress(yeomanOutputRoot, path.join(artifactsDir, 'generator-aspnetcore-spa.tar.gz'), err => { - if (err) { throw err; } -}); diff --git a/templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec b/templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec index 615d8b0..e873687 100644 --- a/templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec +++ b/templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec @@ -2,7 +2,7 @@ Microsoft.AspNetCore.SpaTemplates - {yeomanversion} + 1.0.{buildnumber} Single Page Application templates for ASP.NET Core Microsoft en-US