-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c77c4e1
Showing
25 changed files
with
1,329 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.idea | ||
typings/** | ||
node_modules | ||
jspm_packages | ||
link-checker-results.txt | ||
**/*npm-debug.log.* | ||
*.js | ||
*.js.map | ||
e2e/**/*.js | ||
e2e/**/*.js.map | ||
_test-output | ||
_temp | ||
|
||
!karma*.js | ||
!protractor*.js | ||
!systemjs.config.js | ||
!typings/typings.d.ts | ||
!wallaby.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<a name="0.2.8"></a> | ||
# 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. | ||
<a name="0.2.7"></a> | ||
# 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 | ||
|
||
<a name="0.2.6"></a> | ||
# 0.2.6 (2016-08-09) | ||
* Angular 2 RC5 version | ||
* Updated new forms, router and angular2-in-memory-web-api | ||
|
||
<a name="0.2.5"></a> | ||
# 0.2.5 (2016-06-30) | ||
* Angular 2 RC4 version | ||
* Updated new forms and router | ||
|
||
<a name="0.2.4"></a> | ||
# 0.2.4 (2016-06-21) | ||
* Angular 2 RC3 version | ||
* Add new forms and router | ||
* Add support for TS e2e tests | ||
|
||
<a name="0.2.3"></a> | ||
# 0.2.3 (2016-06-15) | ||
* Angular 2 RC2 version | ||
|
||
<a name="0.2.2"></a> | ||
# 0.2.2 (2016-05-21) | ||
* Update to Typings 1.x | ||
|
||
<a name="0.2.1"></a> | ||
# 0.2.1 (2016-05-03) | ||
* Angular 2 RC01 version | ||
|
||
<a name="0.2.0"></a> | ||
# 0.2.0 (2016-05-02) | ||
* Angular 2 RC0 version | ||
|
||
<a name="0.1.17"></a> | ||
# 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 | ||
|
||
<a name="0.1.16"></a> | ||
# 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 | ||
|
||
|
||
<a name="0.1.15"></a> | ||
# 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 | ||
|
||
<a name="0.1.14"></a> | ||
# 0.1.14 (2016-04-07) | ||
* update packages | ||
* Angular 2 beta 14 | ||
* lite-server 2.2.0 | ||
* typings 0.7.12 | ||
|
||
<a name="0.1.13"></a> | ||
# 0.1.13 (2016-03-31) | ||
* update packages | ||
* Angular 2 beta 13 | ||
|
||
<a name="0.1.12"></a> | ||
# 0.1.12 (2016-03-23) | ||
* update packages | ||
* Angular 2 beta 12 | ||
* zones 0.6.6 | ||
* remove es6-promise because no longer needed. | ||
|
||
<a name="0.1.11"></a> | ||
# 0.1.11 (2016-03-18) | ||
* update packages | ||
* Angular 2 beta 11 | ||
* zones 0.6.4 | ||
* typescript 1.8.9 | ||
* typings 0.7.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# To build and run with Docker: | ||
# | ||
# $ docker build -t ng2-quickstart . | ||
# $ docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart | ||
# | ||
FROM node:latest | ||
|
||
RUN mkdir -p /quickstart /home/nodejs && \ | ||
groupadd -r nodejs && \ | ||
useradd -r -g nodejs -d /home/nodejs -s /sbin/nologin nodejs && \ | ||
chown -R nodejs:nodejs /home/nodejs | ||
|
||
WORKDIR /quickstart | ||
COPY package.json typings.json /quickstart/ | ||
RUN npm install --unsafe-perm=true | ||
|
||
COPY . /quickstart | ||
RUN chown -R nodejs:nodejs /quickstart | ||
USER nodejs | ||
|
||
CMD npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Angular 2 QuickStart Source | ||
[![Build Status][travis-badge]][travis-badge-url] | ||
|
||
This repository holds the TypeScript source code of the [angular.io quickstart](https://angular.io/docs/ts/latest/quickstart.html), | ||
the foundation for most of the documentation samples and potentially a good starting point for your application. | ||
|
||
It's been extended with testing support so you can start writing tests immediately. | ||
|
||
**This is not the perfect arrangement for your application. It is not designed for production. | ||
It exists primarily to get you started quickly with learning and prototyping in Angular 2** | ||
|
||
We are unlikely to accept suggestions about how to grow this QuickStart into something it is not. | ||
Please keep that in mind before posting issues and PRs. | ||
|
||
## Prerequisites | ||
|
||
Node.js and npm are essential to Angular 2 development. | ||
|
||
<a href="https://docs.npmjs.com/getting-started/installing-node" target="_blank" title="Installing Node.js and updating npm"> | ||
Get it now</a> if it's not already installed on your machine. | ||
|
||
**Verify that you are running at least node `v4.x.x` and npm `3.x.x`** | ||
by running `node -v` and `npm -v` in a terminal/console window. | ||
Older versions produce errors. | ||
|
||
We recommend [nvm](https://github.com/creationix/nvm) for managing multiple versions of node and npm. | ||
|
||
## Create a new project based on the QuickStart | ||
|
||
Clone this repo into new project folder (e.g., `my-proj`). | ||
```bash | ||
git clone https://github.com/angular/quickstart my-proj | ||
cd my-proj | ||
``` | ||
|
||
We have no intention of updating the source on `angular/quickstart`. | ||
Discard everything "git-like" by deleting the `.git` folder. | ||
```bash | ||
rm -rf .git # non-Windows | ||
rd .git /S/Q # windows | ||
``` | ||
|
||
### Create a new git repo | ||
You could [start writing code](#start-development) now and throw it all away when you're done. | ||
If you'd rather preserve your work under source control, consider taking the following steps. | ||
|
||
Initialize this project as a *local git repo* and make the first commit: | ||
```bash | ||
git init | ||
git add . | ||
git commit -m "Initial commit" | ||
``` | ||
|
||
Create a *remote repository* for this project on the service of your choice. | ||
|
||
Grab its address (e.g. *`https://github.com/<my-org>/my-proj.git`*) and push the *local repo* to the *remote*. | ||
```bash | ||
git remote add origin <repo-address> | ||
git push -u origin master | ||
``` | ||
## Install npm packages | ||
|
||
> See npm and nvm version notes above | ||
Install the npm packages described in the `package.json` and verify that it works: | ||
|
||
**Attention Windows Developers: You must run all of these commands in administrator mode**. | ||
|
||
```bash | ||
npm install | ||
npm start | ||
``` | ||
|
||
> If the `typings` folder doesn't show up after `npm install` please install them manually with: | ||
> `npm run typings -- install` | ||
The `npm start` command first compiles the application, | ||
then simultaneously re-compiles and runs the `lite-server`. | ||
Both the compiler and the server watch for file changes. | ||
|
||
Shut it down manually with Ctrl-C. | ||
|
||
You're ready to write your application. | ||
|
||
### 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 tsc` - runs the TypeScript compiler once. | ||
* `npm run tsc:w` - runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them. | ||
* `npm run lite` - runs the [lite-server](https://www.npmjs.com/package/lite-server), a light-weight, static file server, written and maintained by | ||
[John Papa](https://github.com/johnpapa) and | ||
[Christopher Martin](https://github.com/cgmartin) | ||
with excellent support for Angular apps that use routing. | ||
* `npm run typings` - runs the typings tool. | ||
* `npm run postinstall` - called by *npm* automatically *after* it successfully completes package installation. This script installs the TypeScript definition files this app requires. | ||
Here are the test related scripts: | ||
* `npm test` - compiles, runs and watches the karma unit tests | ||
* `npm run e2e` - run protractor e2e tests, written in JavaScript (*e2e-spec.js) | ||
|
||
## Testing | ||
|
||
The QuickStart documentation doesn't discuss testing. | ||
This repo adds both karma/jasmine unit test and protractor end-to-end testing support. | ||
|
||
These tools are configured for specific conventions described below. | ||
|
||
*It is unwise and rarely possible to run the application, the unit tests, and the e2e tests at the same time. | ||
We recommend that you shut down one before starting another.* | ||
|
||
### Unit Tests | ||
TypeScript unit-tests are usually in the `app` folder. Their filenames must end in `.spec`. | ||
|
||
Look for the example `app/app.component.spec.ts`. | ||
Add more `.spec.ts` files as you wish; we configured karma to find them. | ||
|
||
Run it with `npm test` | ||
|
||
That command first compiles the application, then simultaneously re-compiles and runs the karma test-runner. | ||
Both the compiler and the karma watch for (different) file changes. | ||
|
||
Shut it down manually with Ctrl-C. | ||
|
||
Test-runner output appears in the terminal window. | ||
We can update our app and our tests in real-time, keeping a weather eye on the console for broken tests. | ||
Karma is occasionally confused and it is often necessary to shut down its browser or even shut the command down (Ctrl-C) and | ||
restart it. No worries; it's pretty quick. | ||
|
||
The `HTML-Reporter` is also wired in. That produces a prettier output; look for it in `~_test-output/tests.html`. | ||
|
||
### End-to-end (E2E) Tests | ||
|
||
E2E tests are in the `e2e` directory, side by side with the `app` folder. | ||
Their filenames must end in `.e2e-spec.ts`. | ||
|
||
Look for the example `e2e/app.e2e-spec.ts`. | ||
Add more `.e2e-spec.js` files as you wish (although one usually suffices for small projects); | ||
we configured protractor to find them. | ||
|
||
Thereafter, run them with `npm run e2e`. | ||
|
||
That command first compiles, then simultaneously starts the Http-Server at `localhost:8080` | ||
and launches protractor. | ||
|
||
The pass/fail test results appear at the bottom of the terminal window. | ||
A custom reporter (see `protractor.config.js`) generates a `./_test-output/protractor-results.txt` file | ||
which is easier to read; this file is excluded from source control. | ||
|
||
Shut it down manually with Ctrl-C. | ||
|
||
[travis-badge]: https://travis-ci.org/angular/quickstart.svg?branch=master | ||
[travis-badge-url]: https://travis-ci.org/angular/quickstart |
Oops, something went wrong.