diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b8a6e57
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,19 @@
+# http://editorconfig.org
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+
+[*.md]
+max_line_length = 0
+trim_trailing_whitespace = false
+
+# Indentation override
+#[lib/**.js]
+#[{package.json,.travis.yml}]
+#[**/**.js]
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9b3a09f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+.idea
+node_modules
+jspm_packages
+npm-debug.log
+debug.log
+src/**/*.js
+!src/systemjs.config.extras.js
+!src/systemjs.config.js
+!src/systemjs-angular-loader.js
+*.js.map
+e2e/**/*.js
+e2e/**/*.js.map
+_test-output
+_temp
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..808bc2c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,20 @@
+dist: trusty
+sudo: required
+language: node_js
+node_js:
+ - "5"
+os:
+ - linux
+env:
+ global:
+ - DBUS_SESSION_BUS_ADDRESS=/dev/null
+ - DISPLAY=:99.0
+ - CHROME_BIN=chromium-browser
+before_script:
+ - sh -e /etc/init.d/xvfb start
+install:
+ - npm install
+script:
+ - npm run lint
+ - npm run test:once
+ - npm run e2e
diff --git a/AngularJS b/AngularJS
deleted file mode 160000
index 456b849..0000000
--- a/AngularJS
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 456b849692ade45c4f58fc80c65ee23c99dc9190
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..4c991b1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,213 @@
+## Angular Documentation QuickStart Changelog
+Upgraders: for a fresh start, consider running these commands
+* `git clean -xdf`
+* `npm install`
+
+
+# 0.4.1 (2017-03-24)
+* Replace systemjs-angular-loader with version that works for IE
+
+
+# 0.4.0 (2017-03-24)
+* Update to Angular 4.0.0
+
+
+# 0.3.0 (2017-03-22)
+* Remove moduleId with a systemjs loader.
+
+
+# 0.2.22 (2017-01-05)
+* Add `non-essential-files.txt` and instructions to use it to README
+
+
+# 0.2.21 (2016-12-14)
+* Update to in-memory-web-api v.0.2.1
+
+
+# 0.2.20 (2016-12-07)
+* Update to Angular 2.3.0
+
+
+# 0.2.19 (2016-11-30)
+* remove upgrade mappings from `systemjs.config.js` PR #301
+
+
+# 0.2.18 (2016-11-30)
+* remove `exclude` clause from `tsconfig.json`; it was just confusing people
+* karma.config + karma-test-shim can handle multiple spec source paths (issue #294)
+* cosmetic `app.component.spec.ts` changes
+* cosmetic `karma.config.js` changes
+
+
+# 0.2.17 (2016-11-16)
+* Conform to updated QuickStart advice
+ * removed docker everywhere (was nice but not necessary)
+ * removed wallaby
+ * shrink styles.css
+ * refine tsconfig.json
+ * `AppComponent` uses interpolation
+
+
+# 0.2.16 (2016-11-14)
+* Update to Angular 2.2.0
+
+
+# 0.2.15 (2016-10-29)
+* Revert to Jasmine 2.4.1 because bug in 2.5.x (see [jasmine issue #1231](https://github.com/jasmine/jasmine/issues/1231))
+
+
+# 0.2.14 (2016-10-29)
+* Remove bootstrap.css install
+* Angular v2.1.2
+
+
+# 0.2.13 (2016-10-20)
+* Protractor 4
+* Move from `typings` to `@types`. See `tsconfig.json` changes.
+* Angular v2.1.1
+
+
+# 0.2.12 (2016-10-06)
+* Angular v2.1.0
+
+
+# 0.2.11 (2016-10-06)
+* Angular v2.0.2
+* License is MIT
+* Current testing configuration
+* No code changes
+
+
+# 0.2.10 (2016-09-19)
+* All "Angular 2" references become just "Angular"
+* No code changes
+
+
+# 0.2.9 (2016-09-14)
+* Angular 2.0.0 version
+* Update to Typescript 2.0.2
+* Fix e2e test missing dir
+
+
+# 0.2.8 (2016-09-01)
+* remove @angular test libraries from system.js (now in shim)
+* update test related files
+* wallaby doesn't completely work. Researching.
+
+
+# 0.2.7 (2016-08-31)
+* Angular 2 RC6 version
+* Updated new forms, router, angular2-in-memory-web-api, karma, core-js, rxjs and zone.js packages
+* Removed router-deprecated package
+* Updated karma.conf.js and systemjs.config.js
+
+
+# 0.2.6 (2016-08-09)
+* Angular 2 RC5 version
+* Updated new forms, router and angular2-in-memory-web-api
+
+
+# 0.2.5 (2016-06-30)
+* Angular 2 RC4 version
+* Updated new forms and router
+
+
+# 0.2.4 (2016-06-21)
+* Angular 2 RC3 version
+* Add new forms and router
+* Add support for TS e2e tests
+
+
+# 0.2.3 (2016-06-15)
+* Angular 2 RC2 version
+
+
+# 0.2.2 (2016-05-21)
+* Update to Typings 1.x
+
+
+# 0.2.1 (2016-05-03)
+* Angular 2 RC01 version
+
+
+# 0.2.0 (2016-05-02)
+* Angular 2 RC0 version
+
+
+# 0.1.17 (2016-04-29)
+* update packages
+ * Angular 2 beta 17
+ * RxJS 5.0.0-beta.6
+ * a2-in-memory-web-api 0.1.17
+
+
+# 0.1.16 (2016-04-26)
+* update packages
+ * Angular 2 beta 16
+ * a2-in-memory-web-api 0.1.6
+ * protractor 3.3.0
+ * typings 0.8.1
+ * zone.js 0.6.12
+
+ * added favicon.ico
+
+ * testing
+ - updated wallaby.js and karma.conf.js
+ - updated app.component.spec.ts
+
+
+
+# 0.1.15 (2016-04-13)
+* Add testing support
+ * npm scripts
+ * karma/jasmine
+ * protractor
+
+* update packages
+ * Angular 2 beta 15
+ * lite-server 2.2.0
+ * systemjs 0.19.26
+ * typescript 1.8.10
+ * typings 0.7.12
+
+* add run packages
+ * a2-in-memory-web-api
+
+* add testing dev-dependency packages
+ * canonical-path: 0.0.2,
+ * http-server: ^0.9.0,
+ * jasmine-core: ~2.4.1,
+ * karma: ^0.13.22,
+ * karma-chrome-launcher: ^0.2.3,
+ * karma-cli: ^0.1.2,
+ * karma-htmlfile-reporter: ^0.2.2,
+ * karma-jasmine: ^0.3.8,
+ * protractor: ^3.2.2,
+ * rimraf: ^2.5.2
+
+
+# 0.1.14 (2016-04-07)
+* update packages
+ * Angular 2 beta 14
+ * lite-server 2.2.0
+ * typings 0.7.12
+
+
+# 0.1.13 (2016-03-31)
+* update packages
+ * Angular 2 beta 13
+
+
+# 0.1.12 (2016-03-23)
+* update packages
+ * Angular 2 beta 12
+ * zones 0.6.6
+* remove es6-promise because no longer needed.
+
+
+# 0.1.11 (2016-03-18)
+* update packages
+ * Angular 2 beta 11
+ * zones 0.6.4
+ * typescript 1.8.9
+ * typings 0.7.9
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..51b127e
--- /dev/null
+++ b/LICENSE
@@ -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.
diff --git a/bs-config.e2e.json b/bs-config.e2e.json
new file mode 100644
index 0000000..24570db
--- /dev/null
+++ b/bs-config.e2e.json
@@ -0,0 +1,14 @@
+{
+ "open": false,
+ "logLevel": "silent",
+ "port": 8080,
+ "server": {
+ "baseDir": "src",
+ "routes": {
+ "/node_modules": "node_modules"
+ },
+ "middleware": {
+ "0": null
+ }
+ }
+}
diff --git a/bs-config.json b/bs-config.json
new file mode 100644
index 0000000..4e58595
--- /dev/null
+++ b/bs-config.json
@@ -0,0 +1,8 @@
+{
+ "server": {
+ "baseDir": "src",
+ "routes": {
+ "/node_modules": "node_modules"
+ }
+ }
+}
diff --git a/e2e/app.e2e-spec.ts b/e2e/app.e2e-spec.ts
new file mode 100644
index 0000000..67f5d8d
--- /dev/null
+++ b/e2e/app.e2e-spec.ts
@@ -0,0 +1,15 @@
+import { browser, element, by } from 'protractor';
+
+describe('QuickStart E2E Tests', function () {
+
+ let expectedMsg = 'Hello Angular';
+
+ beforeEach(function () {
+ browser.get('');
+ });
+
+ it('should display: ' + expectedMsg, function () {
+ expect(element(by.css('h1')).getText()).toEqual(expectedMsg);
+ });
+
+});
diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json
new file mode 100644
index 0000000..2c7260d
--- /dev/null
+++ b/e2e/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": [ "es2015", "dom" ],
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors": true
+ }
+}
diff --git a/karma-test-shim.js b/karma-test-shim.js
new file mode 100644
index 0000000..fe5aa77
--- /dev/null
+++ b/karma-test-shim.js
@@ -0,0 +1,96 @@
+// /*global jasmine, __karma__, window*/
+Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing.
+
+// Uncomment to get full stacktrace output. Sometimes helpful, usually not.
+// Error.stackTraceLimit = Infinity; //
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
+
+// builtPaths: root paths for output ("built") files
+// get from karma.config.js, then prefix with '/base/' (default is 'src/')
+var builtPaths = (__karma__.config.builtPaths || ['src/'])
+ .map(function(p) { return '/base/'+p;});
+
+__karma__.loaded = function () { };
+
+function isJsFile(path) {
+ return path.slice(-3) == '.js';
+}
+
+function isSpecFile(path) {
+ return /\.spec\.(.*\.)?js$/.test(path);
+}
+
+// Is a "built" file if is JavaScript file in one of the "built" folders
+function isBuiltFile(path) {
+ return isJsFile(path) &&
+ builtPaths.reduce(function(keep, bp) {
+ return keep || (path.substr(0, bp.length) === bp);
+ }, false);
+}
+
+var allSpecFiles = Object.keys(window.__karma__.files)
+ .filter(isSpecFile)
+ .filter(isBuiltFile);
+
+System.config({
+ // Base URL for System.js calls. 'base/' is where Karma serves files from.
+ baseURL: 'base/src',
+ // Extend usual application package list with test folder
+ packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } },
+
+ // Assume npm: is set in `paths` in systemjs.config
+ // Map the angular testing umd bundles
+ map: {
+ '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
+ '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
+ '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
+ '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
+ '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
+ '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
+ '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
+ '@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js',
+ },
+});
+
+System.import('systemjs.config.js')
+ .then(importSystemJsExtras)
+ .then(initTestBed)
+ .then(initTesting);
+
+/** Optional SystemJS configuration extras. Keep going w/o it */
+function importSystemJsExtras(){
+ return System.import('systemjs.config.extras.js')
+ .catch(function(reason) {
+ console.log(
+ 'Warning: System.import could not load the optional "systemjs.config.extras.js". Did you omit it by accident? Continuing without it.'
+ );
+ console.log(reason);
+ });
+}
+
+function initTestBed(){
+ return Promise.all([
+ System.import('@angular/core/testing'),
+ System.import('@angular/platform-browser-dynamic/testing')
+ ])
+
+ .then(function (providers) {
+ var coreTesting = providers[0];
+ var browserTesting = providers[1];
+
+ coreTesting.TestBed.initTestEnvironment(
+ browserTesting.BrowserDynamicTestingModule,
+ browserTesting.platformBrowserDynamicTesting());
+ })
+}
+
+// Import all spec files and start karma
+function initTesting () {
+ return Promise.all(
+ allSpecFiles.map(function (moduleName) {
+ return System.import(moduleName);
+ })
+ )
+ .then(__karma__.start, __karma__.error);
+}
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644
index 0000000..5a51e81
--- /dev/null
+++ b/karma.conf.js
@@ -0,0 +1,97 @@
+module.exports = function(config) {
+
+ var appBase = 'src/'; // transpiled app JS and map files
+ var appSrcBase = appBase; // app source TS files
+
+ // Testing helpers (optional) are conventionally in a folder called `testing`
+ var testingBase = 'testing/'; // transpiled test JS and map files
+ var testingSrcBase = 'testing/'; // test source TS files
+
+ config.set({
+ basePath: '',
+ frameworks: ['jasmine'],
+
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-chrome-launcher'),
+ require('karma-jasmine-html-reporter')
+ ],
+
+ client: {
+ builtPaths: [appBase, testingBase], // add more spec base paths as needed
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
+ },
+
+ customLaunchers: {
+ // From the CLI. Not used here but interesting
+ // chrome setup for travis CI using chromium
+ Chrome_travis_ci: {
+ base: 'Chrome',
+ flags: ['--no-sandbox']
+ }
+ },
+
+ files: [
+ // System.js for module loading
+ 'node_modules/systemjs/dist/system.src.js',
+
+ // Polyfills
+ 'node_modules/core-js/client/shim.js',
+
+ // zone.js
+ 'node_modules/zone.js/dist/zone.js',
+ 'node_modules/zone.js/dist/long-stack-trace-zone.js',
+ 'node_modules/zone.js/dist/proxy.js',
+ 'node_modules/zone.js/dist/sync-test.js',
+ 'node_modules/zone.js/dist/jasmine-patch.js',
+ 'node_modules/zone.js/dist/async-test.js',
+ 'node_modules/zone.js/dist/fake-async-test.js',
+
+ // RxJs
+ { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
+ { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
+
+ // Paths loaded via module imports:
+ // Angular itself
+ { pattern: 'node_modules/@angular/**/*.js', included: false, watched: false },
+ { pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
+
+ { pattern: appBase + '/systemjs.config.js', included: false, watched: false },
+ { pattern: appBase + '/systemjs.config.extras.js', included: false, watched: false },
+ 'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels
+
+ // transpiled application & spec code paths loaded via module imports
+ { pattern: appBase + '**/*.js', included: false, watched: true },
+ { pattern: testingBase + '**/*.js', included: false, watched: true },
+
+
+ // Asset (HTML & CSS) paths loaded via Angular's component compiler
+ // (these paths need to be rewritten, see proxies section)
+ { pattern: appBase + '**/*.html', included: false, watched: true },
+ { pattern: appBase + '**/*.css', included: false, watched: true },
+
+ // Paths for debugging with source maps in dev tools
+ { pattern: appBase + '**/*.ts', included: false, watched: false },
+ { pattern: appBase + '**/*.js.map', included: false, watched: false },
+ { pattern: testingSrcBase + '**/*.ts', included: false, watched: false },
+ { pattern: testingBase + '**/*.js.map', included: false, watched: false}
+ ],
+
+ // Proxied base paths for loading assets
+ proxies: {
+ // required for modules fetched by SystemJS
+ '/base/src/node_modules/': '/base/node_modules/'
+ },
+
+ exclude: [],
+ preprocessors: {},
+ reporters: ['progress', 'kjhtml'],
+
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: true,
+ browsers: ['Chrome'],
+ singleRun: false
+ })
+}
diff --git a/non-essential-files.osx.txt b/non-essential-files.osx.txt
new file mode 100644
index 0000000..653a8db
--- /dev/null
+++ b/non-essential-files.osx.txt
@@ -0,0 +1 @@
+.git .gitignore .travis.yml bs-config.e2e.json CHANGELOG.md e2e favicon.ico karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt protractor.config.js README.md
\ No newline at end of file
diff --git a/non-essential-files.txt b/non-essential-files.txt
new file mode 100644
index 0000000..939f1df
--- /dev/null
+++ b/non-essential-files.txt
@@ -0,0 +1,15 @@
+.git
+.gitignore
+.travis.yml
+*.spec*.ts
+bs-config.e2e.json
+CHANGELOG.md
+e2e
+favicon.ico
+karma.conf.js
+karma-test-shim.js
+LICENSE
+non-essential-files.txt
+non-essential-files.osx.txt
+protractor.config.js
+README.md
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..df18ef0
--- /dev/null
+++ b/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "angular-quickstart",
+ "version": "1.0.0",
+ "description": "QuickStart package.json from the documentation, supplemented with testing support",
+ "scripts": {
+ "build": "tsc -p src/",
+ "build:watch": "tsc -p src/ -w",
+ "build:e2e": "tsc -p e2e/",
+ "serve": "lite-server -c=bs-config.json",
+ "serve:e2e": "lite-server -c=bs-config.e2e.json",
+ "prestart": "npm run build",
+ "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
+ "pree2e": "npm run build:e2e",
+ "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
+ "preprotractor": "webdriver-manager update",
+ "protractor": "protractor protractor.config.js",
+ "pretest": "npm run build",
+ "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
+ "pretest:once": "npm run build",
+ "test:once": "karma start karma.conf.js --single-run",
+ "lint": "tslint ./src/**/*.ts -t verbose"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "@angular/common": "~4.0.0",
+ "@angular/compiler": "~4.0.0",
+ "@angular/core": "~4.0.0",
+ "@angular/forms": "~4.0.0",
+ "@angular/http": "~4.0.0",
+ "@angular/platform-browser": "~4.0.0",
+ "@angular/platform-browser-dynamic": "~4.0.0",
+ "@angular/router": "~4.0.0",
+
+ "angular-in-memory-web-api": "~0.3.0",
+ "systemjs": "0.19.40",
+ "core-js": "^2.4.1",
+ "rxjs": "5.0.1",
+ "zone.js": "^0.8.4"
+ },
+ "devDependencies": {
+ "concurrently": "^3.2.0",
+ "lite-server": "^2.2.2",
+ "typescript": "~2.1.0",
+
+ "canonical-path": "0.0.2",
+ "tslint": "^3.15.1",
+ "lodash": "^4.16.4",
+ "jasmine-core": "~2.4.1",
+ "karma": "^1.3.0",
+ "karma-chrome-launcher": "^2.0.0",
+ "karma-cli": "^1.0.1",
+ "karma-jasmine": "^1.0.2",
+ "karma-jasmine-html-reporter": "^0.2.2",
+ "protractor": "~4.0.14",
+ "rimraf": "^2.5.4",
+
+ "@types/node": "^6.0.46",
+ "@types/jasmine": "2.5.36"
+ },
+ "repository": {}
+}
diff --git a/protractor.config.js b/protractor.config.js
new file mode 100644
index 0000000..8d4e041
--- /dev/null
+++ b/protractor.config.js
@@ -0,0 +1,183 @@
+// FIRST TIME ONLY- run:
+// ./node_modules/.bin/webdriver-manager update
+//
+// Try: `npm run webdriver:update`
+//
+// AND THEN EVERYTIME ...
+// 1. Compile with `tsc`
+// 2. Make sure the test server (e.g., lite-server: localhost:8080) is running.
+// 3. ./node_modules/.bin/protractor protractor.config.js
+//
+// To do all steps, try: `npm run e2e`
+
+var fs = require('fs');
+var path = require('canonical-path');
+var _ = require('lodash');
+
+
+exports.config = {
+ directConnect: true,
+
+ // Capabilities to be passed to the webdriver instance.
+ capabilities: {
+ 'browserName': 'chrome'
+ },
+
+ // Framework to use. Jasmine is recommended.
+ framework: 'jasmine',
+
+ // Spec patterns are relative to this config file
+ specs: ['**/*e2e-spec.js' ],
+
+
+ // For angular tests
+ useAllAngular2AppRoots: true,
+
+ // Base URL for application server
+ baseUrl: 'http://localhost:8080',
+
+ // doesn't seem to work.
+ // resultJsonOutputFile: "foo.json",
+
+ onPrepare: function() {
+ //// SpecReporter
+ //var SpecReporter = require('jasmine-spec-reporter');
+ //jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'none'}));
+ //// jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
+
+ // debugging
+ // console.log('browser.params:' + JSON.stringify(browser.params));
+ jasmine.getEnv().addReporter(new Reporter( browser.params )) ;
+
+ // Allow changing bootstrap mode to NG1 for upgrade tests
+ global.setProtractorToNg1Mode = function() {
+ browser.useAllAngular2AppRoots = false;
+ browser.rootEl = 'body';
+ };
+ },
+
+ jasmineNodeOpts: {
+ // defaultTimeoutInterval: 60000,
+ defaultTimeoutInterval: 10000,
+ showTiming: true,
+ print: function() {}
+ }
+};
+
+// Custom reporter
+function Reporter(options) {
+ var _defaultOutputFile = path.resolve(process.cwd(), './_test-output', 'protractor-results.txt');
+ options.outputFile = options.outputFile || _defaultOutputFile;
+
+ initOutputFile(options.outputFile);
+ options.appDir = options.appDir || './';
+ var _root = { appDir: options.appDir, suites: [] };
+ log('AppDir: ' + options.appDir, +1);
+ var _currentSuite;
+
+ this.suiteStarted = function(suite) {
+ _currentSuite = { description: suite.description, status: null, specs: [] };
+ _root.suites.push(_currentSuite);
+ log('Suite: ' + suite.description, +1);
+ };
+
+ this.suiteDone = function(suite) {
+ var statuses = _currentSuite.specs.map(function(spec) {
+ return spec.status;
+ });
+ statuses = _.uniq(statuses);
+ var status = statuses.indexOf('failed') >= 0 ? 'failed' : statuses.join(', ');
+ _currentSuite.status = status;
+ log('Suite ' + _currentSuite.status + ': ' + suite.description, -1);
+ };
+
+ this.specStarted = function(spec) {
+
+ };
+
+ this.specDone = function(spec) {
+ var currentSpec = {
+ description: spec.description,
+ status: spec.status
+ };
+ if (spec.failedExpectations.length > 0) {
+ currentSpec.failedExpectations = spec.failedExpectations;
+ }
+
+ _currentSuite.specs.push(currentSpec);
+ log(spec.status + ' - ' + spec.description);
+ };
+
+ this.jasmineDone = function() {
+ outputFile = options.outputFile;
+ //// Alternate approach - just stringify the _root - not as pretty
+ //// but might be more useful for automation.
+ // var output = JSON.stringify(_root, null, 2);
+ var output = formatOutput(_root);
+ fs.appendFileSync(outputFile, output);
+ };
+
+ function ensureDirectoryExistence(filePath) {
+ var dirname = path.dirname(filePath);
+ if (directoryExists(dirname)) {
+ return true;
+ }
+ ensureDirectoryExistence(dirname);
+ fs.mkdirSync(dirname);
+ }
+
+ function directoryExists(path) {
+ try {
+ return fs.statSync(path).isDirectory();
+ }
+ catch (err) {
+ return false;
+ }
+ }
+
+ function initOutputFile(outputFile) {
+ ensureDirectoryExistence(outputFile);
+ var header = "Protractor results for: " + (new Date()).toLocaleString() + "\n\n";
+ fs.writeFileSync(outputFile, header);
+ }
+
+ // for output file output
+ function formatOutput(output) {
+ var indent = ' ';
+ var pad = ' ';
+ var results = [];
+ results.push('AppDir:' + output.appDir);
+ output.suites.forEach(function(suite) {
+ results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
+ pad+=indent;
+ suite.specs.forEach(function(spec) {
+ results.push(pad + spec.status + ' - ' + spec.description);
+ if (spec.failedExpectations) {
+ pad+=indent;
+ spec.failedExpectations.forEach(function (fe) {
+ results.push(pad + 'message: ' + fe.message);
+ });
+ pad=pad.substr(2);
+ }
+ });
+ pad = pad.substr(2);
+ results.push('');
+ });
+ results.push('');
+ return results.join('\n');
+ }
+
+ // for console output
+ var _pad;
+ function log(str, indent) {
+ _pad = _pad || '';
+ if (indent == -1) {
+ _pad = _pad.substr(2);
+ }
+ console.log(_pad + str);
+ if (indent == 1) {
+ _pad = _pad + ' ';
+ }
+ }
+
+}
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts
new file mode 100644
index 0000000..7769024
--- /dev/null
+++ b/src/app/app.component.spec.ts
@@ -0,0 +1,33 @@
+import { AppComponent } from './app.component';
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+describe('AppComponent', function () {
+ let de: DebugElement;
+ let comp: AppComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ AppComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(AppComponent);
+ comp = fixture.componentInstance;
+ de = fixture.debugElement.query(By.css('h1'));
+ });
+
+ it('should create component', () => expect(comp).toBeDefined() );
+
+ it('should have expected text', () => {
+ fixture.detectChanges();
+ const h1 = de.nativeElement;
+ expect(h1.innerText).toMatch(/angular/i,
+ ' should say something about "Angular"');
+ });
+});
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
new file mode 100644
index 0000000..7fb173c
--- /dev/null
+++ b/src/app/app.component.ts
@@ -0,0 +1,7 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'my-app',
+ template: `Hello {{name}}
`,
+})
+export class AppComponent { name = 'Angular'; }
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
new file mode 100644
index 0000000..357b003
--- /dev/null
+++ b/src/app/app.module.ts
@@ -0,0 +1,11 @@
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppComponent } from './app.component';
+
+@NgModule({
+ imports: [ BrowserModule ],
+ declarations: [ AppComponent ],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule { }
diff --git a/src/favicon.ico b/src/favicon.ico
new file mode 100644
index 0000000..8081c7c
Binary files /dev/null and b/src/favicon.ico differ
diff --git a/src/index.html b/src/index.html
new file mode 100644
index 0000000..8327435
--- /dev/null
+++ b/src/index.html
@@ -0,0 +1,25 @@
+
+
+
+ Angular QuickStart
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading AppComponent content here ...
+
+
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..311c44b
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,5 @@
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { AppModule } from './app/app.module';
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/src/styles.css b/src/styles.css
new file mode 100644
index 0000000..58e1a7d
--- /dev/null
+++ b/src/styles.css
@@ -0,0 +1,5 @@
+h1 {
+ color: #369;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 250%;
+}
diff --git a/src/systemjs-angular-loader.js b/src/systemjs-angular-loader.js
new file mode 100644
index 0000000..a0f7c54
--- /dev/null
+++ b/src/systemjs-angular-loader.js
@@ -0,0 +1,45 @@
+var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm;
+var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
+var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
+
+module.exports.translate = function(load){
+ var url = document.createElement('a');
+ url.href = load.address;
+
+ var basePathParts = url.pathname.split('/');
+
+ basePathParts.pop();
+ var basePath = basePathParts.join('/');
+
+ var baseHref = document.createElement('a');
+ baseHref.href = this.baseURL;
+ baseHref = baseHref.pathname;
+
+ basePath = basePath.replace(baseHref, '');
+
+ load.source = load.source
+ .replace(templateUrlRegex, function(match, quote, url){
+ let resolvedUrl = url;
+
+ if (url.startsWith('.')) {
+ resolvedUrl = basePath + url.substr(1);
+ }
+
+ return 'templateUrl: "' + resolvedUrl + '"';
+ })
+ .replace(stylesRegex, function(match, relativeUrls) {
+ var urls = [];
+
+ while ((match = stringRegex.exec(relativeUrls)) !== null) {
+ if (match[2].startsWith('.')) {
+ urls.push('"' + basePath + match[2].substr(1) + '"');
+ } else {
+ urls.push('"' + match[2] + '"');
+ }
+ }
+
+ return "styleUrls: [" + urls.join(', ') + "]";
+ });
+
+ return load;
+};
diff --git a/src/systemjs.config.extras.js b/src/systemjs.config.extras.js
new file mode 100644
index 0000000..027dfe5
--- /dev/null
+++ b/src/systemjs.config.extras.js
@@ -0,0 +1,11 @@
+/**
+ * Add barrels and stuff
+ * Adjust as necessary for your application needs.
+ */
+// (function (global) {
+// System.config({
+// packages: {
+// // add packages here
+// }
+// });
+// })(this);
diff --git a/src/systemjs.config.js b/src/systemjs.config.js
new file mode 100644
index 0000000..129704a
--- /dev/null
+++ b/src/systemjs.config.js
@@ -0,0 +1,45 @@
+/**
+ * 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'
+ },
+ // packages tells the System loader how to load when no filename and/or no extension
+ packages: {
+ app: {
+ defaultExtension: 'js',
+ meta: {
+ './*.js': {
+ loader: 'systemjs-angular-loader.js'
+ }
+ }
+ },
+ rxjs: {
+ defaultExtension: 'js'
+ }
+ }
+ });
+})(this);
diff --git a/src/tsconfig.json b/src/tsconfig.json
new file mode 100644
index 0000000..2c7260d
--- /dev/null
+++ b/src/tsconfig.json
@@ -0,0 +1,13 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "lib": [ "es2015", "dom" ],
+ "noImplicitAny": true,
+ "suppressImplicitAnyIndexErrors": true
+ }
+}
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..276453f
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,93 @@
+{
+ "rules": {
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "label-position": true,
+ "label-undefined": true,
+ "max-line-length": [
+ true,
+ 140
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-key": true,
+ "no-duplicate-variable": true,
+ "no-empty": false,
+ "no-eval": true,
+ "no-inferrable-types": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": false,
+ "no-switch-case-fall-through": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-unused-variable": true,
+ "no-unreachable": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "object-literal-sort-keys": false,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "radix": true,
+ "semicolon": [
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "variable-name": false,
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ]
+ }
+}