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

New cb third party lib #3411

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
76c99e9
docs(cb-third-party-lib) create a third party lib
thelgevold Oct 16, 2016
38a9000
addressing PR review items
thelgevold Nov 7, 2016
21bc5eb
minor copy-edits
filipesilva Feb 28, 2017
e1423e7
update example
filipesilva Mar 2, 2017
9435b65
add intro, download
filipesilva Mar 22, 2017
1f24d04
add core file descriptions
filipesilva Mar 22, 2017
ed14ce0
add entry points and build step
filipesilva Mar 22, 2017
423e6f5
add testing
filipesilva Mar 22, 2017
a73370f
add publishing
filipesilva Mar 22, 2017
4fce4b8
add AOT and JIT appendix
filipesilva Mar 22, 2017
8657312
remove old example
filipesilva Mar 22, 2017
9bbc128
whitespace
filipesilva Mar 22, 2017
274a207
add v4 message
filipesilva Mar 22, 2017
0f65921
add dep management
filipesilva Mar 22, 2017
e2e7738
whitespace
filipesilva Mar 22, 2017
aef571f
add externals/globals note
filipesilva Mar 22, 2017
5bf5337
fix headers
filipesilva Mar 22, 2017
3ef8d45
add example
filipesilva Mar 22, 2017
d38aedc
remove unused changes
filipesilva Mar 22, 2017
2e9bfbd
spelling
filipesilva Mar 23, 2017
97a7df0
line breaks
filipesilva Mar 23, 2017
24455bc
emphasize package format over starter
filipesilva Mar 23, 2017
d0f6209
put aot first
filipesilva Mar 23, 2017
50cbb91
add note about customization
filipesilva Mar 23, 2017
59a80e0
add preliminary folder structure
filipesilva Mar 23, 2017
c5e7de3
update folder struture
filipesilva Mar 23, 2017
e9e8898
add a couple more points to library maintenance
filipesilva Mar 23, 2017
9961bdc
rename a file
filipesilva Mar 23, 2017
c121cb3
add sourcemaps note
filipesilva Mar 23, 2017
31b1f50
add consumer table
filipesilva Mar 23, 2017
f801cfd
update layout, add checklist
filipesilva Mar 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dist/
node_modules/
out-tsc/
debug.log
npm-debug.log
src/**/*.js
!src/demo/systemjs.config.js
!src/demo/systemjs.config.lib.js
*.js.map
e2e/**/*.js
e2e/**/*.js.map
8 changes: 8 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore eveything by default.
/*

# Only publish these files/folders:
!dist/
!LICENSE
!package.json
!README.md
21 changes: 21 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2014-2016 Google, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
25 changes: 25 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Angular QuickStart Lib
[![Build Status][travis-badge]][travis-badge-url]

This is a simple library quickstart for Angular libraries.

Features:
- a simple a library
- unit tests for the library
- a demo application that consumes the library in JIT mode and runs in watch mode
- an integration app that consumes the library in JIT and AOT mode and runs e2e tests

Common tasks are present as npm scripts:

- `npm start` to run a live-reload server with the demo app
- `npm run test` to test in watch mode, or `npm run test:once` to only run once
- `npm run build` to build the library
- `npm run lint` to lint
- `npm run clean` to clean
- `npm run integration` to run the integration e2e tests
- `npm install ./relative/path/to/lib` after `npm run build` to test locally in another app

If you need to debug the integration app, please check `./integration/README.md`.

[travis-badge]: https://travis-ci.org/filipesilva/angular-quickstart-lib.svg?branch=master
[travis-badge-url]: https://travis-ci.org/filipesilva/angular-quickstart-lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
npm-debug.log
src/**/*.js
!src/systemjs.config.js
*.js.map
e2e/**/*.js
e2e/**/*.js.map
out-tsc/*
dist/*
26 changes: 26 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/integration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Integration App

This is a simplified version of https://github.com/angular/quickstart used to test the built lib.

## npm scripts

We've captured many of the most useful commands in npm scripts defined in the `package.json`:

* `npm start` - runs the compiler and a server at the same time, both in "watch mode".
* `npm run e2e` - compiles the app and run e2e tests.
* `npm run e2e:aot` - compiles and the app with AOT and run e2e tests.


If you need to manually test a library build, follow these steps:
```
# starting at the project root, build the library
npm run build
# clean the integration app
npm run preintegration
cd integration
npm install
```

Now the library is installed in your integration app.

You can use `npm start` to start a live reload server running the app in JIT mode, or `npm run build && npm run serve:aot` to run a static server in AOT mode.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"server": {
"baseDir": "dist"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"open": false,
"logLevel": "silent",
"port": 8080,
"server": {
"baseDir": "dist",
"middleware": {
"0": null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"open": false,
"logLevel": "silent",
"port": 8080,
"server": {
"baseDir": "src",
"routes": {
"/node_modules": "node_modules"
},
"middleware": {
"0": null
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"server": {
"baseDir": "src",
"routes": {
"/node_modules": "node_modules"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { browser, element, by } from 'protractor';

describe('QuickStart Lib E2E Tests', function () {

beforeEach(() => browser.get(''));

afterEach(() => {
browser.manage().logs().get('browser').then((browserLog: any[]) => {
expect(browserLog).toEqual([]);
});
});

it('should display lib', () => {
expect(element(by.css('h2')).getText()).toEqual('Hello Angular Library');
});

it('should display meaning', () => {
expect(element(by.css('h3')).getText()).toEqual('Meaning is: 42');
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
55 changes: 55 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "integration-test",
"version": "1.0.0",
"description": "App for integration tests",
"scripts": {
"clean": "rimraf aot/ dist/ node_modules/angular-quickstart-lib/",
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"build:aot": "node build.js",
"serve": "lite-server -c=bs-config.json",
"serve:aot": "lite-server -c bs-config.aot.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"serve:e2e-aot": "lite-server -c bs-config.e2e-aot.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e && npm run build",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"pree2e:aot": "npm run build:e2e && npm run build:aot",
"e2e:aot": "concurrently \"npm run serve:e2e-aot\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "^4.0.0-rc.3",
"@angular/compiler": "^4.0.0-rc.3",
"@angular/compiler-cli": "^4.0.0-rc.3",
"@angular/core": "^4.0.0-rc.3",
"@angular/platform-browser": "^4.0.0-rc.3",
"@angular/platform-browser-dynamic": "^4.0.0-rc.3",
"angular-quickstart-lib": "../",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/jasmine": "2.5.36",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"glob": "^7.1.1",
"lite-server": "^2.2.2",
"protractor": "~5.1.0",
"rimraf": "^2.5.4",
"rollup": "^0.41.4",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"typescript": "^2.0.10"
},
"repository": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Component } from '@angular/core';
import { LibService } from 'angular-quickstart-lib';

@Component({
selector: 'integration-app',
template: `
<my-lib></my-lib>
<h3>Meaning is: {{meaning}}</h3>
`,
})
export class AppComponent {
meaning: number;
constructor(libService: LibService) {
this.meaning = libService.getMeaning();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LibModule } from 'angular-quickstart-lib';

import { AppComponent } from './app.component';

@NgModule({
imports: [ BrowserModule, LibModule],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">

<!-- Workaround for module.id -->
<script>window.module = 'aot';</script>
</head>

<body>
<integration-app>Loading...</integration-app>
</body>
<script src="bundle.js"></script>
</html>
25 changes: 25 additions & 0 deletions public/docs/_examples/quickstart-lib/ts/integration/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">

<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>

<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>

<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>

<body>
<integration-app>Loading AppComponent content here ...</integration-app>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModuleNgFactory } from '../out-tsc/src/app/app.module.ngfactory';

platformBrowserDynamic().bootstrapModuleFactory(AppModuleNgFactory);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h1 {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: 250%;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',

// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'angular-quickstart-lib': 'npm:angular-quickstart-lib/dist/angular-quickstart-lib.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"main-aot.ts"
]
}
Loading