Skip to content

Commit e057cb3

Browse files
Remove Yeoman from the template build process
1 parent eea2066 commit e057cb3

File tree

4 files changed

+5
-43
lines changed

4 files changed

+5
-43
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
To generator the Yeoman generator, execute:
1+
To generator the package generator, execute:
22

33
npm run build
44

5-
Output will appear in the `generator-aspnetcore-spa` directory.
5+
Output will appear in the `dist/artifacts` directory.

templates/package-builder/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "generator-aspnetcore-spa-generator",
33
"version": "1.0.0",
4-
"description": "Creates the Yeoman generator and 'dotnet new' package for ASP.NET Core SPA templates",
4+
"description": "Creates the 'dotnet new' package for ASP.NET Core SPA templates",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"build": "tsc && node ./tmp/build/build.js"
8+
"build": "tsc && node ./tmp/build.js"
99
},
1010
"author": "Microsoft",
1111
"license": "Apache-2.0",
@@ -28,7 +28,6 @@
2828
"@types/node": "^6.0.45",
2929
"@types/node-uuid": "0.0.28",
3030
"@types/rimraf": "0.0.28",
31-
"@types/yeoman-generator": "0.0.30",
3231
"typescript": "^2.0.0"
3332
}
3433
}

templates/package-builder/src/build/build.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import * as targz from 'tar.gz';
1010

1111
const isWindows = /^win/.test(process.platform);
1212
const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', '.csproj', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx'];
13-
const yeomanGeneratorSource = './src/yeoman';
1413
const webToolsVSPackageGuid = '{0CD94836-1526-4E85-87D3-FB5274C5AFC9}';
1514

1615
const dotNetPackages = {
@@ -100,31 +99,6 @@ function getBuildNumber(): string {
10099
return Math.floor((new Date().valueOf() - new Date(2017, 0, 1).valueOf()) / (60*1000)) + '-local';
101100
}
102101

103-
function buildYeomanNpmPackage(outputRoot: string) {
104-
const outputTemplatesRoot = path.join(outputRoot, 'app/templates');
105-
rimraf.sync(outputTemplatesRoot);
106-
107-
// Copy template files
108-
const filenameReplacements = [
109-
{ from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' }
110-
];
111-
const contentReplacements = [
112-
// Currently, there are none
113-
];
114-
_.forEach(templates, (templateConfig, templateName) => {
115-
const outputDir = path.join(outputTemplatesRoot, templateName);
116-
writeTemplate(templateConfig.dir, outputDir, contentReplacements, filenameReplacements);
117-
});
118-
119-
// Also copy the generator files (that's the compiled .js files, plus all other non-.ts files)
120-
const tempRoot = './tmp';
121-
copyRecursive(path.join(tempRoot, 'yeoman'), outputRoot, '**/*.js');
122-
copyRecursive(yeomanGeneratorSource, outputRoot, '**/!(*.ts)');
123-
124-
// Clean up
125-
rimraf.sync(tempRoot);
126-
}
127-
128102
function buildDotNetNewNuGetPackages(outputDir: string) {
129103
const dotNetPackageIds = _.values(dotNetPackages);
130104
dotNetPackageIds.forEach(packageId => {
@@ -275,12 +249,10 @@ function buildDotNetNewNuGetPackage(packageId: string) {
275249
});
276250

277251
// Create the .nuspec file
278-
const yeomanPackageVersion = JSON.parse(fs.readFileSync(path.join(yeomanGeneratorSource, 'package.json'), 'utf8')).version;
279252
const nuspecContentTemplate = fs.readFileSync(`./src/dotnetnew/${ packageId }.nuspec`);
280253
writeFileEnsuringDirExists(outputRoot,
281254
`${ packageId }.nuspec`,
282255
applyContentReplacements(nuspecContentTemplate, [
283-
{ from: /\{yeomanversion\}/g, to: yeomanPackageVersion },
284256
{ from: /\{buildnumber\}/g, to: getBuildNumber() },
285257
])
286258
);
@@ -313,16 +285,7 @@ function runPrepublishScripts(rootDir: string, scripts: string[]) {
313285

314286
const distDir = './dist';
315287
const artifactsDir = path.join(distDir, 'artifacts');
316-
const yeomanOutputRoot = path.join(distDir, 'generator-aspnetcore-spa');
317288

318289
rimraf.sync(distDir);
319290
mkdirp.sync(artifactsDir);
320-
buildYeomanNpmPackage(yeomanOutputRoot);
321291
buildDotNetNewNuGetPackages(artifactsDir);
322-
323-
// Finally, create a .tar.gz file containing the built generator-aspnetcore-spa.
324-
// The CI system can treat this as the final built artifact.
325-
// Note that the targz APIs only come in async flavor.
326-
targz().compress(yeomanOutputRoot, path.join(artifactsDir, 'generator-aspnetcore-spa.tar.gz'), err => {
327-
if (err) { throw err; }
328-
});

templates/package-builder/src/dotnetnew/Microsoft.AspNetCore.SpaTemplates.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>Microsoft.AspNetCore.SpaTemplates</id>
5-
<version>{yeomanversion}</version>
5+
<version>1.0.{buildnumber}</version>
66
<description>Single Page Application templates for ASP.NET Core</description>
77
<authors>Microsoft</authors>
88
<language>en-US</language>

0 commit comments

Comments
 (0)