mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(build): add package.json and README to the build:release output. (#1308)
This commit is contained in:
@@ -19,7 +19,16 @@ const resolveBin = require('resolve-bin');
|
||||
|
||||
/** If the string passed in is a glob, returns it, otherwise append '**\/*' to it. */
|
||||
function _globify(maybeGlob: string, suffix = '**/*') {
|
||||
return maybeGlob.indexOf('*') != -1 ? maybeGlob : path.join(maybeGlob, suffix);
|
||||
if (maybeGlob.indexOf('*') != -1) {
|
||||
return maybeGlob;
|
||||
}
|
||||
try {
|
||||
const stat = fs.statSync(maybeGlob);
|
||||
if (stat.isFile()) {
|
||||
return maybeGlob;
|
||||
}
|
||||
} catch (e) {}
|
||||
return path.join(maybeGlob, suffix);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +142,11 @@ export function execNodeTask(packageName: string, executable: string | string[],
|
||||
|
||||
|
||||
/** Copy files from a glob to a destination. */
|
||||
export function copyTask(srcGlobOrDir: string, outRoot: string) {
|
||||
return () => {
|
||||
return gulp.src(_globify(srcGlobOrDir)).pipe(gulp.dest(outRoot));
|
||||
export function copyTask(srcGlobOrDir: string | string[], outRoot: string) {
|
||||
if (typeof srcGlobOrDir === 'string') {
|
||||
return () => gulp.src(_globify(srcGlobOrDir)).pipe(gulp.dest(outRoot));
|
||||
} else {
|
||||
return () => gulp.src(srcGlobOrDir.map(name => _globify(name))).pipe(gulp.dest(outRoot));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,10 @@ task(':watch:components:spec', () => {
|
||||
|
||||
task(':build:components:ts', tsBuildTask(componentsDir));
|
||||
task(':build:components:spec', tsBuildTask(path.join(componentsDir, 'tsconfig-spec.json')));
|
||||
task(':build:components:assets',
|
||||
copyTask(path.join(componentsDir, '*/**/*.!(ts|spec.ts)'), DIST_COMPONENTS_ROOT));
|
||||
task(':build:components:assets', copyTask([
|
||||
path.join(componentsDir, '**/*.!(ts|spec.ts)'),
|
||||
path.join(PROJECT_ROOT, 'README.md'),
|
||||
], DIST_COMPONENTS_ROOT));
|
||||
task(':build:components:scss', sassBuildTask(
|
||||
DIST_COMPONENTS_ROOT, componentsDir, [path.join(componentsDir, 'core/style')]
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user