forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use shared logic to build packages (angular#4202)
* build: use shared logic to build packages * No longer creates the whole set of gulp tasks just to build a single package. * Makes the package building & releasing more consistent. No extra `build:release` just for the `lib` package. References angular#4108 * Address feedback
- Loading branch information
1 parent
14b330e
commit 2b8f753
Showing
20 changed files
with
164 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import {createPackageBuildTasks} from './util/package-tasks'; | ||
|
||
/** Create gulp tasks to build the different packages in the project. */ | ||
createPackageBuildTasks('cdk'); | ||
createPackageBuildTasks('material', ['cdk']); | ||
createPackageBuildTasks('material-examples', ['material']); | ||
|
||
import './tasks/ci'; | ||
import './tasks/clean'; | ||
import './tasks/default'; | ||
import './tasks/development'; | ||
import './tasks/docs'; | ||
import './tasks/e2e'; | ||
import './tasks/lint'; | ||
import './tasks/release'; | ||
import './tasks/publish'; | ||
import './tasks/screenshots'; | ||
import './tasks/unit-test'; | ||
import './tasks/aot'; | ||
import './tasks/payload'; | ||
import './tasks/coverage'; | ||
import './tasks/library'; | ||
import './tasks/examples'; | ||
import './tasks/cdk'; | ||
import './tasks/material-release'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import {task, src, dest} from 'gulp'; | ||
import {join} from 'path'; | ||
import {writeFileSync} from 'fs'; | ||
import {Bundler} from 'scss-bundle'; | ||
import {execNodeTask, sequenceTask} from '../util/task_helpers'; | ||
import {composeRelease} from '../util/package-build'; | ||
import {COMPONENTS_DIR, DIST_MATERIAL, DIST_RELEASES} from '../constants'; | ||
|
||
// There are no type definitions available for these imports. | ||
const gulpRename = require('gulp-rename'); | ||
|
||
// Path to the release output of material. | ||
const releasePath = join(DIST_RELEASES, 'material'); | ||
// 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(releasePath, '_theming.scss'); | ||
// Matches all pre-built theme css files | ||
const prebuiltThemeGlob = join(DIST_MATERIAL, '**/theming/prebuilt/*.css'); | ||
// Matches all SCSS files in the library. | ||
const allScssGlob = join(COMPONENTS_DIR, '**/*.scss'); | ||
|
||
/** | ||
* Overwrite the release task for the material package. The material release will include special | ||
* files, like a bundled theming SCSS file or all prebuilt themes. | ||
*/ | ||
task('material:build-release', ['material:prepare-release'], () => composeRelease('material')); | ||
|
||
/** | ||
* Task that will build the material package. It will also copy all prebuilt themes and build | ||
* a bundled SCSS file for theming | ||
*/ | ||
task('material:prepare-release', sequenceTask( | ||
'material:build', | ||
['material:copy-prebuilt-themes', 'material:bundle-theming-scss'] | ||
)); | ||
|
||
/** Copies all prebuilt themes into the release package under `prebuilt-themes/` */ | ||
task('material:copy-prebuilt-themes', () => { | ||
src(prebuiltThemeGlob) | ||
.pipe(gulpRename({dirname: ''})) | ||
.pipe(dest(join(releasePath, 'prebuilt-themes'))); | ||
}); | ||
|
||
/** Bundles all scss requires for theming into a single scss file in the root of the package. */ | ||
task('material:bundle-theming-scss', () => { | ||
// Instantiates the SCSS bundler and bundles all imports of the specified entry point SCSS file. | ||
// A glob of all SCSS files in the library will be passed to the bundler. The bundler takes an | ||
// array of globs, which will match SCSS files that will be only included once in the bundle. | ||
new Bundler().Bundle(themingEntryPointPath, [allScssGlob]).then(result => { | ||
writeFileSync(themingBundlePath, result.bundledContent); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.