Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: package theming files into release output #3776

Merged
merged 1 commit into from
Mar 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"rollup": "^0.41.6",
"run-sequence": "^1.2.2",
"sass": "^0.5.0",
"scss-bundle": "^1.0.1",
"selenium-webdriver": "^3.1.0",
"stylelint": "^7.8.0",
"travis-after-modes": "0.0.7",
Expand Down
28 changes: 26 additions & 2 deletions tools/gulp/tasks/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {spawn} from 'child_process';
import {existsSync, statSync, writeFileSync, readFileSync} from 'fs-extra';
import {join, basename} from 'path';
import {task, src, dest} from 'gulp';
import {execTask, sequenceTask} from '../util/task_helpers';
import {execNodeTask, execTask, sequenceTask} from '../util/task_helpers';
import {
DIST_RELEASE, DIST_BUNDLES, DIST_MATERIAL, COMPONENTS_DIR, LICENSE_BANNER, DIST_ROOT
} from '../constants';
import * as minimist from 'minimist';

// There are no type definitions available for these imports.
const glob = require('glob');
const gulpRename = require('gulp-rename');

/** Parse command-line arguments for release task. */
const argv = minimist(process.argv.slice(3));
Expand All @@ -23,14 +24,23 @@ const umdGlob = join(DIST_BUNDLES, '*.umd.*');
// Matches all flat ESM bundles (e.g material.js and material.es5.js)
const fesmGlob = [join(DIST_BUNDLES, '*.js'), `!${umdGlob}`];

// The entry-point for the scss theming bundle.
const themingEntryPointPath = join(COMPONENTS_DIR, 'core', 'theming', '_all-theme.scss');

// Output path for the scss theming bundle.
const themingBundlePath = join(DIST_RELEASE, '_theming.scss');

// Matches all pre-built theme css files
const prebuiltThemeGlob = join(DIST_MATERIAL, '**/theming/prebuilt/*.css');

task('build:release', sequenceTask(
'library:build',
':package:release',
));

/** Task that combines intermediate build artifacts into the release package structure. */
task(':package:release', sequenceTask(
[':package:typings', ':package:umd', ':package:fesm', ':package:assets'],
[':package:typings', ':package:umd', ':package:fesm', ':package:assets', ':package:theming'],
':inline-metadata-resources',
':package:metadata',
));
Expand Down Expand Up @@ -80,6 +90,20 @@ task(':package:umd', () => src(umdGlob).pipe((dest(join(DIST_RELEASE, 'bundles')
/** Copy primary entry-point FESM bundles to the @angular/ directory. */
task(':package:fesm', () => src(fesmGlob).pipe(dest(join(DIST_RELEASE, '@angular'))));

/** Copies all prebuilt themes into the release package under `prebuilt-themes/` */
task(':package:theming', [':bundle:theming-scss'],
() => src(prebuiltThemeGlob)
.pipe(gulpRename({dirname: ''}))
.pipe(dest(join(DIST_RELEASE, 'prebuilt-themes'))));

/** Bundles all scss requires for theming into a single scss file in the root of the package. */
task(':bundle:theming-scss', execNodeTask(
'scss-bundle',
'scss-bundle', [
'-e', themingEntryPointPath,
'-d', themingBundlePath,
]));

/** Make sure we're logged in. */
task(':publish:whoami', execTask('npm', ['whoami'], {
silent: true,
Expand Down