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

Commit ab8e8ed

Browse files
committed
docs(cb-third-party-lib) create a third party lib
s s s s s c s c s s s s s s s s s s s s s s s s s s s s s s s s s
1 parent 74ef87f commit ab8e8ed

30 files changed

+728
-3
lines changed

gulpfile.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ var regularPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/regularPl
5151
var embeddedPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/embeddedPlunker'));
5252
var fsUtils = require(path.resolve(TOOLS_PATH, 'fs-utils/fsUtils'));
5353

54+
var publish = require(path.resolve(EXAMPLES_PATH + '/cb-third-party-lib/hero-profile/publish'));
55+
5456
const WWW = argv.page ? 'www-pages' : 'www'
5557

5658
const isSilent = !!argv.silent;
@@ -464,7 +466,9 @@ gulp.task('add-example-boilerplate', function(done) {
464466
fsUtils.addSymlink(realPath, linkPath);
465467
});
466468

467-
return buildStyles(copyExampleBoilerplate, done);
469+
publish().then(function(){
470+
return buildStyles(copyExampleBoilerplate, done);
471+
});
468472
});
469473

470474

public/docs/_examples/_boilerplate/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
1919
"build:cli": "ng build",
2020
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
21+
"build:aot:jit": "npm run build:aot && npm run tsc",
2122
"copy-dist-files": "node ./copy-dist-files.js",
2223
"i18n": "ng-xi18n"
2324
},

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
// other libraries
2828
'rxjs': 'npm:rxjs',
29-
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
29+
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
30+
'hero-profile': 'npm:hero-profile/bundles/hero-profile.umd.js'
3031
},
3132
// packages tells the System loader how to load when no filename and/or no extension
3233
packages: {

public/docs/_examples/_boilerplate/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"compileOnSave": true,
1717
"exclude": [
1818
"node_modules/*",
19-
"**/*-aot.ts"
19+
"**/*-aot.ts",
20+
"app-aot"
2021
]
2122
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**/*.ngfactory.ts
2+
**/*.metadata.json
3+
**/*.css.shim.ts
4+
*.js
5+
!/hero-profile/rollup-config.js
6+
!/hero-profile/publish.js
7+
!/hero-profile/inline-resources.js
8+
!/hero-profile/package.json
9+
!ts/rollup-config.js
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'; // necessary for es6 output in node
2+
3+
import { browser, element, by } from 'protractor';
4+
5+
describe('Third Party Lib Cookbook', function () {
6+
7+
let expectedMsgAoT = 'Library consumed by AoT application';
8+
let expectedMsgJiT = 'Library consumed by JiT application';
9+
10+
beforeEach(function () {
11+
browser.get('');
12+
});
13+
14+
it(`should load AoT compiled version`, function () {
15+
expect(element(by.css('.aot')).getText()).toEqual(expectedMsgAoT);
16+
});
17+
18+
it('should load JiT compiled version', function () {
19+
expect(element(by.css('.jit')).getText()).toEqual(expectedMsgJiT);
20+
});
21+
22+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*#docregion*/
2+
.bio {
3+
border: 1px solid black;
4+
padding: 10px;
5+
width: 300px;
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!--#docregion-->
2+
<div class="bio">
3+
<h1>Featured Hero</h1>
4+
5+
<h3>{{hero.name}}</h3>
6+
<div>{{hero.bio}}</div>
7+
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// #docregion
2+
import { Component, Input } from '@angular/core';
3+
4+
import { Hero } from './hero';
5+
6+
@Component({
7+
moduleId: module.id,
8+
selector: 'hero-profile',
9+
templateUrl: 'hero-profile.component.html',
10+
styleUrls: ['hero-profile.component.css']
11+
})
12+
export class HeroProfileComponent {
13+
@Input() hero: Hero;
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// #docregion
2+
import { NgModule } from '@angular/core';
3+
4+
import { HeroProfileComponent } from './hero-profile.component';
5+
6+
@NgModule({
7+
declarations: [HeroProfileComponent],
8+
exports: [HeroProfileComponent]
9+
})
10+
export class HeroProfileModule {
11+
12+
}

0 commit comments

Comments
 (0)