mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Yeoman package builder emits .tar.gz artifact
This commit is contained in:
@@ -18,7 +18,8 @@
|
|||||||
"lodash": "^4.11.1",
|
"lodash": "^4.11.1",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"semver": "^5.3.0"
|
"semver": "^5.3.0",
|
||||||
|
"tar.gz": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^5.0.30",
|
"@types/glob": "^5.0.30",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import * as _ from 'lodash';
|
|||||||
import * as mkdirp from 'mkdirp';
|
import * as mkdirp from 'mkdirp';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import * as childProcess from 'child_process';
|
import * as childProcess from 'child_process';
|
||||||
|
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', 'Dockerfile', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx', '.xproj'];
|
const 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)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildYeomanNpmPackage() {
|
function buildYeomanNpmPackage(outputRoot: string) {
|
||||||
const outputRoot = './dist/generator-aspnetcore-spa';
|
|
||||||
const outputTemplatesRoot = path.join(outputRoot, 'app/templates');
|
const outputTemplatesRoot = path.join(outputRoot, 'app/templates');
|
||||||
rimraf.sync(outputTemplatesRoot);
|
rimraf.sync(outputTemplatesRoot);
|
||||||
|
|
||||||
@@ -190,7 +190,19 @@ function runScripts(rootDir: string, scripts: string[]) {
|
|||||||
console.log(`[Prepublish] Done`)
|
console.log(`[Prepublish] Done`)
|
||||||
}
|
}
|
||||||
|
|
||||||
rimraf.sync('./dist');
|
const distDir = './dist';
|
||||||
|
const artifactsDir = path.join(distDir, 'artifacts');
|
||||||
|
const yeomanOutputRoot = path.join(distDir, 'generator-aspnetcore-spa');
|
||||||
|
|
||||||
|
rimraf.sync(distDir);
|
||||||
|
mkdirp.sync(artifactsDir);
|
||||||
runAllPrepublishScripts();
|
runAllPrepublishScripts();
|
||||||
buildYeomanNpmPackage();
|
buildYeomanNpmPackage(yeomanOutputRoot);
|
||||||
buildDotNetNewNuGetPackage();
|
buildDotNetNewNuGetPackage();
|
||||||
|
|
||||||
|
// 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; }
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user