Skip to content

Commit e7af740

Browse files
devversionjelbourn
authored andcommitted
build: auto generate example module (#9590)
No longer pushes the example-module.ts file to the GitHub repository. The file will be auto-generated once the `material-examples` build package is being built. References #9574.
1 parent 6be3c64 commit e7af740

File tree

7 files changed

+20
-764
lines changed

7 files changed

+20
-764
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/deploy
77
/screenshots
88

9+
# Example module file will be auto-generated.
10+
/src/material-examples/example-module.ts
11+
912
# dependencies
1013
node_modules
1114
/bower_components

src/material-examples/example-data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// The example-module file will be auto-generated. As soon as the
2+
// examples are being compiled, the module file will be generated.
13
import {EXAMPLE_COMPONENTS} from './example-module';
24

3-
45
/**
56
* Example data
67
* with information about Component name, selector, files used in example, and path to examples

src/material-examples/example-module.ts

Lines changed: 0 additions & 758 deletions
This file was deleted.

src/material-examples/public-api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
export * from './example-data';
2+
3+
// The example-module file will be auto-generated. As soon as the
4+
// examples are being compiled, the module file will be generated.
25
export * from './example-module';
36

47
export * from './list-overview/list-overview-example';

tools/gulp/gulpfile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ createPackageBuildTasks(cdkPackage);
1212
createPackageBuildTasks(cdkExperimentalPackage);
1313
createPackageBuildTasks(materialPackage);
1414
createPackageBuildTasks(materialExperimentalPackage);
15-
createPackageBuildTasks(examplesPackage);
15+
createPackageBuildTasks(examplesPackage, ['build-examples-module']);
1616
createPackageBuildTasks(momentAdapterPackage);
1717

1818
import './tasks/aot';
@@ -24,7 +24,7 @@ import './tasks/default';
2424
import './tasks/development';
2525
import './tasks/docs';
2626
import './tasks/e2e';
27-
import './tasks/examples';
27+
import './tasks/example-module';
2828
import './tasks/lint';
2929
import './tasks/material-release';
3030
import './tasks/payload';

tools/gulp/tasks/examples.ts renamed to tools/gulp/tasks/example-module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {task} from 'gulp';
22
import {sync as glob} from 'glob';
3+
import {buildConfig} from 'material2-build-tools';
34
import * as fs from 'fs';
45
import * as path from 'path';
56
import * as ts from 'typescript';
6-
import {buildConfig} from 'material2-build-tools';
7+
78
const {packagesDir} = buildConfig;
89

910
interface ExampleMetadata {

tools/package-tools/gulp/build-tasks-gulp.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ const htmlMinifierOptions = {
1818
removeAttributeQuotes: false
1919
};
2020

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

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

4448
task(`${taskName}:build`, sequenceTask(
49+
// Run the pre build gulp tasks.
50+
...preBuildTasks,
4551
// Build all required packages before building.
4652
...dependencyNames.map(pkgName => `${pkgName}:build`),
4753
// Build ESM and assets output.

0 commit comments

Comments
 (0)