@@ -6,6 +6,7 @@ import * as _ from 'lodash';
66import * as mkdirp from 'mkdirp' ;
77import * as rimraf from 'rimraf' ;
88import * as childProcess from 'child_process' ;
9+ import * as targz from 'tar.gz' ;
910
1011const isWindows = / ^ w i n / . test ( process . platform ) ;
1112const textFileExtensions = [ '.gitignore' , 'template_gitignore' , '.config' , '.cs' , '.cshtml' , '.csproj' , 'Dockerfile' , '.html' , '.js' , '.json' , '.jsx' , '.md' , '.nuspec' , '.ts' , '.tsx' , '.xproj' ] ;
@@ -81,8 +82,7 @@ function copyRecursive(sourceRoot: string, destRoot: string, matchGlob: string)
8182 } ) ;
8283}
8384
84- function buildYeomanNpmPackage ( ) {
85- const outputRoot = './dist/generator-aspnetcore-spa' ;
85+ function buildYeomanNpmPackage ( outputRoot : string ) {
8686 const outputTemplatesRoot = path . join ( outputRoot , 'app/templates' ) ;
8787 rimraf . sync ( outputTemplatesRoot ) ;
8888
@@ -190,7 +190,19 @@ function runScripts(rootDir: string, scripts: string[]) {
190190 console . log ( `[Prepublish] Done` )
191191}
192192
193- rimraf . sync ( './dist' ) ;
193+ const distDir = './dist' ;
194+ const artifactsDir = path . join ( distDir , 'artifacts' ) ;
195+ const yeomanOutputRoot = path . join ( distDir , 'generator-aspnetcore-spa' ) ;
196+
197+ rimraf . sync ( distDir ) ;
198+ mkdirp . sync ( artifactsDir ) ;
194199runAllPrepublishScripts ( ) ;
195- buildYeomanNpmPackage ( ) ;
200+ buildYeomanNpmPackage ( yeomanOutputRoot ) ;
196201buildDotNetNewNuGetPackage ( ) ;
202+
203+ // Finally, create a .tar.gz file containing the built generator-aspnetcore-spa.
204+ // The CI system can treat this as the final built artifact.
205+ // Note that the targz APIs only come in async flavor.
206+ targz ( ) . compress ( yeomanOutputRoot , path . join ( artifactsDir , 'generator-aspnetcore-spa.tar.gz' ) , err => {
207+ if ( err ) { throw err ; }
208+ } ) ;
0 commit comments