Skip to content

build: auto generate example module #9590

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

Merged
merged 1 commit into from
Jan 25, 2018
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
/deploy
/screenshots

# Example module file will be auto-generated.
/src/material-examples/example-module.ts

# dependencies
node_modules
/bower_components
Expand Down
3 changes: 2 additions & 1 deletion src/material-examples/example-data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// The example-module file will be auto-generated. As soon as the
// examples are being compiled, the module file will be generated.
import {EXAMPLE_COMPONENTS} from './example-module';


/**
* Example data
* with information about Component name, selector, files used in example, and path to examples
Expand Down
758 changes: 0 additions & 758 deletions src/material-examples/example-module.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/material-examples/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export * from './example-data';

// The example-module file will be auto-generated. As soon as the
// examples are being compiled, the module file will be generated.
export * from './example-module';

export * from './list-overview/list-overview-example';
Expand Down
4 changes: 2 additions & 2 deletions tools/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ createPackageBuildTasks(cdkPackage);
createPackageBuildTasks(cdkExperimentalPackage);
createPackageBuildTasks(materialPackage);
createPackageBuildTasks(materialExperimentalPackage);
createPackageBuildTasks(examplesPackage);
createPackageBuildTasks(examplesPackage, ['build-examples-module']);
createPackageBuildTasks(momentAdapterPackage);

import './tasks/aot';
Expand All @@ -24,7 +24,7 @@ import './tasks/default';
import './tasks/development';
import './tasks/docs';
import './tasks/e2e';
import './tasks/examples';
import './tasks/example-module';
import './tasks/lint';
import './tasks/material-release';
import './tasks/payload';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {task} from 'gulp';
import {sync as glob} from 'glob';
import {buildConfig} from 'material2-build-tools';
import * as fs from 'fs';
import * as path from 'path';
import * as ts from 'typescript';
import {buildConfig} from 'material2-build-tools';

const {packagesDir} = buildConfig;

interface ExampleMetadata {
Expand Down
10 changes: 8 additions & 2 deletions tools/package-tools/gulp/build-tasks-gulp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ const htmlMinifierOptions = {
removeAttributeQuotes: false
};

/** Creates a set of gulp tasks that can build the specified package. */
export function createPackageBuildTasks(buildPackage: BuildPackage) {
/**
* Creates a set of gulp tasks that can build the specified package.
* @param buildPackage Build package for which the gulp tasks will be generated
* @param preBuildTasks List of gulp tasks that should run before building the package.
*/
export function createPackageBuildTasks(buildPackage: BuildPackage, preBuildTasks: string[] = []) {
// Name of the package build tasks for Gulp.
const taskName = buildPackage.name;

Expand All @@ -42,6 +46,8 @@ export function createPackageBuildTasks(buildPackage: BuildPackage) {
task(`${taskName}:clean-build`, sequenceTask('clean', `${taskName}:build`));

task(`${taskName}:build`, sequenceTask(
// Run the pre build gulp tasks.
...preBuildTasks,
// Build all required packages before building.
...dependencyNames.map(pkgName => `${pkgName}:build`),
// Build ESM and assets output.
Expand Down