build(docs-infra): add support for examples of type `elements` (#24840)

Examples using `@angular/elements` need to transpile to es2015 for
Custom Elements to work (on browsers that natively support them).

Alternatively, a polyfill would need to be loaded. For now, changing the
transpilation target to es2015 is the simplest solution.

PR Close #24840
This commit is contained in:
George Kalpakas 2018-07-16 22:52:59 +03:00 committed by Victor Berchet
parent ead3f926cb
commit 1c533c913d
3 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,3 @@
{
"projectType": "elements"
}

View File

@ -50,13 +50,12 @@ const BOILERPLATE_PATHS = {
// This maps the CLI files that exists in a parent folder // This maps the CLI files that exists in a parent folder
const cliRelativePath = BOILERPLATE_PATHS.cli.map(file => `../cli/${file}`); const cliRelativePath = BOILERPLATE_PATHS.cli.map(file => `../cli/${file}`);
BOILERPLATE_PATHS.i18n = [ BOILERPLATE_PATHS.elements = [
...cliRelativePath, ...cliRelativePath,
'angular.json', 'tsconfig.json'
'package.json'
]; ];
BOILERPLATE_PATHS.universal = [ BOILERPLATE_PATHS.i18n = [
...cliRelativePath, ...cliRelativePath,
'angular.json', 'angular.json',
'package.json' 'package.json'
@ -67,6 +66,12 @@ BOILERPLATE_PATHS.testing = [
'angular.json' 'angular.json'
]; ];
BOILERPLATE_PATHS.universal = [
...cliRelativePath,
'angular.json',
'package.json'
];
const EXAMPLE_CONFIG_FILENAME = 'example-config.json'; const EXAMPLE_CONFIG_FILENAME = 'example-config.json';
class ExampleBoilerPlate { class ExampleBoilerPlate {

View File

@ -0,0 +1,20 @@
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015", // Custom Elements require ES2015 classes (or polyfill).
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}