Skip to content

Commit bbe3475

Browse files
hanslkara
authored andcommitted
fix(build): add package.json and README to the build:release output. (#1308)
1 parent 1a824d2 commit bbe3475

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

tools/gulp/task_helpers.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ const resolveBin = require('resolve-bin');
1919

2020
/** If the string passed in is a glob, returns it, otherwise append '**\/*' to it. */
2121
function _globify(maybeGlob: string, suffix = '**/*') {
22-
return maybeGlob.indexOf('*') != -1 ? maybeGlob : path.join(maybeGlob, suffix);
22+
if (maybeGlob.indexOf('*') != -1) {
23+
return maybeGlob;
24+
}
25+
try {
26+
const stat = fs.statSync(maybeGlob);
27+
if (stat.isFile()) {
28+
return maybeGlob;
29+
}
30+
} catch (e) {}
31+
return path.join(maybeGlob, suffix);
2332
}
2433

2534

@@ -133,9 +142,11 @@ export function execNodeTask(packageName: string, executable: string | string[],
133142

134143

135144
/** Copy files from a glob to a destination. */
136-
export function copyTask(srcGlobOrDir: string, outRoot: string) {
137-
return () => {
138-
return gulp.src(_globify(srcGlobOrDir)).pipe(gulp.dest(outRoot));
145+
export function copyTask(srcGlobOrDir: string | string[], outRoot: string) {
146+
if (typeof srcGlobOrDir === 'string') {
147+
return () => gulp.src(_globify(srcGlobOrDir)).pipe(gulp.dest(outRoot));
148+
} else {
149+
return () => gulp.src(srcGlobOrDir.map(name => _globify(name))).pipe(gulp.dest(outRoot));
139150
}
140151
}
141152

tools/gulp/tasks/components.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ task(':watch:components:spec', () => {
2828

2929
task(':build:components:ts', tsBuildTask(componentsDir));
3030
task(':build:components:spec', tsBuildTask(path.join(componentsDir, 'tsconfig-spec.json')));
31-
task(':build:components:assets',
32-
copyTask(path.join(componentsDir, '*/**/*.!(ts|spec.ts)'), DIST_COMPONENTS_ROOT));
31+
task(':build:components:assets', copyTask([
32+
path.join(componentsDir, '**/*.!(ts|spec.ts)'),
33+
path.join(PROJECT_ROOT, 'README.md'),
34+
], DIST_COMPONENTS_ROOT));
3335
task(':build:components:scss', sassBuildTask(
3436
DIST_COMPONENTS_ROOT, componentsDir, [path.join(componentsDir, 'core/style')]
3537
));

0 commit comments

Comments
 (0)