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

Commit 18da809

Browse files
filipesilvawardbell
authored andcommitted
docs(cli-quickstart): add cli-quickstart chapter
1 parent 2dc6018 commit 18da809

38 files changed

+646
-5
lines changed

gulpfile.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,19 @@ function findAndRunE2eTests(filter) {
167167
// fileName; then shut down the example. All protractor output is appended
168168
// to the outputFile.
169169
function runE2eTsTests(appDir, protractorConfigFilename, outputFile) {
170-
// start the app
171-
var appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
172-
var tscRunSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
170+
// spawn tasks to start the app
171+
var appBuildSpawnInfo;
172+
var appRunSpawnInfo;
173+
174+
if (fs.existsSync(path.join(appDir, 'angular-cli.json'))) {
175+
appBuildSpawnInfo = spawnExt('npm',['run','build:cli'], { cwd: appDir });
176+
appRunSpawnInfo = spawnExt('npm',['run','http-server:cli', '--', '-s' ], { cwd: appDir });
177+
} else {
178+
appBuildSpawnInfo = spawnExt('npm',['run','tsc'], { cwd: appDir });
179+
appRunSpawnInfo = spawnExt('npm',['run','http-server:e2e', '--', '-s' ], { cwd: appDir });
180+
}
173181

174-
return runProtractor(tscRunSpawnInfo.promise, appDir, appRunSpawnInfo, protractorConfigFilename, outputFile);
182+
return runProtractor(appBuildSpawnInfo.promise, appDir, appRunSpawnInfo, protractorConfigFilename, outputFile);
175183
}
176184

177185
function runProtractor(prepPromise, appDir, appRunSpawnInfo, protractorConfigFilename, outputFile) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// gulp run-e2e-tests --filter=cli-quickstart
2+
describe('angular2-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('angular2-cli-quickstart-app h1')).getText()
9+
expect(pageTitle).toEqual('My First Angular 2 App');
10+
});
11+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Language: JavaScript
2+
BasedOnStyle: Google
3+
ColumnLimit: 100
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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
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',
11+
'es6-shim/es6-shim.js',
12+
'reflect-metadata/*.js',
13+
'rxjs/**/*.js',
14+
'@angular/**/*.js'
15+
]
16+
});
17+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.4",
4+
"name": "angular2-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+
}
30+
}
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: 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)