1
- import * as glob from 'glob' ;
2
- import * as gitignore from 'gitignore-parser' ;
3
1
import * as fs from 'fs' ;
4
2
import * as path from 'path' ;
5
- import * as _ from 'lodash' ;
6
3
import * as mkdirp from 'mkdirp' ;
7
- import * as rimraf from 'rimraf' ;
8
4
import * as childProcess from 'child_process' ;
9
- import * as targz from 'tar.gz' ;
10
5
11
6
const isWindows = / ^ w i n / . test ( process . platform ) ;
12
-
13
- const dotNetPackages = [
7
+ const packageIds = [
14
8
'Microsoft.DotNet.Web.Spa.ProjectTemplates' ,
15
9
'Microsoft.AspNetCore.SpaTemplates'
16
10
] ;
11
+ const packageVersion = `1.0.${ getBuildNumber ( ) } ` ;
17
12
18
13
function getBuildNumber ( ) : string {
19
14
if ( process . env . APPVEYOR_BUILD_NUMBER ) {
@@ -24,25 +19,18 @@ function getBuildNumber(): string {
24
19
return Math . floor ( ( new Date ( ) . valueOf ( ) - new Date ( 2017 , 0 , 1 ) . valueOf ( ) ) / ( 60 * 1000 ) ) + '-local' ;
25
20
}
26
21
27
- function buildDotNetNewNuGetPackages ( outputDir : string ) {
28
- const dotNetPackageIds = _ . values ( dotNetPackages ) ;
29
- dotNetPackageIds . forEach ( packageId => {
30
- const dotNetNewNupkgPath = buildDotNetNewNuGetPackage ( packageId ) ;
31
-
32
- // Move the .nupkg file to the output dir
33
- mkdirp . sync ( outputDir ) ;
34
- fs . renameSync ( dotNetNewNupkgPath , path . join ( outputDir , path . basename ( dotNetNewNupkgPath ) ) ) ;
35
- } ) ;
36
- }
37
-
38
- function buildDotNetNewNuGetPackage ( packageId : string ) {
22
+ packageIds . forEach ( packageId => {
39
23
// Invoke NuGet to create the final package
40
24
const packageSourceRootDir = path . join ( '../' , packageId ) ;
41
25
const nuspecFilename = `${ packageId } .nuspec` ;
42
- const nugetExe = path . join ( process . cwd ( ) , './bin/NuGet.exe' ) ;
26
+ const nugetExe = path . resolve ( './bin/NuGet.exe' ) ;
43
27
const nugetStartInfo = { cwd : packageSourceRootDir , stdio : 'inherit' } ;
44
- const packageVersion = `1.0.${ getBuildNumber ( ) } ` ;
45
- const nugetArgs = [ 'pack' , nuspecFilename , '-Version' , packageVersion ] ;
28
+ const nugetArgs = [
29
+ 'pack' , nuspecFilename ,
30
+ '-Version' , packageVersion ,
31
+ '-OutputDirectory' , path . resolve ( './artifacts' )
32
+ ] ;
33
+
46
34
if ( isWindows ) {
47
35
// Invoke NuGet.exe directly
48
36
childProcess . spawnSync ( nugetExe , nugetArgs , nugetStartInfo ) ;
@@ -51,8 +39,4 @@ function buildDotNetNewNuGetPackage(packageId: string) {
51
39
nugetArgs . unshift ( nugetExe ) ;
52
40
childProcess . spawnSync ( 'mono' , nugetArgs , nugetStartInfo ) ;
53
41
}
54
-
55
- return glob . sync ( path . join ( packageSourceRootDir , './*.nupkg' ) ) [ 0 ] ;
56
- }
57
-
58
- buildDotNetNewNuGetPackages ( './artifacts' ) ;
42
+ } ) ;
0 commit comments