Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit e6741ef

Browse files
authored
chore: remove moduleId from examples (#3362)
* chore: remove moduleId from examples * add support for testing and plunkers * delete component-relative cookbook * latest touches * ward teaks and travis fixes * fix typo in style-guide
1 parent a841380 commit e6741ef

File tree

156 files changed

+94
-2426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+94
-2426
lines changed

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
8686
var _exampleBoilerplateFiles = [
8787
'src/styles.css',
8888
'src/systemjs.config.js',
89+
'src/systemjs-angular-loader.js',
8990
'src/tsconfig.json',
9091
'bs-config.json',
9192
'bs-config.e2e.json',

public/docs/_examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# _boilerplate files
22
!_boilerplate/*
33
*/*/src/styles.css
4+
*/*/src/systemjs-angular-loader.js
45
*/*/src/systemjs.config.js
56
*/*/src/tsconfig.json
67
*/*/bs-config.e2e.json
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm;
2+
var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
3+
var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
4+
5+
module.exports.translate = function(load){
6+
7+
var url = new URL(load.address);
8+
9+
var basePathParts = url.pathname.split('/');
10+
11+
if (url.href.indexOf('plnkr') != -1) {
12+
basePathParts.shift();
13+
basePathParts.shift();
14+
}
15+
16+
basePathParts.pop();
17+
var basePath = basePathParts.join('/');
18+
load.source = load.source
19+
.replace(templateUrlRegex, function(match, quote, url){
20+
let resolvedUrl = url;
21+
22+
if (url.startsWith('.')) {
23+
resolvedUrl = basePath + url.substr(1);
24+
}
25+
26+
return `templateUrl: '${resolvedUrl}'`;
27+
})
28+
.replace(stylesRegex, function(match, relativeUrls) {
29+
var urls = [];
30+
31+
while ((match = stringRegex.exec(relativeUrls)) !== null) {
32+
if (match[2].startsWith('.')) {
33+
urls.push(`'${basePath.substr(1)}${match[2].substr(1)}'`);
34+
} else {
35+
urls.push(`'${match[2]}'`);
36+
}
37+
}
38+
39+
return "styleUrls: [" + urls.join(', ') + "]";
40+
});
41+
42+
return load;
43+
};

public/docs/_examples/_boilerplate/src/systemjs.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// map tells the System loader where to look for things
1212
map: {
1313
// our app is within the app folder
14-
app: 'app',
14+
'app': 'app',
1515

1616
// angular bundles
1717
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
@@ -32,7 +32,12 @@
3232
packages: {
3333
app: {
3434
main: './main.js',
35-
defaultExtension: 'js'
35+
defaultExtension: 'js',
36+
meta: {
37+
'./*.js': {
38+
loader: 'systemjs-angular-loader.js'
39+
}
40+
}
3641
},
3742
rxjs: {
3843
defaultExtension: 'js'

public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
},
3535
// map tells the System loader where to look for things
3636
map: {
37+
'ng-loader': './systemjs-angular-loader.js',
3738
// our app is within the app folder
38-
app: 'app',
39+
'app': 'app',
3940

4041
// angular bundles
4142
'@angular/core': 'ng:core-builds/master/bundles/core.umd.js',
@@ -71,7 +72,12 @@
7172
packages: {
7273
app: {
7374
main: './main.ts',
74-
defaultExtension: 'ts'
75+
defaultExtension: 'ts',
76+
meta: {
77+
'./*.ts': {
78+
loader: 'ng-loader'
79+
}
80+
}
7581
},
7682
rxjs: {
7783
defaultExtension: 'js'

public/docs/_examples/_boilerplate/src/systemjs.config.web.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
},
3232
// map tells the System loader where to look for things
3333
map: {
34+
'ng-loader': './systemjs-angular-loader.js',
3435
// our app is within the app folder
35-
app: 'app',
36+
'app': 'app',
3637

3738
// angular bundles
3839
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
@@ -58,7 +59,12 @@
5859
packages: {
5960
app: {
6061
main: './main.ts',
61-
defaultExtension: 'ts'
62+
defaultExtension: 'ts',
63+
meta: {
64+
'./*.ts': {
65+
loader: 'ng-loader'
66+
}
67+
}
6268
},
6369
rxjs: {
6470
defaultExtension: 'js'

public/docs/_examples/animations/ts/src/app/hero-list-auto.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { Heroes } from './hero.service';
1212

1313
@Component({
14-
moduleId: module.id,
1514
selector: 'hero-list-auto',
1615
// #docregion template
1716
template: `

public/docs/_examples/animations/ts/src/app/hero-list-basic.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
import { Heroes } from './hero.service';
1616

1717
@Component({
18-
moduleId: module.id,
1918
selector: 'hero-list-basic',
2019
// #enddocregion
2120
/* The click event calls hero.toggleState(), which

public/docs/_examples/animations/ts/src/app/hero-list-combined-transitions.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
import { Heroes } from './hero.service';
1515

1616
@Component({
17-
moduleId: module.id,
1817
selector: 'hero-list-combined-transitions',
1918
// #docregion template
2019
template: `

public/docs/_examples/animations/ts/src/app/hero-list-enter-leave-states.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { Heroes } from './hero.service';
1212

1313
@Component({
14-
moduleId: module.id,
1514
selector: 'hero-list-enter-leave-states',
1615
// #docregion template
1716
template: `

public/docs/_examples/animations/ts/src/app/hero-list-enter-leave.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { Heroes } from './hero.service';
1212

1313
@Component({
14-
moduleId: module.id,
1514
selector: 'hero-list-enter-leave',
1615
// #docregion template
1716
template: `

public/docs/_examples/animations/ts/src/app/hero-list-groups.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
import { Heroes } from './hero.service';
1313

1414
@Component({
15-
moduleId: module.id,
1615
selector: 'hero-list-groups',
1716
template: `
1817
<ul>

public/docs/_examples/animations/ts/src/app/hero-list-inline-styles.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import { Heroes } from './hero.service';
1414

1515
@Component({
16-
moduleId: module.id,
1716
selector: 'hero-list-inline-styles',
1817
// #docregion template
1918
template: `

public/docs/_examples/animations/ts/src/app/hero-list-multistep.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import { Heroes } from './hero.service';
1414

1515
@Component({
16-
moduleId: module.id,
1716
selector: 'hero-list-multistep',
1817
// #docregion template
1918
template: `

public/docs/_examples/animations/ts/src/app/hero-list-timings.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import { Heroes } from './hero.service';
1212

1313
@Component({
14-
moduleId: module.id,
1514
selector: 'hero-list-timings',
1615
template: `
1716
<ul>

public/docs/_examples/animations/ts/src/app/hero-list-twoway.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
import { Heroes } from './hero.service';
1515

1616
@Component({
17-
moduleId: module.id,
1817
selector: 'hero-list-twoway',
1918
// #docregion template
2019
template: `

public/docs/_examples/architecture/ts/src/app/hero-detail.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Component, Input } from '@angular/core';
33
import { Hero } from './hero';
44

55
@Component({
6-
moduleId: module.id,
76
selector: 'hero-detail',
87
templateUrl: './hero-detail.component.html'
98
})

public/docs/_examples/architecture/ts/src/app/hero-list.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { HeroService } from './hero.service';
55

66
// #docregion metadata, providers
77
@Component({
8-
moduleId: module.id,
98
selector: 'hero-list',
109
templateUrl: './hero-list.component.html',
1110
providers: [ HeroService ]

public/docs/_examples/attribute-directives/ts/src/app/app.component.1.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component } from '@angular/core';
22

33
@Component({
4-
moduleId: module.id,
54
selector: 'my-app',
65
templateUrl: './app.component.1.html'
76
})

public/docs/_examples/attribute-directives/ts/src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Component } from '@angular/core';
33

44
@Component({
5-
moduleId: module.id,
65
selector: 'my-app',
76
templateUrl: './app.component.html'
87
})

public/docs/_examples/cb-ajs-quick-reference/ts/src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { MovieService } from './movie.service';
44
import { IMovie } from './movie';
55

66
@Component({
7-
moduleId: module.id,
87
selector: 'my-app',
98
templateUrl: './app.component.html',
109
styleUrls: [ './app.component.css' ],

public/docs/_examples/cb-ajs-quick-reference/ts/src/app/movie-list.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { MovieService } from './movie.service';
88

99
// #docregion component
1010
@Component({
11-
moduleId: module.id,
1211
selector: 'movie-list',
1312
templateUrl: './movie-list.component.html',
1413
// #docregion style-url

public/docs/_examples/cb-aot-compiler/ts/src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Component } from '@angular/core';
33

44
@Component({
5-
moduleId: module.id,
65
selector: 'my-app',
76
templateUrl: './app.component.html'
87
})

public/docs/_examples/cb-aot-compiler/ts/src/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
<script src="node_modules/core-js/client/shim.min.js"></script>
1212
<script src="node_modules/zone.js/dist/zone.js"></script>
13-
<!-- #docregion moduleId -->
14-
<script>window.module = 'aot';</script>
15-
<!-- #enddocregion moduleId -->
1613
</head>
1714
<body>
1815
<my-app>Loading...</my-app>

public/docs/_examples/cb-component-communication/ts/src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component } from '@angular/core';
22

33
@Component({
4-
moduleId: module.id,
54
selector: 'my-app',
65
templateUrl: './app.component.html'
76
})

public/docs/_examples/cb-component-relative-paths/e2e-spec.ts

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

public/docs/_examples/cb-component-relative-paths/ts/example-config.json

Whitespace-only changes.

public/docs/_examples/cb-component-relative-paths/ts/plnkr.json

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

public/docs/_examples/cb-component-relative-paths/ts/src/app/app.component.ts

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

public/docs/_examples/cb-component-relative-paths/ts/src/app/app.module.ts

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

public/docs/_examples/cb-component-relative-paths/ts/src/app/some.component.css

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

public/docs/_examples/cb-component-relative-paths/ts/src/app/some.component.html

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

0 commit comments

Comments
 (0)