Skip to content

Commit

Permalink
trouble after upgrading angular-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
dancancro committed Mar 4, 2017
1 parent efe0396 commit 71b1f11
Show file tree
Hide file tree
Showing 125 changed files with 2,175 additions and 1,337 deletions.
57 changes: 57 additions & 0 deletions .angular-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angcli-started"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"assets/styles/index.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[Please click here to support the Standing Rock Sioux Tribe and their peaceful resistance to the Dakota Access Pipeline which threatens their only source of water.](http://www.powwows.com/2016/09/07/10-ways-can-help-standing-rock-sioux-fight-dakota-access-pipeline/)


[![Build Status](https://travis-ci.org/dancancro/great-big-angular2-example.svg?branch=master)](https://travis-ci.org/dancancro/great-big-angular2-example)
[![Dependency Status](https://david-dm.org/dancancro/great-big-angular2-example.svg)](https://david-dm.org/dancancro/great-big-angular2-example)
Expand All @@ -15,7 +13,8 @@ sign and NDA.

The rationale behind this is pretty simple...

1. Code examples are better than docs, lessons and Gitter Q&A.
1. Real, complete code examples are better than docs, lessons and Gitter Q&A. And MUCH better
than ellipses (...).
2. If you want a job making commercial-grade code, you should study commercial-grade code,
not tutorial-grade code. Anything you learn in a tutorial must sadly be approached with caution
because corners have probably been cut, it's probably been simplified and it probably doesn't
Expand All @@ -26,6 +25,8 @@ The rationale behind this is pretty simple...
you even write Hello World.
4. If you want to know the complexity limits a technology will place on your app before you
commit to using it, there's no better way than to see a complex example made with that technology.
5. Making architectural decisions or convention decisions is a whole lot easier when you have
a complete application with all of its edge cases to illuminate the consequences.

Hopefully, when the project is done it will make the learning process for others much easier and prepare them to
make real things rather than instructional ones. I expect it to reduce the time to implement your own real
Expand All @@ -41,7 +42,7 @@ according to the following prioritization. Disagreements in approach between two
lower influence yielding to the higher one:

1. [Angular Style Guide](https://angular.io/docs/ts/latest/guide/style-guide.html) by Google
2. [Tour of Heroes (ngModules, Routing, App Specs versions)](https://github.com/dancancro/tour-of-heroes-versions) by Google
2. [Tour of Heroes (ngModules, Routing, App Specs, HTTP, Server Communication versions)](https://github.com/dancancro/tour-of-heroes-versions) by Google
3. [Angular CLI](https://github.com/angular/angular-cli) by Google and the community
4. [ngrx example app - book collection](https://github.com/ngrx/example-app) by [@MikeRyan52](https://github.com/MikeRyan52)
5. [angular-seed-advanced](https://github.com/NathanWalker/angular-seed-advanced) by Minko Gechev + Nathan Walker + community
Expand All @@ -64,14 +65,17 @@ While the goal of the project is to combine the wisdom of different experts, nob
no obvious case against doing so. So you will see a couple of practices in this project that came from my head rather than the sources
of expertise from which the project was assembled. If you can think of reasons not to do these things, please let me know.

1. I have put the Redux store reducers in `app/core/store` separate from the feature directories located under `app`. This agrees with
the traditional relational database structure that has tables together in one place and referenced by UI artifacts in another place. This is the
recommended practice with Redux.
1. I have put the Redux store reducers in `app/core/store` separate from the feature directories located under `app` and did not make folders
for `reducers`, `actions`, and `effects`. This jibes with the traditional relational database structure that has tables together in one place
and referenced by UI artifacts in another place. This is the recommended practice with Redux.
2. As much as practical the names of files in a directory begin with the directory name. I did this to prevent directories from having a mixture of
unrelated concerns. If a directory in a source demo had files for two different things, I created more directories. I thought about
removing that part of the file name, `src/app/app.page.ts` -> `src/app/page.ts`, for the sake of DRY, and I might still do that, but I'm
undecided on whether it would cause confusion to see many files in an editor with the same name.
3. I came up with a mini lexicon of file types to keep file names shorter and more expressive. A "page" is understood to be a smart `@Component`
3. I noticed a lot of duplication and boilerplate of identical CRUD code for each of my types of entities. So I made an `entities` folder akin to
the other parts of the store to hold what was common to all of them. `entity.action.ts` has the common actions. `entity.effects.ts` has some utility
functions for the common CRUD effects that are called from minimal specific entities. `entity.model.ts` contains the common schema and reducer code.
4. I came up with a mini lexicon of file types to keep file names shorter and more expressive. A "page" is understood to be a smart `@Component`
class that fills the page and might have a router-outlet and route configurations. A "guard" is understood to be an `@Injectable` "service" class that
returns a boolean. A "routing" is a `@NgModule` class that contains route configurations. So I memorize this simple lexicon, and drop the
redundant, less-clear words from the names. For example, I use the name `app.page.ts` rather than `app.component.ts` or `app-page.component.ts`.
Expand All @@ -93,6 +97,7 @@ That's it. It shouldn't be too hard to remember these, and in return you will ha
| Issue | Description | Features |
| :-- | :-- | :-- |
| [14480](https://github.com/angular/angular/issues/14480) | Angular 2 relative pathing from siblings doesn't work | Compose Message box on Crisis Center and login success routing |
| [14201](https://github.com/angular/angular/pull/14201) | Duplicate instantiation of lazy loaded modules | ngrx Effects |

## Prerequisites

Expand Down Expand Up @@ -733,4 +738,4 @@ Widget collections |Angular Material |Angular Material | | | |Angular Material
│   ├── test.ts
│   └── tsconfig.json
└── tslint.json
```
```
File renamed without changes.
27 changes: 14 additions & 13 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,36 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['angular-cli']
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
'text/x-typescript': ['ts', 'tsx']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
coverageIstanbulReporter: {
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'karma-remap-istanbul']
: ['progress'],
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand Down
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,17 @@
"@angular/core": "~2.4.5",
"@angular/forms": "~2.4.5",
"@angular/http": "~2.4.5",
"@angular/material": "~2.0.0-alpha.10",
"@angular/material": "2.0.0-beta.2",
"@angular/platform-browser": "~2.4.5",
"@angular/platform-browser-dynamic": "~2.4.5",
"@angular/router": "^3.3.1",
"@angular/router": "^3.4.0",
"@ngrx/core": "^1.0.0",
"@ngrx/db": "^2.0.0",
"@ngrx/effects": "^2.0.0",
"@ngrx/router-store": "^1.1.0",
"@ngrx/store": "^2.0.0",
"@ngrx/store-devtools": "^3.1.0",
"@types/hammerjs": "2.0.34",
"@types/jasmine": "2.5.38",
"@types/lodash": "^4.14.37",
"@types/node": "6.0.51",
"@types/uuid": "2.0.29",
"angular-cli": "1.0.0-beta.28.3",
"angular-in-memory-web-api": "0.2.4",
"angular-sortablejs": "1.3.1",
"angulartics2": "^1.6.3",
"autoprefixer": "^6.3.3",
Expand Down Expand Up @@ -88,7 +83,6 @@
"istanbul": "^1.0.0-alpha.2",
"istanbul-instrumenter-loader": "^0.2.0",
"lodash": "^4.17.4",
"ngrx-store-freeze": "^0.1.6",
"ngrx-store-localstorage": "0.1.5",
"nodemon": "^1.9.2",
"package-json": "2.4.0",
Expand All @@ -101,7 +95,7 @@
"reflect-metadata": "0.1.8",
"request": "2.79.0",
"reselect": "2.5.4",
"rxjs": "^5.0.1",
"rxjs": "^5.1.0",
"stylelint-webpack-plugin": "^0.3.0",
"to-string-loader": "^1.1.3",
"ts-helpers": "^1.1.1",
Expand All @@ -110,23 +104,31 @@
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.31",
"angular-cli": "1.0.0-beta.28.3",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"@angular/cli": "1.0.0-rc.1",
"@angular/compiler-cli": "^2.4.0",
"@types/hammerjs": "2.0.34",
"@types/jasmine": "2.5.38",
"@types/lodash": "^4.14.37",
"@types/node": "6.0.60",
"@types/uuid": "2.0.29",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "3.2.0",
"json-loader": "^0.5.4",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "1.0.2",
"karma-remap-istanbul": "^0.2.1",
"ngrx-store-freeze": "^0.1.6",
"osascript": "1.2.0",
"protractor": "~5.1.1",
"style-loader": "^0.13.1",
"ts-node": "1.2.1",
"tslint": "^4.4.2",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"tslint-loader": "^3.3.0",
"typescript": "2.0.10",
"webdriver-manager": "12.0.1",
Expand All @@ -135,4 +137,4 @@
"webpack-hot-middleware": "^2.12.2",
"webpack-split-by-path": "^0.1.0-beta.1"
}
}
}
12 changes: 5 additions & 7 deletions protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
allScriptsTimeout: 11000,
Expand All @@ -14,20 +13,19 @@ exports.config = {
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine2',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 40000,
print: function () { }
},
useAllAngular2AppRoots: true,
beforeLaunch: function () {
require('ts-node').register({
project: 'e2e'
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter());
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
},
getPageTimeout: 40000
};
2 changes: 1 addition & 1 deletion server/db/contact.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"id":21,"name":"Sam Spade"},{"id":22,"name":"Nick Dangerous"},{"id":24,"name":"Nancy Drew"}]
[{"id":21,"name":"Sam Spade"},{"id":22,"name":"Nick Dangerous"},{"id":24,"name":"Nancy Drew"},{"id":"bc361330-009f-11e7-ab58-53d042cc73c7","name":"jhfjghf"}]
27 changes: 1 addition & 26 deletions server/db/hero.json
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
[
{
"id": 11,
"name": "Mr. Nice"
},
{
"id": 12,
"name": "Narco"
},
{
"id": 13,
"name": "Bombasto"
},
{
"id": 14,
"name": "Celeritas"
},
{
"id": 15,
"name": "Magneta"
},
{
"id": 15,
"name": "Rubberman"
}
]
[{"id":11,"name":"Mr. Nice"},{"id":12,"name":"Narco"},{"id":13,"name":"Bombasto"},{"id":14,"name":"Celeritas"},{"id":15,"name":"Magneta"},{"id":15,"name":"Rubberman"},{"id":16,"name":"sss"},{"id":17,"name":"dfsfs"},{"id":18,"name":"sssss"},{"id":19,"name":"qqqq"},{"id":20,"name":"wwww"}]
2 changes: 2 additions & 0 deletions server/node-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ app.get('/api/contacts', getRecords('contact'));
app.post('/api/contact', saveARecord('contact'));
app.get('/api/crises', getRecords('crisis'));
app.get('/api/heroes', getRecords('hero'));
// app.get('/api/heroes/:id', getRecords('hero'));
app.get('/api/notes', getRecords('note'));
app.get('/api/users', getRecords('user'));
app.post('/api/note', saveARecord('note'));
app.post('/api/hero', saveARecord('hero'));

app.get('/api/deps/:package', getDependencies());

Expand Down
4 changes: 2 additions & 2 deletions src/app/app.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import * as sessionActions from './core/store/session/session.actions';
@Component({
selector: 'app-root',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['app.page.css'],
templateUrl: 'app.page.html'
styleUrls: ['./app.page.css'],
templateUrl: './app.page.html'
})
export class AppPage {
showSidenav$: Observable<boolean>;
Expand Down
Loading

0 comments on commit 71b1f11

Please sign in to comment.