mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Remove Yeoman from the template build process
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
To generator the Yeoman generator, execute:
|
To generator the package generator, execute:
|
||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
Output will appear in the `generator-aspnetcore-spa` directory.
|
Output will appear in the `dist/artifacts` directory.
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "generator-aspnetcore-spa-generator",
|
"name": "generator-aspnetcore-spa-generator",
|
||||||
"version": "1.0.0",
|
"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",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "tsc && node ./tmp/build/build.js"
|
"build": "tsc && node ./tmp/build.js"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
"@types/node": "^6.0.45",
|
"@types/node": "^6.0.45",
|
||||||
"@types/node-uuid": "0.0.28",
|
"@types/node-uuid": "0.0.28",
|
||||||
"@types/rimraf": "0.0.28",
|
"@types/rimraf": "0.0.28",
|
||||||
"@types/yeoman-generator": "0.0.30",
|
|
||||||
"typescript": "^2.0.0"
|
"typescript": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ 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', '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 webToolsVSPackageGuid = '{0CD94836-1526-4E85-87D3-FB5274C5AFC9}';
|
||||||
|
|
||||||
const dotNetPackages = {
|
const dotNetPackages = {
|
||||||
@@ -100,31 +99,6 @@ function getBuildNumber(): string {
|
|||||||
return Math.floor((new Date().valueOf() - new Date(2017, 0, 1).valueOf()) / (60*1000)) + '-local';
|
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) {
|
function buildDotNetNewNuGetPackages(outputDir: string) {
|
||||||
const dotNetPackageIds = _.values(dotNetPackages);
|
const dotNetPackageIds = _.values(dotNetPackages);
|
||||||
dotNetPackageIds.forEach(packageId => {
|
dotNetPackageIds.forEach(packageId => {
|
||||||
@@ -275,12 +249,10 @@ function buildDotNetNewNuGetPackage(packageId: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create the .nuspec file
|
// 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`);
|
const nuspecContentTemplate = fs.readFileSync(`./src/dotnetnew/${ packageId }.nuspec`);
|
||||||
writeFileEnsuringDirExists(outputRoot,
|
writeFileEnsuringDirExists(outputRoot,
|
||||||
`${ packageId }.nuspec`,
|
`${ packageId }.nuspec`,
|
||||||
applyContentReplacements(nuspecContentTemplate, [
|
applyContentReplacements(nuspecContentTemplate, [
|
||||||
{ from: /\{yeomanversion\}/g, to: yeomanPackageVersion },
|
|
||||||
{ from: /\{buildnumber\}/g, to: getBuildNumber() },
|
{ from: /\{buildnumber\}/g, to: getBuildNumber() },
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
@@ -313,16 +285,7 @@ function runPrepublishScripts(rootDir: string, scripts: string[]) {
|
|||||||
|
|
||||||
const distDir = './dist';
|
const distDir = './dist';
|
||||||
const artifactsDir = path.join(distDir, 'artifacts');
|
const artifactsDir = path.join(distDir, 'artifacts');
|
||||||
const yeomanOutputRoot = path.join(distDir, 'generator-aspnetcore-spa');
|
|
||||||
|
|
||||||
rimraf.sync(distDir);
|
rimraf.sync(distDir);
|
||||||
mkdirp.sync(artifactsDir);
|
mkdirp.sync(artifactsDir);
|
||||||
buildYeomanNpmPackage(yeomanOutputRoot);
|
|
||||||
buildDotNetNewNuGetPackages(artifactsDir);
|
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; }
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Microsoft.AspNetCore.SpaTemplates</id>
|
<id>Microsoft.AspNetCore.SpaTemplates</id>
|
||||||
<version>{yeomanversion}</version>
|
<version>1.0.{buildnumber}</version>
|
||||||
<description>Single Page Application templates for ASP.NET Core</description>
|
<description>Single Page Application templates for ASP.NET Core</description>
|
||||||
<authors>Microsoft</authors>
|
<authors>Microsoft</authors>
|
||||||
<language>en-US</language>
|
<language>en-US</language>
|
||||||
|
|||||||
Reference in New Issue
Block a user