Skip to content

Commit 2b8e273

Browse files
committed
feat(): update examples with angular-cli 8, 9 and material #183
1 parent e0e6a28 commit 2b8e273

File tree

177 files changed

+34494
-12033
lines changed

Some content is hidden

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

177 files changed

+34494
-12033
lines changed

.prettierrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"singleQuote": true,
66
"tabWidth": 2,
77
"trailingComma": "none",
8-
"useTabs": false
8+
"useTabs": false,
9+
"arrowParens": "avoid"
910
}

examples/angular-cli-8/.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Editor configuration, see http://editorconfig.org
1+
# Editor configuration, see https://editorconfig.org
22
root = true
33

44
[*]

examples/angular-cli-8/angular.json

+31-26
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"newProjectRoot": "projects",
55
"projects": {
66
"angular-cli": {
7-
"root": "",
8-
"sourceRoot": "src",
97
"projectType": "application",
10-
"prefix": "app",
118
"schematics": {
129
"@schematics/angular:component": {
13-
"styleext": "scss"
10+
"style": "scss"
1411
}
1512
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
1616
"architect": {
1717
"build": {
1818
"builder": "@angular-devkit/build-angular:browser",
@@ -21,7 +21,8 @@
2121
"index": "src/index.html",
2222
"main": "src/main.ts",
2323
"polyfills": "src/polyfills.ts",
24-
"tsConfig": "src/tsconfig.app.json",
24+
"tsConfig": "tsconfig.app.json",
25+
"aot": false,
2526
"assets": ["src/favicon.png", "src/assets"],
2627
"styles": ["src/styles.scss"],
2728
"scripts": []
@@ -42,7 +43,19 @@
4243
"aot": true,
4344
"extractLicenses": true,
4445
"vendorChunk": false,
45-
"buildOptimizer": true
46+
"buildOptimizer": true,
47+
"budgets": [
48+
{
49+
"type": "initial",
50+
"maximumWarning": "2mb",
51+
"maximumError": "5mb"
52+
},
53+
{
54+
"type": "anyComponentStyle",
55+
"maximumWarning": "6kb",
56+
"maximumError": "10kb"
57+
}
58+
]
4659
}
4760
}
4861
},
@@ -68,38 +81,30 @@
6881
"options": {
6982
"main": "src/test.ts",
7083
"polyfills": "src/polyfills.ts",
71-
"tsConfig": "src/tsconfig.spec.json",
72-
"karmaConfig": "src/karma.conf.js",
73-
"styles": ["styles.scss"],
74-
"scripts": [],
75-
"assets": ["src/favicon.png", "src/assets"]
84+
"tsConfig": "tsconfig.spec.json",
85+
"karmaConfig": "karma.conf.js",
86+
"assets": ["src/favicon.png", "src/assets"],
87+
"styles": ["src/styles.scss"],
88+
"scripts": []
7689
}
7790
},
7891
"lint": {
7992
"builder": "@angular-devkit/build-angular:tslint",
8093
"options": {
81-
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
94+
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
8295
"exclude": ["**/node_modules/**"]
8396
}
84-
}
85-
}
86-
},
87-
"angular-cli-e2e": {
88-
"root": "e2e/",
89-
"projectType": "application",
90-
"architect": {
97+
},
9198
"e2e": {
9299
"builder": "@angular-devkit/build-angular:protractor",
93100
"options": {
94101
"protractorConfig": "e2e/protractor.conf.js",
95102
"devServerTarget": "angular-cli:serve"
96-
}
97-
},
98-
"lint": {
99-
"builder": "@angular-devkit/build-angular:tslint",
100-
"options": {
101-
"tsConfig": "e2e/tsconfig.e2e.json",
102-
"exclude": ["**/node_modules/**"]
103+
},
104+
"configurations": {
105+
"production": {
106+
"devServerTarget": "angular-cli:serve:production"
107+
}
103108
}
104109
}
105110
}

examples/angular-cli-8/browserslist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# You can see what browsers were selected by your queries by running:
6+
# npx browserslist
7+
8+
> 0.5%
9+
last 2 versions
10+
Firefox ESR
11+
not dead
12+
not IE 9-11 # For IE 9-11 support, remove 'not'.

examples/angular-cli-8/e2e/protractor.conf.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
// @ts-check
12
// Protractor configuration file, see link for more information
23
// https://github.com/angular/protractor/blob/master/lib/config.ts
34

45
const { SpecReporter } = require('jasmine-spec-reporter');
56

7+
/**
8+
* @type { import("protractor").Config }
9+
*/
610
exports.config = {
711
allScriptsTimeout: 11000,
812
specs: [
913
'./src/**/*.e2e-spec.ts'
1014
],
1115
capabilities: {
12-
'browserName': 'chrome'
16+
browserName: 'chrome'
1317
},
1418
directConnect: true,
1519
baseUrl: 'http://localhost:4200/',
@@ -25,4 +29,4 @@ exports.config = {
2529
});
2630
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
2731
}
28-
};
32+
};

examples/angular-cli-8/e2e/src/app.e2e-spec.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { AppPage } from './app.po';
2+
import { browser, logging } from 'protractor';
23

34
describe('workspace-project App', () => {
45
let page: AppPage;
@@ -9,6 +10,14 @@ describe('workspace-project App', () => {
910

1011
it('should display welcome message', () => {
1112
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Welcome to app!');
13+
expect(page.getTitleText()).toEqual('angular-cli app is running!');
14+
});
15+
16+
afterEach(async () => {
17+
// Assert that there are no errors emitted from the browser
18+
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
19+
expect(logs).not.toContain(jasmine.objectContaining({
20+
level: logging.Level.SEVERE,
21+
} as logging.Entry));
1322
});
1423
});

examples/angular-cli-8/e2e/src/app.po.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { browser, by, element } from 'protractor';
22

33
export class AppPage {
44
navigateTo() {
5-
return browser.get('/');
5+
return browser.get(browser.baseUrl) as Promise<any>;
66
}
77

8-
getParagraphText() {
9-
return element(by.css('app-root h1')).getText();
8+
getTitleText() {
9+
return element(by.css('app-root .content span')).getText() as Promise<string>;
1010
}
1111
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../out-tsc/app",
4+
"outDir": "../out-tsc/e2e",
55
"module": "commonjs",
66
"target": "es5",
77
"types": [
@@ -10,4 +10,4 @@
1010
"node"
1111
]
1212
}
13-
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration file, see link for more information
22
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

4-
module.exports = function(config) {
4+
module.exports = function (config) {
55
config.set({
66
basePath: '',
77
frameworks: ['jasmine', '@angular-devkit/build-angular'],
@@ -16,30 +16,17 @@ module.exports = function(config) {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
1818
coverageIstanbulReporter: {
19-
dir: require('path').join(__dirname, '../coverage'),
20-
reports: ['html', 'lcovonly'],
19+
dir: require('path').join(__dirname, './coverage/angular-cli'),
20+
reports: ['html', 'lcovonly', 'text-summary'],
2121
fixWebpackSourcePaths: true
2222
},
2323
reporters: ['progress', 'kjhtml'],
2424
port: 9876,
2525
colors: true,
2626
logLevel: config.LOG_INFO,
2727
autoWatch: true,
28-
browsers: ['ChromeHeadless'],
28+
browsers: ['Chrome'],
2929
singleRun: false,
30-
31-
customLaunchers: {
32-
ChromeHeadless: {
33-
base: 'Chrome',
34-
flags: [
35-
'--no-sandbox',
36-
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
37-
'--headless',
38-
'--disable-gpu',
39-
// Without a remote debugging port, Google Chrome exits immediately.
40-
' --remote-debugging-port=9222'
41-
]
42-
}
43-
}
30+
restartOnFileChange: true
4431
});
4532
};

0 commit comments

Comments
 (0)