Skip to content

Commit d0a762a

Browse files
devversiontinayuangao
authored andcommitted
chore: additional files for examples are missing (#9548)
* Due to recent changes to the `example-data` file, the `ExampleData` class accidentally no longer adds the additional files to the `exampleFiles` property. This means that those files aren't copied over to StackBlitz. * Cleans up the example data file. Fixes #9541.
1 parent b901feb commit d0a762a

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/material-examples/example-data.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,42 @@ import {EXAMPLE_COMPONENTS} from './example-module';
66
* with information about Component name, selector, files used in example, and path to examples
77
*/
88
export class ExampleData {
9-
// TODO: figure out how do we get these variables.
10-
description = 'Some description for material';
11-
// TODO: use real example and delete the example/ folder.
12-
examplePath = '/assets/example/';
13-
exampleFiles = ['button-demo.html', 'button-demo.scss', 'button-demo.ts'];
149

15-
// TODO: extract these variables from example code.
16-
selectorName = 'button-demo';
17-
indexFilename = 'button-demo';
18-
componentName = 'ButtonDemo';
10+
/** Description of the example. */
11+
description: string;
12+
13+
/** Path to the example. This is based on the structure of the material.angular.io repo. */
14+
examplePath: string;
15+
16+
/** List of files that are part of this example. */
17+
exampleFiles: string[];
18+
19+
/** Selector name of the example component. */
20+
selectorName: string;
21+
22+
/** Name of the file that contains the example component. */
23+
indexFilename: string;
24+
25+
/**
26+
* Name of the example component. For examples with multiple components, this property will
27+
* include multiple components that are comma separated (e.g. dialog-overview)
28+
*/
29+
componentName: string;
1930

2031
constructor(example: string) {
2132
if (!example || !EXAMPLE_COMPONENTS.hasOwnProperty(example)) {
2233
return;
2334
}
2435

2536
const exampleConfig = EXAMPLE_COMPONENTS[example];
26-
const exampleFilesSet = new Set(['html', 'ts', 'css'].map(extension => {
27-
return `${example}-example.${extension}`;
28-
}));
2937

3038
// TODO(tinayuangao): Do not hard-code extensions
3139
this.exampleFiles = ['html', 'ts', 'css'].map(extension => `${example}-example.${extension}`);
3240
this.examplePath = `/assets/stackblitz/examples/${example}/`;
33-
this.exampleFiles = Array.from(exampleFilesSet.values());
3441
this.selectorName = this.indexFilename = `${example}-example`;
3542

3643
if (exampleConfig.additionalFiles) {
37-
for (let file of exampleConfig.additionalFiles) {
38-
exampleFilesSet.add(file);
39-
}
44+
this.exampleFiles.push(...exampleConfig.additionalFiles);
4045
}
4146

4247
const exampleName = example.replace(/(?:^\w|\b\w)/g, letter => letter.toUpperCase());

0 commit comments

Comments
 (0)