Skip to content

Commit a522d5c

Browse files
committed
initial angular-cli version
1 parent 8d398d5 commit a522d5c

File tree

126 files changed

+3647
-20196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3647
-20196
lines changed

.angular-cli.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"project": {
4+
"name": "angular-redux-chat"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": [
11+
"assets",
12+
"favicon.ico"
13+
],
14+
"index": "index.html",
15+
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
17+
"test": "test.ts",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
20+
"prefix": "app",
21+
"styles": [
22+
"styles.css"
23+
],
24+
"scripts": [],
25+
"environmentSource": "environments/environment.ts",
26+
"environments": {
27+
"dev": "environments/environment.ts",
28+
"prod": "environments/environment.prod.ts"
29+
}
30+
}
31+
],
32+
"e2e": {
33+
"protractor": {
34+
"config": "./protractor.conf.js"
35+
}
36+
},
37+
"lint": [
38+
{
39+
"project": "src/tsconfig.app.json"
40+
},
41+
{
42+
"project": "src/tsconfig.spec.json"
43+
},
44+
{
45+
"project": "e2e/tsconfig.e2e.json"
46+
}
47+
],
48+
"test": {
49+
"karma": {
50+
"config": "./karma.conf.js"
51+
}
52+
},
53+
"defaults": {
54+
"styleExt": "css",
55+
"component": {}
56+
}
57+
}

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Editor configuration, see http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.gitignore

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,41 @@
1-
build/
2-
\.\#*
3-
4-
### Node ###
5-
# Logs
6-
logs
7-
*.log
8-
npm-debug.log*
9-
10-
# Runtime data
11-
pids
12-
*.pid
13-
*.seed
14-
15-
# Directory for instrumented libs generated by jscoverage/JSCover
16-
lib-cov
17-
18-
# Coverage directory used by tools like istanbul
19-
coverage
20-
21-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
22-
.grunt
23-
24-
# node-waf configuration
25-
.lock-wscript
26-
27-
# Compiled binary addons (http://nodejs.org/api/addons.html)
28-
build/Release
29-
30-
# Dependency directory
31-
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
32-
node_modules
33-
34-
.webpack.json
35-
36-
37-
app/ts/ChatExampleData.js
38-
app/ts/app.js
39-
app/ts/components/ChatNavBar.js
40-
app/ts/components/ChatThreads.js
41-
app/ts/components/ChatWindow.js
42-
app/ts/models.js
43-
app/ts/services/MessagesService.js
44-
app/ts/services/ThreadsService.js
45-
app/ts/services/UserService.js
46-
app/ts/services/services.js
47-
app/ts/util/FromNowPipe.js
48-
app/ts/util/RxPipe.js
49-
app/ts/util/util.js
50-
app/ts/util/uuid.js
51-
.tern-port
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+
10+
# IDEs and editors
11+
/.idea
12+
.project
13+
.classpath
14+
.c9/
15+
*.launch
16+
.settings/
17+
*.sublime-workspace
18+
19+
# IDE - VSCode
20+
.vscode/*
21+
!.vscode/settings.json
22+
!.vscode/tasks.json
23+
!.vscode/launch.json
24+
!.vscode/extensions.json
25+
26+
# misc
27+
/.sass-cache
28+
/connect.lock
29+
/coverage/*
30+
/libpeerconnection.log
31+
npm-debug.log
32+
testem.log
33+
/typings
34+
35+
# e2e
36+
/e2e/*.js
37+
/e2e/*.map
38+
39+
#System Files
40+
.DS_Store
41+
Thumbs.db

.test.bats

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,38 @@ load "${NGBOOK_ROOT}/scripts/bats/fullstack.bats"
55
load "${NGBOOK_ROOT}/scripts/bats-support/load.bash"
66
load "${NGBOOK_ROOT}/scripts/bats-assert/load.bash"
77

8-
@test "angular2-rxjs-chat e2e tests pass" {
8+
@test "angular-rxjs-chat unit tests pass" {
9+
cd $DIR
10+
run npm run test
11+
assert_output --partial 'SUCCESS'
12+
}
13+
14+
@test "angular-rxjs-chat e2e tests pass" {
915
cd $DIR
10-
run ./node_modules/.bin/protractor
16+
run_ng_e2e $TEST_TMP_DIR
17+
run cat ${TEST_TMP_DIR}/log.txt
1118
assert_output --partial 'SUCCESS'
1219
}
1320

21+
@test "angular-rxjs-chat linting passes" {
22+
cd $DIR
23+
run npm run lint
24+
assert_output --partial 'All files pass linting'
25+
}
26+
1427
setup() {
28+
echo "travis_fold:start:angular-rxjs-chat"
1529
cd $DIR
16-
kill_by_port 8080
17-
kill_by_grep "webpack-dev-server"
18-
npm run go 3>- &
30+
TEST_TMP_DIR="$(mktemp -d -t fullstackXXX)"
31+
kill_ng_cli || :
32+
kill_by_port 4200
1933
true
2034
}
2135

2236
teardown() {
2337
cd $DIR
24-
kill_by_port 8080
25-
kill_by_grep "webpack-dev-server"
38+
kill_ng_cli || :
39+
kill_by_port 4200
40+
echo "travis_fold:end:angular-rxjs-chat"
2641
true
2742
}

.webpack.json

Lines changed: 2073 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ This repo shows an example chat application using RxJS and Angular 2. The goal i
2323

2424
```bash
2525
# clone the repo
26-
git clone https://github.com/ng-book/angular2-rxjs-chat.git
26+
git clone https://github.com/ng-book/angular2-rxjs-chat.git
2727

2828
# change into the repo directory
2929
cd angular2-rxjs-chat
3030

31-
# install
31+
# install
3232
npm install
3333

3434
# run
3535
npm run go
3636
```
3737

38-
Then visit [http://localhost:8080](http://localhost:8080) in your browser.
38+
Then visit [http://localhost:8080](http://localhost:8080) in your browser.
3939

4040
## Architecture
4141

@@ -58,7 +58,7 @@ And there are three services, one for each model:
5858
There are also three top-level components:
5959

6060
* [`ChatNavBar`](app/ts/components/ChatNavBar.ts) - for the top navigation bar and unread messages count
61-
* [`ChatThreads`](app/ts/components/ChatThreads.ts) - for our clickable list of threads
61+
* [`ChatThreads`](app/ts/components/ChatThreads.ts) - for our clickable list of threads
6262
* [`ChatWindow`](app/ts/components/ChatWindow.ts) - where we hold our current conversation
6363

6464
<p align="center">
@@ -67,7 +67,7 @@ There are also three top-level components:
6767

6868
## Services Manage Observables
6969

70-
Each service publishes data as RxJS streams. The service clients subscribe to these streams to be notified of changes.
70+
Each service publishes data as RxJS streams. The service clients subscribe to these streams to be notified of changes.
7171

7272
The `MessagesService` is the backbone of the application. All new messages are added to the `newMessages` stream and, more or less, all streams are derived from listening to `newMessages`. Even the `Thread`s exposed by the `ThreadsService` are created by listening to the stream of `Message`s.
7373

@@ -101,11 +101,11 @@ angular2-rxjs-chat/
101101
├── README.md * This file
102102
├── app/ * Where our application code is stored
103103
│ ├── css/ * Contains our CSS and SCSS files
104-
| |
104+
| |
105105
│ ├── images/ * Stores app images
106-
| |
106+
| |
107107
│ ├── index.html * HTML entry point
108-
| |
108+
| |
109109
│ ├── ts/ * All of our TypeScript is here
110110
| | |
111111
│ │ ├── ChatExampleData.ts * Contains our bots and sample data
@@ -128,18 +128,18 @@ angular2-rxjs-chat/
128128
│ │ │ └── services.ts * Exports all services
129129
| | |
130130
│ │ └── util/ * Pipes and various utilities
131-
| |
131+
| |
132132
│ ├── typings/ * Self-managed type definitions here
133-
| |
133+
| |
134134
│ └── vendor.js * Vendor js requires for webpack
135-
| |
135+
| |
136136
├── karma.conf.js * Our unit testing configuration
137137
├── package.json * Our javascript dependencies
138138
├── test/ * Our tests go here
139139
├── test.bundle.js * Some hacks to get TypeScript tests
140140
├── tsconfig.json * Configures the TypeScript compiler
141141
├── tsd.json * Configures tsd (type definitions packages)
142-
├── tslint.json * Configures our TypeScript linter
142+
├── tslint.json * Configures our TypeScript linter
143143
├── typings/ * tsd managed typings
144144
├── vendor/ * Various vendored code
145145
└── webpack.config.js * Our Webpack configuration
@@ -168,7 +168,7 @@ npm install
168168
npm run go
169169
```
170170

171-
Then visit [http://localhost:8080](http://localhost:8080) in your browser.
171+
Then visit [http://localhost:8080](http://localhost:8080) in your browser.
172172

173173
## Running the Tests
174174

@@ -184,7 +184,7 @@ There are two big changes we plan to make to this repo:
184184

185185
### 1. Add HTTP Requests
186186

187-
Currently the bots are all client-side and there are no HTTP requests involved in the chats.
187+
Currently the bots are all client-side and there are no HTTP requests involved in the chats.
188188

189189
We will move the chat bots to a server and integrate API requests into this project once the Angular 2 HTTP client development has settled down.
190190

@@ -222,5 +222,3 @@ This app is only one of several apps we have in the book. If you're looking to l
222222

223223
## License
224224
[MIT](/LICENSE.md)
225-
226-
-59 KB
Binary file not shown.
-17.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)