Skip to content

Commit 9398afa

Browse files
committed
build: add material experimental package
* Adds the material-experimental package.
1 parent 4dd8a31 commit 9398afa

23 files changed

+207
-54
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
# Moment adapter package
7272
/src/material-moment-adapter/** @mmalerba
7373

74+
# Material experimental package
75+
/src/material-experimental/** @jelbourn
76+
7477
# Docs examples & guides
7578
/guides/** @amcdnl @jelbourn
7679
/src/material-examples/** @amcdnl @jelbourn

src/demo-app/system-config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ System.config({
3838

3939
// TODO(devversion): replace once the index.ts file for the Material package has been added.
4040
'@angular/material': 'dist/packages/material/public-api.js',
41-
'@angular/material-moment-adapter': 'dist/packages/material-moment-adapter/public-api.js',
41+
'@angular/material-experimental': 'dist/packages/material-experimental/index.js',
42+
'@angular/material-moment-adapter': 'dist/packages/material-moment-adapter/index.js',
4243
'@angular/cdk': 'dist/packages/cdk/index.js',
4344
'@angular/cdk/a11y': 'dist/packages/cdk/a11y/index.js',
4445
'@angular/cdk/accordion': 'dist/packages/cdk/accordion/index.js',

src/demo-app/tsconfig-aot.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// TypeScript config that extends the demo-app tsconfig file. This config compiles the
2-
// "main-aot.ts" file and also enables templage code generation / AOT. All paths need
3-
// to be relative to the output directory.
2+
// "main-aot.ts" file and also enables templage code generation / AOT.
43
{
54
"extends": "./tsconfig-build",
65
"compilerOptions": {
@@ -9,12 +8,19 @@
98
"experimentalDecorators": true,
109
"noUnusedParameters": true,
1110
"strictNullChecks": true,
12-
"outDir": ".",
11+
"outDir": "../../dist/packages/demo-app",
12+
"rootDirs": [
13+
".",
14+
"../../dist/packages/demo-app"
15+
],
1316
"paths": {
14-
"@angular/cdk/*": ["./cdk/*"],
15-
"@angular/material": ["./material"],
16-
"@angular/material/*": ["./material/*"],
17-
"@angular/material-moment-adapter": ["./material-moment-adapter"]
17+
"@angular/material/*": ["../../dist/releases/material/*"],
18+
"@angular/material": ["../../dist/releases/material"],
19+
"@angular/cdk/*": ["../../dist/releases/cdk/*"],
20+
"@angular/cdk": ["../../dist/releases/cdk"],
21+
"@angular/material-experimental/*": ["../../dist/releases/material-experimental/*"],
22+
"@angular/material-experimental": ["../../dist/releases/material-experimental"],
23+
"@angular/material-moment-adapter": ["../../dist/releases/material-moment-adapter"]
1824
}
1925
},
2026
"files": [

src/demo-app/tsconfig-build.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
],
2525
"baseUrl": ".",
2626
"paths": {
27+
"@angular/material/*": ["../../dist/packages/material/*"],
2728
"@angular/material": ["../../dist/packages/material/public-api"],
2829
"@angular/cdk/*": ["../../dist/packages/cdk/*"],
29-
"@angular/material/*": ["../../dist/packages/material/*"],
30+
"@angular/cdk": ["../../dist/packages/cdk"],
31+
"@angular/material-experimental/*": ["../../dist/packages/material-experimental/*"],
32+
"@angular/material-experimental": ["../../dist/packages/material-experimental"],
3033
"@angular/material-moment-adapter": ["../../dist/packages/material-moment-adapter"]
3134
}
3235
},

src/demo-app/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"@angular/cdk/*": ["../cdk/*"],
1111
"@angular/material/*": ["../lib/*"],
1212
"@angular/material": ["../lib/public-api.ts"],
13+
"@angular/material-experimental/*": ["../material-experimental/*"],
14+
"@angular/material-experimental": ["../material-experimental"],
1315
"@angular/material-moment-adapter": ["../material-moment-adapter/public-api.ts"]
1416
}
1517
},

src/e2e-app/system-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ System.config({
2828
'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
2929

3030
'@angular/material': 'dist/bundles/material.umd.js',
31+
'@angular/material-experimental': 'dist/bundles/material-experimental.umd.js',
3132
'@angular/material-moment-adapter': 'dist/bundles/material-moment-adapter.umd.js',
3233
'@angular/cdk': 'dist/bundles/cdk.umd.js',
3334
'@angular/cdk/a11y': 'dist/bundles/cdk-a11y.umd.js',

src/e2e-app/tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
"@angular/cdk/*": ["../cdk/*"],
99
"@angular/material/*": ["../lib/*"],
1010
"@angular/material": ["../lib/public-api.ts"],
11-
"@angular/material-moment-adapter": ["../material-moment-adapter/public-api.ts"],
12-
"@angular/material-examples": ["../material-examples/public-api.ts"]
11+
"@angular/material-experimental/*": ["../material-experimental/*"],
12+
"@angular/material-experimental": ["../material-experimental/"],
13+
"@angular/material-moment-adapter": ["../material-moment-adapter/"],
14+
"@angular/material-examples": ["../material-examples/"]
1315
}
1416
},
1517
"include": ["./**/*.ts"]

src/material-experimental/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './public-api';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@angular/material-experimental",
3+
"version": "0.0.0-PLACEHOLDER",
4+
"description": "Experimental components for Angular Material",
5+
"main": "./bundles/material-experimental.umd.js",
6+
"module": "./esm5/material-experimental.es5.js",
7+
"es2015": "./esm2015/material-experimental.js",
8+
"typings": "./material-experimental.d.ts",
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/angular/material2.git"
12+
},
13+
"license": "MIT",
14+
"bugs": {
15+
"url": "https://github.com/angular/material2/issues"
16+
},
17+
"homepage": "https://github.com/angular/material2#readme",
18+
"peerDependencies": {
19+
"@angular/material": "0.0.0-PLACEHOLDER",
20+
"@angular/core": "0.0.0-NG"
21+
},
22+
"dependencies": {
23+
"tslib": "^1.7.1"
24+
}
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './version';
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// TypeScript config file that is used to compile the experimental package into ES2015.
2+
{
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"declaration": true,
6+
"stripInternal": false,
7+
"experimentalDecorators": true,
8+
"noUnusedParameters": true,
9+
"strictNullChecks": true,
10+
"importHelpers": true,
11+
"newLine": "lf",
12+
"module": "es2015",
13+
"moduleResolution": "node",
14+
"outDir": "../../dist/packages/material-experimental",
15+
"rootDir": ".",
16+
"sourceMap": true,
17+
"inlineSources": true,
18+
"target": "es2015",
19+
"lib": ["es2015", "dom"],
20+
"skipLibCheck": true,
21+
"types": [],
22+
"paths": {
23+
"@angular/material/*": ["../../dist/packages/material/*"],
24+
"@angular/material": ["../../dist/packages/material/public-api"],
25+
"@angular/cdk/*": ["../../dist/packages/cdk/*"],
26+
"@angular/cdk": ["../../dist/packages/cdk"]
27+
}
28+
},
29+
"files": [
30+
"public-api.ts"
31+
],
32+
"angularCompilerOptions": {
33+
"annotateForClosureCompiler": true,
34+
"strictMetadataEmit": true,
35+
"flatModuleOutFile": "index.js",
36+
"flatModuleId": "@angular/material-experimental",
37+
"skipTemplateCodegen": true
38+
}
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// TypeScript config file that extends the default build tsconfig file. This config is used to
2+
// also compile the unit-test files. Since the code will run inside of the browser, the target is
3+
// set to ES5. Also the format needs to be CommonJS for Karma.
4+
{
5+
"extends": "./tsconfig-build",
6+
"compilerOptions": {
7+
"importHelpers": false,
8+
"module": "commonjs",
9+
"target": "es5",
10+
"types": ["jasmine"]
11+
},
12+
"angularCompilerOptions": {
13+
"strictMetadataEmit": true,
14+
"skipTemplateCodegen": true,
15+
"emitDecoratorMetadata": true
16+
},
17+
"include": [
18+
"**/*.spec.ts",
19+
"index.ts"
20+
]
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Configuration for IDEs only.
2+
{
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"rootDir": "..",
6+
"baseUrl": ".",
7+
"paths": {
8+
"@angular/cdk/*": ["../cdk/*"],
9+
"@angular/cdk": ["../cdk"],
10+
"@angular/material/*": ["../lib/*"],
11+
"@angular/material": ["../lib/public-api.ts"]
12+
}
13+
},
14+
"include": ["./**/*.ts"]
15+
}

src/material-experimental/version.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {Version} from '@angular/core';
10+
11+
/** Current version of the Material experimental package. */
12+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

test/karma-test-shim.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ System.config({
5050
// Path mappings for local packages that can be imported inside of tests.
5151
// TODO(devversion): replace once the index.ts file for the Material package has been added.
5252
'@angular/material': 'dist/packages/material/public-api.js',
53+
'@angular/material-experimental': 'dist/packages/material-experimental/index.js',
5354
'@angular/cdk': 'dist/packages/cdk/index.js',
5455
'@angular/cdk/a11y': 'dist/packages/cdk/a11y/index.js',
5556
'@angular/cdk/accordion': 'dist/packages/cdk/accordion/index.js',

tools/gulp/gulpfile.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
import {createPackageBuildTasks} from 'material2-build-tools';
2-
import {cdkPackage, examplesPackage, materialPackage, momentAdapterPackage} from './packages';
2+
import {
3+
cdkPackage,
4+
examplesPackage,
5+
experimentalPackage,
6+
materialPackage,
7+
momentAdapterPackage
8+
} from './packages';
39

410
createPackageBuildTasks(cdkPackage);
511
createPackageBuildTasks(materialPackage);
12+
createPackageBuildTasks(experimentalPackage);
613
createPackageBuildTasks(examplesPackage);
714
createPackageBuildTasks(momentAdapterPackage);
815

16+
import './tasks/aot';
17+
import './tasks/changelog';
918
import './tasks/ci';
1019
import './tasks/clean';
20+
import './tasks/coverage';
1121
import './tasks/default';
1222
import './tasks/development';
1323
import './tasks/docs';
1424
import './tasks/e2e';
25+
import './tasks/examples';
1526
import './tasks/lint';
27+
import './tasks/material-release';
28+
import './tasks/payload';
1629
import './tasks/publish';
1730
import './tasks/screenshots';
18-
import './tasks/examples';
1931
import './tasks/unit-test';
20-
import './tasks/aot';
21-
import './tasks/payload';
22-
import './tasks/coverage';
23-
import './tasks/material-release';
2432
import './tasks/universal';
2533
import './tasks/validate-release';
26-
import './tasks/changelog';

tools/gulp/packages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {join} from 'path';
33

44
export const cdkPackage = new BuildPackage('cdk');
55
export const materialPackage = new BuildPackage('material', [cdkPackage]);
6+
export const experimentalPackage = new BuildPackage('material-experimental', [materialPackage]);
67
export const momentAdapterPackage = new BuildPackage('material-moment-adapter', [materialPackage]);
78
export const examplesPackage = new BuildPackage('material-examples', [momentAdapterPackage]);
89

tools/gulp/tasks/aot.ts

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,29 @@
11
import {task} from 'gulp';
2-
import {copySync} from 'fs-extra';
32
import {execNodeTask} from '../util/task_helpers';
43
import {join} from 'path';
54
import {buildConfig, sequenceTask} from 'material2-build-tools';
65

7-
const {outputDir, packagesDir} = buildConfig;
8-
9-
/** Path to the directory where all releases are living. */
10-
const releasesDir = join(outputDir, 'releases');
6+
const {packagesDir} = buildConfig;
117

128
/** Path to the demo-app source directory. */
139
const demoAppSource = join(packagesDir, 'demo-app');
1410

15-
/** Path to the demo-app output directory. */
16-
const demoAppOut = join(outputDir, 'packages', 'demo-app');
17-
1811
/** Path to the tsconfig file that builds the AOT files. */
19-
const tsconfigFile = join(demoAppOut, 'tsconfig-aot.json');
12+
const tsconfigFile = join(demoAppSource, 'tsconfig-aot.json');
2013

21-
/** Builds the demo-app and material. To be able to run NGC, apply the metadata workaround. */
14+
/** Builds the demo-app assets and builds the required release packages. */
2215
task('aot:deps', sequenceTask(
23-
['material:build-release', 'cdk:build-release', 'material-moment-adapter:build-release'],
24-
[':build:devapp:assets', ':build:devapp:scss', 'aot:copy-devapp', 'aot:copy-release'],
16+
[
17+
'cdk:build-release',
18+
'material:build-release',
19+
'material-experimental:build-release',
20+
'material-moment-adapter:build-release'
21+
],
22+
// Build the assets after the releases have been built, because the demo-app assets import
23+
// SCSS files from the release packages.
24+
[':build:devapp:assets', ':build:devapp:scss'],
2525
));
2626

27-
// As a workaround for https://github.com/angular/angular/issues/12249, we need to
28-
// copy the Material and CDK ESM output inside of the demo-app output.
29-
task('aot:copy-release', () => {
30-
copySync(join(releasesDir, 'material'), join(demoAppOut, 'material'));
31-
copySync(join(releasesDir, 'cdk'), join(demoAppOut, 'cdk'));
32-
copySync(
33-
join(releasesDir, 'material-moment-adapter'), join(demoAppOut, 'material-moment-adapter'));
34-
});
35-
36-
// As a workaround for https://github.com/angular/angular/issues/12249, we need to
37-
// copy the demo-app sources to distribution and run the NGC inside of the dist folder.
38-
task('aot:copy-devapp', () => copySync(demoAppSource, demoAppOut));
39-
4027
/** Build the demo-app and a release to confirm that the library is AOT-compatible. */
4128
task('aot:build', sequenceTask('clean', 'aot:deps', 'aot:compiler-cli'));
4229

tools/gulp/tasks/development.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {join} from 'path';
44
import {
55
buildConfig, copyFiles, buildScssTask, sequenceTask, watchFiles
66
} from 'material2-build-tools';
7-
import {cdkPackage, materialPackage, momentAdapterPackage} from '../packages';
7+
import {cdkPackage, experimentalPackage, materialPackage, momentAdapterPackage} from '../packages';
88

99
// These imports don't have any typings provided.
1010
const firebaseTools = require('firebase-tools');
@@ -41,13 +41,15 @@ task(':watch:devapp', () => {
4141
watchFiles(join(appDir, '**/*.scss'), [':build:devapp:scss']);
4242
watchFiles(join(appDir, '**/*.html'), [':build:devapp:assets']);
4343

44-
// Custom watchers for the CDK, Material and Moment adapter package. This is necessary because
45-
// we only want to build the package as a single entry-point (using the tests task).
44+
// Custom watchers for all packages that are used inside of the demo-app. This is necessary
45+
// because we only want to build the changed package (using the build-no-bundles task).
4646
watchFiles(join(cdkPackage.sourceDir, '**/*'), ['cdk:build-no-bundles']);
4747
watchFiles(join(materialPackage.sourceDir, '**/!(*.scss)'), ['material:build-no-bundles']);
4848
watchFiles(join(materialPackage.sourceDir, '**/*.scss'), [':build:devapp:material-with-styles']);
4949
watchFiles(join(momentAdapterPackage.sourceDir, '**/*'),
5050
['material-moment-adapter:build-no-bundles']);
51+
watchFiles(join(experimentalPackage.sourceDir, '**/*'),
52+
['material-experimental:build-no-bundles']);
5153
});
5254

5355
/** Path to the demo-app tsconfig file. */
@@ -66,8 +68,11 @@ task(':build:devapp:material-with-styles', sequenceTask(
6668
));
6769

6870
task('build:devapp', sequenceTask(
69-
['material-moment-adapter:build-no-bundles', ':build:devapp:assets'],
70-
[':build:devapp:scss', ':build:devapp:ts']
71+
'cdk:build-no-bundles',
72+
'material:build-no-bundles',
73+
'material-experimental:build-no-bundles',
74+
'material-moment-adapter:build-no-bundles',
75+
[':build:devapp:assets', ':build:devapp:scss', ':build:devapp:ts']
7176
));
7277

7378
task('serve:devapp', ['build:devapp'], sequenceTask([':serve:devapp', ':watch:devapp']));
@@ -78,6 +83,8 @@ task('stage-deploy:devapp', ['build:devapp'], () => {
7883
copyFiles(bundlesDir, '*.+(js|map)', join(outDir, 'dist/bundles'));
7984
copyFiles(cdkPackage.outputDir, '**/*.+(js|map)', join(outDir, 'dist/packages/cdk'));
8085
copyFiles(materialPackage.outputDir, '**/*.+(js|map)', join(outDir, 'dist/packages/material'));
86+
copyFiles(experimentalPackage.outputDir, '**/*.+(js|map)',
87+
join(outDir, 'dist/packages/material-experimental'));
8188
copyFiles(materialPackage.outputDir, '**/prebuilt/*.+(css|map)',
8289
join(outDir, 'dist/packages/material'));
8390
});

0 commit comments

Comments
 (0)