Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 32ffa5b

Browse files
authored
Update ng-cli (#48)
* Upgrade ng-cli version * Fix tests * Fix npm test command
1 parent 9c2a7cb commit 32ffa5b

17 files changed

+204
-139
lines changed
Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
23
"project": {
3-
"version": "1.0.0-beta.28.3",
44
"name": "client"
55
},
66
"apps": [
@@ -15,14 +15,15 @@
1515
"main": "main.ts",
1616
"polyfills": "polyfills.ts",
1717
"test": "test.ts",
18-
"tsconfig": "tsconfig.json",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
1920
"prefix": "app",
2021
"styles": [
2122
"styles.scss"
2223
],
2324
"scripts": [],
25+
"environmentSource": "environments/environment.ts",
2426
"environments": {
25-
"source": "environments/environment.ts",
2627
"dev": "environments/environment.ts",
2728
"prod": "environments/environment.prod.ts"
2829
}
@@ -35,12 +36,13 @@
3536
},
3637
"lint": [
3738
{
38-
"files": "src/**/*.ts",
39-
"project": "src/tsconfig.json"
39+
"project": "src/tsconfig.app.json"
4040
},
4141
{
42-
"files": "e2e/**/*.ts",
43-
"project": "e2e/tsconfig.json"
42+
"project": "src/tsconfig.spec.json"
43+
},
44+
{
45+
"project": "e2e/tsconfig.e2e.json"
4446
}
4547
],
4648
"test": {
@@ -49,19 +51,7 @@
4951
}
5052
},
5153
"defaults": {
52-
"styleExt": "scss",
53-
"prefixInterfaces": false,
54-
"inline": {
55-
"style": false,
56-
"template": false
57-
},
58-
"spec": {
59-
"class": false,
60-
"component": true,
61-
"directive": true,
62-
"module": false,
63-
"pipe": true,
64-
"service": true
65-
}
54+
"styleExt": "css",
55+
"component": {}
6656
}
6757
}

client/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
.c9/
1515
*.launch
1616
.settings/
17+
*.sublime-workspace
1718

1819
# IDE - VSCode
1920
.vscode/*

client/e2e/app.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ClientPage } from './app.po';
22

3-
describe('client App', function() {
3+
describe('client App', () => {
44
let page: ClientPage;
55

66
beforeEach(() => {
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
2-
"compileOnSave": false,
32
"compilerOptions": {
3+
"sourceMap": true,
44
"declaration": false,
5+
"moduleResolution": "node",
56
"emitDecoratorMetadata": true,
67
"experimentalDecorators": true,
7-
"module": "commonjs",
8-
"moduleResolution": "node",
8+
"lib": [
9+
"es2016"
10+
],
911
"outDir": "../dist/out-tsc-e2e",
10-
"sourceMap": true,
11-
"target": "es5",
12-
"typeRoots": [
13-
"../node_modules/@types"
12+
"module": "commonjs",
13+
"target": "es6",
14+
"types":[
15+
"jasmine",
16+
"node"
1417
]
1518
}
1619
}

client/karma.conf.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,36 @@
44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7-
frameworks: ['jasmine', 'angular-cli'],
7+
frameworks: ['jasmine', '@angular/cli'],
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
11-
require('karma-remap-istanbul'),
12-
require('angular-cli/plugins/karma')
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular/cli/plugins/karma')
1314
],
15+
client:{
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
17+
},
1418
files: [
1519
{ pattern: './src/test.ts', watched: false }
1620
],
1721
preprocessors: {
18-
'./src/test.ts': ['angular-cli']
22+
'./src/test.ts': ['@angular/cli']
1923
},
2024
mime: {
2125
'text/x-typescript': ['ts','tsx']
2226
},
23-
remapIstanbulReporter: {
24-
reports: {
25-
html: 'coverage',
26-
lcovonly: './coverage/coverage.lcov'
27-
}
27+
coverageIstanbulReporter: {
28+
reports: [ 'html', 'lcovonly' ],
29+
fixWebpackSourcePaths: true
2830
},
2931
angularCli: {
30-
config: './angular-cli.json',
3132
environment: 'dev'
3233
},
3334
reporters: config.angularCli && config.angularCli.codeCoverage
34-
? ['progress', 'karma-remap-istanbul']
35-
: ['progress'],
35+
? ['progress', 'coverage-istanbul']
36+
: ['progress', 'kjhtml'],
3637
port: 9876,
3738
colors: true,
3839
logLevel: config.LOG_INFO,

client/package.json

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,56 @@
22
"name": "client",
33
"version": "1.0.0",
44
"license": "ISC",
5-
"angular-cli": {},
65
"scripts": {
76
"ng": "ng",
87
"start": "ng serve --host=0.0.0.0 --proxy-config proxy.conf.json",
9-
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
8+
"build": "ng build",
109
"test": "ng test --single-run --code-coverage",
11-
"pree2e": "webdriver-manager update --standalone false --gecko false",
12-
"e2e": "protractor",
10+
"lint": "ng lint",
11+
"e2e": "ng e2e",
1312
"sw": "sw-precache --root=dist --config=sw-precache-config.js"
1413
},
1514
"private": false,
1615
"dependencies": {
17-
"@angular/common": "^2.3.1",
18-
"@angular/compiler": "^2.3.1",
19-
"@angular/core": "^2.3.1",
20-
"@angular/forms": "^2.3.1",
21-
"@angular/http": "^2.3.1",
22-
"@angular/material": "^2.0.0-beta.1",
23-
"@angular/platform-browser": "^2.3.1",
24-
"@angular/platform-browser-dynamic": "^2.3.1",
25-
"@angular/router": "^3.3.1",
16+
"@angular/common": "^2.4.0",
17+
"@angular/compiler": "^2.4.0",
18+
"@angular/core": "^2.4.0",
19+
"@angular/forms": "^2.4.0",
20+
"@angular/http": "^2.4.0",
21+
"@angular/material": "^2.0.0-beta.2",
22+
"@angular/platform-browser": "^2.4.0",
23+
"@angular/platform-browser-dynamic": "^2.4.0",
24+
"@angular/router": "^3.4.0",
2625
"@ngrx/core": "^1.2.0",
2726
"@ngrx/effects": "^2.0.0",
2827
"@ngrx/store": "^2.2.1",
2928
"core-js": "^2.4.1",
3029
"hammerjs": "^2.0.8",
3130
"reselect": "^2.5.4",
32-
"rxjs": "^5.0.1",
33-
"ts-helpers": "^1.1.1",
34-
"zone.js": "^0.7.2"
31+
"rxjs": "^5.1.0",
32+
"zone.js": "^0.7.6"
3533
},
3634
"devDependencies": {
37-
"@angular/compiler-cli": "^2.3.1",
35+
"@angular/cli": "1.0.0-rc.0",
36+
"@angular/compiler-cli": "^2.4.0",
3837
"@ngrx/store-devtools": "^3.2.3",
3938
"@types/hammerjs": "^2.0.34",
4039
"@types/jasmine": "2.5.38",
41-
"@types/node": "^6.0.42",
42-
"angular-cli": "1.0.0-beta.28.3",
43-
"codelyzer": "~2.0.0-beta.1",
44-
"jasmine-core": "2.5.2",
45-
"jasmine-spec-reporter": "2.5.0",
46-
"karma": "1.2.0",
47-
"karma-chrome-launcher": "^2.0.0",
48-
"karma-cli": "^1.0.1",
49-
"karma-jasmine": "^1.0.2",
50-
"karma-remap-istanbul": "^0.2.1",
51-
"ngrx-store-freeze": "^0.1.6",
52-
"protractor": "~4.0.13",
53-
"sw-precache": "^4.3.0",
54-
"ts-node": "1.2.1",
55-
"tslint": "^4.3.0",
56-
"typescript": "~2.0.3"
40+
"@types/node": "~6.0.60",
41+
"codelyzer": "~2.0.0",
42+
"jasmine-core": "~2.5.2",
43+
"jasmine-spec-reporter": "~3.2.0",
44+
"karma": "~1.4.1",
45+
"karma-chrome-launcher": "~2.0.0",
46+
"karma-cli": "~1.0.1",
47+
"karma-coverage-istanbul-reporter": "^0.2.0",
48+
"karma-jasmine": "~1.1.0",
49+
"karma-jasmine-html-reporter": "^0.2.2",
50+
"ngrx-store-freeze": "^0.1.9",
51+
"protractor": "~5.1.0",
52+
"sw-precache": "^5.0.0",
53+
"ts-node": "~2.0.0",
54+
"tslint": "~4.4.2",
55+
"typescript": "~2.0.0"
5756
}
5857
}

client/protractor.conf.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Protractor configuration file, see link for more information
22
// https://github.com/angular/protractor/blob/master/lib/config.ts
33

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

76
exports.config = {
87
allScriptsTimeout: 11000,
@@ -20,13 +19,12 @@ exports.config = {
2019
defaultTimeoutInterval: 30000,
2120
print: function() {}
2221
},
23-
useAllAngular2AppRoots: true,
2422
beforeLaunch: function() {
2523
require('ts-node').register({
26-
project: 'e2e'
24+
project: 'e2e/tsconfig.e2e.json'
2725
});
2826
},
29-
onPrepare: function() {
30-
jasmine.getEnv().addReporter(new SpecReporter());
27+
onPrepare() {
28+
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
3129
}
3230
};

client/src/app/app.component.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
/* tslint:disable:no-unused-variable */
2-
31
import { TestBed, async } from '@angular/core/testing';
4-
import { AppComponent } from './app.component';
52
import { MaterialModule } from '@angular/material';
63
import { RouterTestingModule } from '@angular/router/testing';
74

5+
import { AppComponent } from './app.component';
6+
87
describe('AppComponent', () => {
9-
beforeEach(() => {
8+
beforeEach(async(() => {
109
TestBed.configureTestingModule({
1110
imports: [
12-
MaterialModule.forRoot(),
11+
MaterialModule,
1312
RouterTestingModule,
1413
],
1514
declarations: [
1615
AppComponent
1716
],
18-
});
19-
TestBed.compileComponents();
20-
});
17+
}).compileComponents();
18+
}));
2119

2220
it('should create the app', async(() => {
2321
const fixture = TestBed.createComponent(AppComponent);

client/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'hammerjs';
2+
13
import { BrowserModule } from '@angular/platform-browser';
24
import { NgModule } from '@angular/core';
35
import { FormsModule } from '@angular/forms';
@@ -27,7 +29,7 @@ import { UserService } from './services/user.service';
2729
FormsModule,
2830
HttpModule,
2931
AppRoutingModule,
30-
MaterialModule.forRoot(),
32+
MaterialModule,
3133
StoreModule.provideStore(reducer),
3234
StoreDevtoolsModule.instrumentOnlyWithExtension(),
3335
EffectsModule.run(UserEffects),

client/src/app/components/users/users.component.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@
33
display: inline-block;
44
margin: 15px;
55
}
6-
7-
.example-header-image {
8-
background-image: url('assets/img/examples/shiba1.jpg');
9-
background-size: cover;
10-
}

0 commit comments

Comments
 (0)