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

Commit 3983f6a

Browse files
committed
docs(cli-quickstart): add cli-quickstart chapter
1 parent aa65f0c commit 3983f6a

33 files changed

+574
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Language: JavaScript
2+
BasedOnStyle: Google
3+
ColumnLimit: 100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
7+
# dependencies
8+
/node_modules
9+
/bower_components
10+
11+
# IDEs and editors
12+
/.idea
13+
14+
# misc
15+
/.sass-cache
16+
/connect.lock
17+
/coverage/*
18+
/libpeerconnection.log
19+
npm-debug.log
20+
testem.log
21+
/typings
22+
23+
# e2e
24+
/e2e/*.js
25+
/e2e/*.map
26+
27+
#System Files
28+
.DS_Store
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* global require, module */
2+
3+
var Angular2App = require('angular-cli/lib/broccoli/angular2-app');
4+
5+
module.exports = function(defaults) {
6+
return new Angular2App(defaults, {
7+
vendorNpmFiles: [
8+
'systemjs/dist/system-polyfills.js',
9+
'systemjs/dist/system.src.js',
10+
'zone.js/dist/*.js',
11+
'es6-shim/es6-shim.js',
12+
'reflect-metadata/*.js',
13+
'rxjs/**/*.js',
14+
'@angular/**/*.js'
15+
]
16+
});
17+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.1",
4+
"name": "angular2-cli-quickstart"
5+
},
6+
"apps": [
7+
{"main": "src/main.ts", "tsconfig": "src/tsconfig.json"}
8+
],
9+
"addons": [],
10+
"packages": [],
11+
"e2e": {
12+
"protractor": {
13+
"config": "config/protractor.conf.js"
14+
}
15+
},
16+
"test": {
17+
"karma": {
18+
"config": "config/karma.conf.js"
19+
}
20+
},
21+
"defaults": {
22+
"prefix": "app",
23+
"sourceDir": "src"
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: false
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* jshint node: true */
2+
3+
module.exports = function(environment) {
4+
return {
5+
environment: environment,
6+
baseURL: '/',
7+
locationType: 'auto'
8+
};
9+
};
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*global jasmine */
2+
var SpecReporter = require('jasmine-spec-reporter');
3+
4+
exports.config = {
5+
allScriptsTimeout: 11000,
6+
specs: [
7+
'../e2e/**/*.e2e.ts'
8+
],
9+
capabilities: {
10+
'browserName': 'chrome'
11+
},
12+
directConnect: true,
13+
baseUrl: 'http://localhost:4200/',
14+
framework: 'jasmine',
15+
jasmineNodeOpts: {
16+
showColors: true,
17+
defaultTimeoutInterval: 30000,
18+
print: function() {}
19+
},
20+
useAllAngular2AppRoots: true,
21+
beforeLaunch: function() {
22+
require('ts-node').register({
23+
project: 'e2e'
24+
});
25+
},
26+
onPrepare: function() {
27+
jasmine.getEnv().addReporter(new SpecReporter());
28+
}
29+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Angular2CliQuickstartPage } from './app.po';
2+
3+
describe('angular2-cli-quickstart App', function() {
4+
let page: Angular2CliQuickstartPage;
5+
6+
beforeEach(() => {
7+
page = new Angular2CliQuickstartPage();
8+
})
9+
10+
// #docregion title
11+
it('should display message saying app works', () => {
12+
page.navigateTo();
13+
expect(page.getParagraphText()).toEqual('My First Angular 2 App');
14+
});
15+
// #enddocregion title
16+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export class Angular2CliQuickstartPage {
2+
navigateTo() {
3+
return browser.get('/');
4+
}
5+
6+
getParagraphText() {
7+
return element(by.css('angular2-cli-quickstart-app h1')).getText();
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../typings/main.d.ts" />

public/docs/_examples/cli-quickstart/ts/public/.gitignore

Whitespace-only changes.

public/docs/_examples/cli-quickstart/ts/public/.npmignore

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* #docregion */
2+
h1 {
3+
color: #369;
4+
font-family: Arial, Helvetica, sans-serif;
5+
font-size: 250%;
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>
2+
{{title}}
3+
</h1>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {
2+
beforeEachProviders,
3+
describe,
4+
expect,
5+
it,
6+
inject
7+
} from '@angular/core/testing';
8+
import { Angular2CliQuickstartAppComponent } from '../app/angular2-cli-quickstart.component';
9+
10+
beforeEachProviders(() => [Angular2CliQuickstartAppComponent]);
11+
12+
describe('App: Angular2CliQuickstart', () => {
13+
it('should create the app',
14+
inject([Angular2CliQuickstartAppComponent], (app: Angular2CliQuickstartAppComponent) => {
15+
expect(app).toBeTruthy();
16+
}));
17+
18+
// #docregion title
19+
it('should have as title \'My First Angular 2 App\'',
20+
inject([Angular2CliQuickstartAppComponent], (app: Angular2CliQuickstartAppComponent) => {
21+
expect(app.title).toEqual('My First Angular 2 App');
22+
}));
23+
// #enddocregion title
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: 'angular2-cli-quickstart-app',
6+
templateUrl: 'angular2-cli-quickstart.component.html',
7+
styleUrls: ['angular2-cli-quickstart.component.css']
8+
})
9+
// #docregion title
10+
export class Angular2CliQuickstartAppComponent {
11+
title = 'My First Angular 2 App';
12+
}
13+
// #enddocregion title
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// The file for the current environment will overwrite this one during build
2+
// Different environments can be found in config/environment.{dev|prod}.ts
3+
// The build system defaults to the dev environment
4+
5+
export const environment = {
6+
production: false
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export {environment} from './environment';
2+
export {Angular2CliQuickstartAppComponent} from './angular2-cli-quickstart.component';

public/docs/_examples/cli-quickstart/ts/src/app/shared/index.ts

Whitespace-only changes.
Binary file not shown.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Angular2CliQuickstart</title>
6+
<base href="/">
7+
{{content-for 'head'}}
8+
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
11+
<!-- Service worker support is disabled by default.
12+
Install the worker script and uncomment to enable.
13+
Only enable service workers in production.
14+
<script type="text/javascript">
15+
if ('serviceWorker' in navigator) {
16+
navigator.serviceWorker.register('/worker.js').catch(function(err) {
17+
console.log('Error installing service worker: ', err);
18+
});
19+
}
20+
</script>
21+
-->
22+
</head>
23+
<body>
24+
<angular2-cli-quickstart-app>Loading...</angular2-cli-quickstart-app>
25+
26+
<script src="vendor/es6-shim/es6-shim.js"></script>
27+
<script src="vendor/reflect-metadata/Reflect.js"></script>
28+
<script src="vendor/systemjs/dist/system.src.js"></script>
29+
<script src="vendor/zone.js/dist/zone.js"></script>
30+
31+
<script>
32+
System.import('system-config.js').then(function () {
33+
System.import('main');
34+
}).catch(console.error.bind(console));
35+
</script>
36+
</body>
37+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { bootstrap } from '@angular/platform-browser-dynamic';
2+
import { enableProdMode } from '@angular/core';
3+
import { Angular2CliQuickstartAppComponent, environment } from './app/';
4+
5+
if (environment.production) {
6+
enableProdMode();
7+
}
8+
9+
bootstrap(Angular2CliQuickstartAppComponent);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "Angular2 Cli Quickstart",
3+
"icons": [
4+
{
5+
"src": "icon.png",
6+
"sizes": "96x96",
7+
"type": "image/png"
8+
}
9+
],
10+
"start_url": "/index.html",
11+
"display": "standalone",
12+
"orientation": "portrait"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/***********************************************************************************************
2+
* User Configuration.
3+
**********************************************************************************************/
4+
/** Map relative paths to URLs. */
5+
const map: any = {
6+
};
7+
8+
/** User packages configuration. */
9+
const packages: any = {
10+
};
11+
12+
////////////////////////////////////////////////////////////////////////////////////////////////
13+
/***********************************************************************************************
14+
* Everything underneath this line is managed by the CLI.
15+
**********************************************************************************************/
16+
const barrels: string[] = [
17+
// Angular specific barrels.
18+
'@angular/core',
19+
'@angular/common',
20+
'@angular/compiler',
21+
'@angular/http',
22+
'@angular/router',
23+
'@angular/platform-browser',
24+
'@angular/platform-browser-dynamic',
25+
26+
// Thirdparty barrels.
27+
'rxjs',
28+
29+
// App specific barrels.
30+
'app',
31+
'app/shared',
32+
/** @cli-barrel */
33+
];
34+
35+
const cliSystemConfigPackages: any = {};
36+
barrels.forEach((barrelName: string) => {
37+
cliSystemConfigPackages[barrelName] = { main: 'index' };
38+
});
39+
40+
/** Type declaration for ambient System. */
41+
declare var System: any;
42+
43+
// Apply the CLI SystemJS configuration.
44+
System.config({
45+
map: {
46+
'@angular': 'vendor/@angular',
47+
'rxjs': 'vendor/rxjs',
48+
'main': 'main.js'
49+
},
50+
packages: cliSystemConfigPackages
51+
});
52+
53+
// Apply the user's configuration.
54+
System.config({ map, packages });
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference path="../typings/browser.d.ts" />
2+
3+
declare var module: { id: string };

0 commit comments

Comments
 (0)