Skip to content

Commit 8b243e8

Browse files
Simplify build script further
1 parent 28920c7 commit 8b243e8

File tree

2 files changed

+12
-41
lines changed

2 files changed

+12
-41
lines changed

‎templates/package-builder/package.json‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,11 @@
1010
"author": "Microsoft",
1111
"license": "Apache-2.0",
1212
"dependencies":{
13-
"@types/chalk": "^0.4.31",
14-
"@types/semver": "^5.3.30",
15-
"diff": "^2.2.2",
16-
"gitignore-parser": "0.0.2",
17-
"glob": "^7.0.3",
18-
"lodash": "^4.11.1",
19-
"mkdirp": "^0.5.1",
20-
"rimraf": "^2.5.2",
21-
"semver": "^5.3.0",
22-
"tar.gz": "^1.0.5"
13+
"mkdirp": "^0.5.1"
2314
},
2415
"devDependencies":{
25-
"@types/glob": "^5.0.30",
26-
"@types/lodash": "^4.14.37",
2716
"@types/mkdirp": "^0.3.29",
2817
"@types/node": "^6.0.45",
29-
"@types/node-uuid": "0.0.28",
30-
"@types/rimraf": "0.0.28",
3118
"typescript": "^2.0.0"
3219
}
3320
}
Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import*asglobfrom'glob';
2-
import*asgitignorefrom'gitignore-parser';
31
import*asfsfrom'fs';
42
import*aspathfrom'path';
5-
import*as_from'lodash';
63
import*asmkdirpfrom'mkdirp';
7-
import*asrimraffrom'rimraf';
84
import*aschildProcessfrom'child_process';
9-
import*astargzfrom'tar.gz';
105

116
constisWindows=/^win/.test(process.platform);
12-
13-
constdotNetPackages=[
7+
constpackageIds=[
148
'Microsoft.DotNet.Web.Spa.ProjectTemplates',
159
'Microsoft.AspNetCore.SpaTemplates'
1610
];
11+
constpackageVersion=`1.0.${getBuildNumber()}`;
1712

1813
functiongetBuildNumber(): string{
1914
if(process.env.APPVEYOR_BUILD_NUMBER){
@@ -24,25 +19,18 @@ function getBuildNumber(): string{
2419
returnMath.floor((newDate().valueOf()-newDate(2017,0,1).valueOf())/(60*1000))+'-local';
2520
}
2621

27-
functionbuildDotNetNewNuGetPackages(outputDir: string){
28-
constdotNetPackageIds=_.values(dotNetPackages);
29-
dotNetPackageIds.forEach(packageId=>{
30-
constdotNetNewNupkgPath=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-
functionbuildDotNetNewNuGetPackage(packageId: string){
22+
packageIds.forEach(packageId=>{
3923
// Invoke NuGet to create the final package
4024
constpackageSourceRootDir=path.join('../',packageId);
4125
constnuspecFilename=`${packageId}.nuspec`;
42-
constnugetExe=path.join(process.cwd(),'./bin/NuGet.exe');
26+
constnugetExe=path.resolve('./bin/NuGet.exe');
4327
constnugetStartInfo={cwd: packageSourceRootDir,stdio: 'inherit'};
44-
constpackageVersion=`1.0.${getBuildNumber()}`;
45-
constnugetArgs=['pack',nuspecFilename,'-Version',packageVersion];
28+
constnugetArgs=[
29+
'pack',nuspecFilename,
30+
'-Version',packageVersion,
31+
'-OutputDirectory',path.resolve('./artifacts')
32+
];
33+
4634
if(isWindows){
4735
// Invoke NuGet.exe directly
4836
childProcess.spawnSync(nugetExe,nugetArgs,nugetStartInfo);
@@ -51,8 +39,4 @@ function buildDotNetNewNuGetPackage(packageId: string){
5139
nugetArgs.unshift(nugetExe);
5240
childProcess.spawnSync('mono',nugetArgs,nugetStartInfo);
5341
}
54-
55-
returnglob.sync(path.join(packageSourceRootDir,'./*.nupkg'))[0];
56-
}
57-
58-
buildDotNetNewNuGetPackages('./artifacts');
42+
});

0 commit comments

Comments
(0)