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

Commit fb49cbe

Browse files
Foxandxsswardbell
authored andcommitted
docs(cli-quickstart): add cli 5 min quickstart
closes #1606
1 parent f3205f5 commit fb49cbe

31 files changed

+672
-7
lines changed

gulpfile.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,19 @@ function findAndRunE2eTests(filter, outputFile) {
221221
// fileName; then shut down the example. All protractor output is appended
222222
// to the outputFile.
223223
function runE2eTsTests(appDir, outputFile) {
224-
// start the app
225-
var appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
226-
var tscRunSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
224+
// spawn tasks to start the app
225+
var appBuildSpawnInfo;
226+
var appRunSpawnInfo;
227227

228-
return runProtractor(tscRunSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
228+
if (fs.existsSync(path.join(appDir, 'angular-cli.json'))) {
229+
appBuildSpawnInfo = spawnExt('npm', ['run', 'build:cli'], { cwd: appDir });
230+
appRunSpawnInfo = spawnExt('npm', ['run', 'http-server:cli', '--', '-s'], { cwd: appDir });
231+
} else {
232+
appBuildSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
233+
appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
234+
}
235+
236+
return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, outputFile);
229237
}
230238

231239
function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path="../_protractor/e2e.d.ts" />
2+
describe('cli-quickstart App', () => {
3+
beforeEach(() => {
4+
return browser.get('/');
5+
})
6+
7+
it('should display message saying app works', () => {
8+
var pageTitle = element(by.css('cli-quickstart-app h1')).getText()
9+
expect(pageTitle).toEqual('My First Angular 2 App');
10+
});
11+
});
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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
29+
Thumbs.db
30+
31+
# angular.io overrides
32+
!angular-cli.json
33+
!angular-cli-build.js
34+
!config/environment.js
35+
!config/karma-test.js
36+
!config/karma.conf.js
37+
!config/protractor.conf.js
38+
!src/typings.d.ts
Lines changed: 17 additions & 0 deletions
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|js.map)',
11+
'es6-shim/es6-shim.js',
12+
'reflect-metadata/**/*.+(js|js.map)',
13+
'rxjs/**/*.+(js|js.map)',
14+
'@angular/**/*.+(js|js.map)'
15+
]
16+
});
17+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.5",
4+
"name": "cli-quickstart"
5+
},
6+
"apps": [
7+
{
8+
"main": "src/main.ts",
9+
"tsconfig": "src/tsconfig.json",
10+
"mobile": false
11+
}
12+
],
13+
"addons": [],
14+
"packages": [],
15+
"e2e": {
16+
"protractor": {
17+
"config": "config/protractor.conf.js"
18+
}
19+
},
20+
"test": {
21+
"karma": {
22+
"config": "config/karma.conf.js"
23+
}
24+
},
25+
"defaults": {
26+
"prefix": "app",
27+
"sourceDir": "src",
28+
"styleExt": "css",
29+
"prefixInterfaces": false
30+
}
31+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: false
3+
};
Lines changed: 10 additions & 0 deletions
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+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module.exports = function (config) {
2+
config.set({
3+
basePath: '..',
4+
frameworks: ['jasmine'],
5+
plugins: [
6+
require('karma-jasmine'),
7+
require('karma-chrome-launcher')
8+
],
9+
customLaunchers: {
10+
// chrome setup for travis CI using chromium
11+
Chrome_travis_ci: {
12+
base: 'Chrome',
13+
flags: ['--no-sandbox']
14+
}
15+
},
16+
files: [
17+
{ pattern: 'dist/vendor/es6-shim/es6-shim.js', included: true, watched: false },
18+
{ pattern: 'dist/vendor/zone.js/dist/zone.js', included: true, watched: false },
19+
{ pattern: 'dist/vendor/reflect-metadata/Reflect.js', included: true, watched: false },
20+
{ pattern: 'dist/vendor/systemjs/dist/system-polyfills.js', included: true, watched: false },
21+
{ pattern: 'dist/vendor/systemjs/dist/system.src.js', included: true, watched: false },
22+
{ pattern: 'dist/vendor/zone.js/dist/async-test.js', included: true, watched: false },
23+
24+
{ pattern: 'config/karma-test-shim.js', included: true, watched: true },
25+
26+
// Distribution folder.
27+
{ pattern: 'dist/**/*', included: false, watched: true }
28+
],
29+
exclude: [
30+
// Vendor packages might include spec files. We don't want to use those.
31+
'dist/vendor/**/*.spec.js'
32+
],
33+
preprocessors: {},
34+
reporters: ['progress'],
35+
port: 9876,
36+
colors: true,
37+
logLevel: config.LOG_INFO,
38+
autoWatch: true,
39+
browsers: ['Chrome'],
40+
singleRun: false
41+
});
42+
};
Lines changed: 29 additions & 0 deletions
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+
};

0 commit comments

Comments
 (0)