Skip to content

Commit 0b72461

Browse files
crisbetojelbourn
authored andcommitted
build: examples not working in dev app (#17166)
Fixes a couple of issues related to examples in the dev app: 1. The path mappings for all the new example entry points (e.g. `@angular/material-examples/material/button`) weren't being configured in the System config which meant that any page that consumes any of the examples would break. These changes make it so that whenever we configure a new entry point we automatically configure its examples. 2. The `popover-edit` examples were placed under the stable `cdk` and `material` example packages which is incorrect, because `popover-edit` itself is still experimental. These changes add new `cdk-experimental` and `material-experimental` packages under `material-examples` for consistency with the rest of the repo and so that we don't end up accidentally publishing these examples.
1 parent 93fbe04 commit 0b72461

File tree

35 files changed

+27
-20
lines changed

35 files changed

+27
-20
lines changed

packages.bzl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,19 @@ ROLLUP_GLOBALS.update({
207207
# from entry-points which should be treated as external imports.
208208
ROLLUP_GLOBALS.update({
209209
"@angular/material-examples/cdk/%s" % p: "ng.materialExamples.cdk.%s" % p
210-
for p in CDK_PACKAGES + CDK_EXPERIMENTAL_PACKAGES
210+
for p in CDK_PACKAGES
211+
})
212+
ROLLUP_GLOBALS.update({
213+
"@angular/material-examples/cdk-experimental/%s" % p: "ng.materialExamples.cdkExperimental.%s" % p
214+
for p in CDK_EXPERIMENTAL_PACKAGES
211215
})
212216
ROLLUP_GLOBALS.update({
213217
"@angular/material-examples/material/%s" % p: "ng.materialExamples.material.%s" % p
214-
for p in MATERIAL_PACKAGES + MATERIAL_EXPERIMENTAL_PACKAGES
218+
for p in MATERIAL_PACKAGES
219+
})
220+
ROLLUP_GLOBALS.update({
221+
"@angular/material-examples/material-experimental/%s" % p: "ng.materialExamples.materialExperimental.%s" % p
222+
for p in MATERIAL_EXPERIMENTAL_PACKAGES
215223
})
216224

217225
# UMD bundles for Angular packages and subpackages we depend on for development and testing.

src/dev-app/system-config.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,15 @@ MATERIAL_PACKAGES.forEach(function(pkgName) {
102102
configureEntryPoint('google-maps');
103103
configureEntryPoint('youtube-player');
104104

105-
/** Configures the specified package and its entry-point. */
105+
/** Configures the specified package, its entry-point and its examples. */
106106
function configureEntryPoint(pkgName, entryPoint) {
107-
if (entryPoint === undefined) {
108-
pathMapping['@angular/' + pkgName] = srcRunfilePath + '/' + pkgName;
109-
packagesConfig[srcRunfilePath + '/' + pkgName] = {main: 'index.js'};
110-
} else {
111-
pathMapping['@angular/' + pkgName + '/' + entryPoint] =
112-
srcRunfilePath + '/' + pkgName + '/' + entryPoint;
113-
packagesConfig[srcRunfilePath + '/' + pkgName + '/' + entryPoint] = {main: 'index.js'};
114-
}
107+
var name = entryPoint ? pkgName + '/' + entryPoint : pkgName;
108+
var examplesName = 'material-examples/' + name;
109+
110+
pathMapping['@angular/' + name] = srcRunfilePath + '/' + name;
111+
pathMapping['@angular/' + examplesName] = srcRunfilePath + '/' + examplesName;
112+
packagesConfig[srcRunfilePath + '/' + name] =
113+
packagesConfig[srcRunfilePath + '/' + examplesName] = {main: 'index.js'};
115114
}
116115

117116
var map = Object.assign({

src/material-examples/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ EXAMPLE_PACKAGES = [
1111
"//src/material-examples/cdk/a11y",
1212
"//src/material-examples/cdk/drag-drop",
1313
"//src/material-examples/cdk/platform",
14-
"//src/material-examples/cdk/popover-edit",
14+
"//src/material-examples/cdk-experimental/popover-edit",
1515
"//src/material-examples/cdk/portal",
1616
"//src/material-examples/cdk/scrolling",
1717
"//src/material-examples/cdk/stepper",
@@ -38,7 +38,7 @@ EXAMPLE_PACKAGES = [
3838
"//src/material-examples/material/list",
3939
"//src/material-examples/material/menu",
4040
"//src/material-examples/material/paginator",
41-
"//src/material-examples/material/popover-edit",
41+
"//src/material-examples/material-experimental/popover-edit",
4242
"//src/material-examples/material/progress-bar",
4343
"//src/material-examples/material/progress-spinner",
4444
"//src/material-examples/material/radio",

src/material-examples/cdk/popover-edit/BUILD.bazel renamed to src/material-examples/cdk-experimental/popover-edit/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12-
module_name = "@angular/material-examples/cdk/popover-edit",
12+
module_name = "@angular/material-examples/cdk-experimental/popover-edit",
1313
deps = [
1414
"//src/cdk-experimental/popover-edit",
1515
"//src/cdk/collections",

src/material-examples/example-module.ts

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

src/material-examples/material/popover-edit/BUILD.bazel renamed to src/material-examples/material-experimental/popover-edit/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ng_module(
99
"**/*.html",
1010
"**/*.css",
1111
]),
12-
module_name = "@angular/material-examples/material/popover-edit",
12+
module_name = "@angular/material-examples/material-experimental/popover-edit",
1313
deps = [
1414
"//src/material-experimental/popover-edit",
1515
"//src/material/button",

0 commit comments

Comments
 (0)