Skip to content

Commit

Permalink
build(docs-infra): update docs examples to Angular v10
Browse files Browse the repository at this point in the history
This commit updates the docs examples to Angular v10.1.2. In addition to
updating the dependencies versions, it also updates the project's
structure and config to more closely match what a new v10 CLI app would
look like.
  • Loading branch information
gkalpak committed Sep 23, 2020
1 parent 128bbb9 commit 240541c
Show file tree
Hide file tree
Showing 30 changed files with 2,358 additions and 2,150 deletions.
2 changes: 1 addition & 1 deletion aio/content/examples/.gitignore
Expand Up @@ -17,6 +17,7 @@
**/e2e/tsconfig.e2e.json
**/src/karma.conf.js
**/.angular-cli.json
**/.browserslistrc
**/.editorconfig
**/.gitignore
**/angular.json
Expand All @@ -30,7 +31,6 @@
**/tslint.json
**/karma-test-shim.js
**/browser-test-shim.js
**/browserslist
**/node_modules

# built files
Expand Down
Expand Up @@ -24,7 +24,7 @@ export class UploaderService {
// }

upload(file: File) {
if (!file) { return; }
if (!file) { return of(); }

// COULD HAVE WRITTEN:
// return this.http.post('/upload/file', file, {
Expand Down
@@ -1,9 +1,7 @@
import * as angular from 'angular';
import 'angular-route';

const appName = 'myApp';

angular.module(appName, [
const appModule = angular.module('myApp', [
'ngRoute'
])
.config(['$routeProvider', '$locationProvider',
Expand All @@ -25,5 +23,5 @@ angular.module(appName, [
);

export function bootstrap(el: HTMLElement) {
return angular.bootstrap(el, [appName]);
return angular.bootstrap(el, [appModule.name]);
}
51 changes: 25 additions & 26 deletions aio/tools/examples/shared/boilerplate/cli-ajs/package.json
Expand Up @@ -13,43 +13,42 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~9.1.4",
"@angular/common": "~9.1.4",
"@angular/compiler": "~9.1.4",
"@angular/core": "~9.1.4",
"@angular/forms": "~9.1.4",
"@angular/platform-browser": "~9.1.4",
"@angular/platform-browser-dynamic": "~9.1.4",
"@angular/router": "~9.1.4",
"angular": "1.7.9",
"@angular/animations": "~10.1.2",
"@angular/common": "~10.1.2",
"@angular/compiler": "~10.1.2",
"@angular/core": "~10.1.2",
"@angular/forms": "~10.1.2",
"@angular/platform-browser": "~10.1.2",
"@angular/platform-browser-dynamic": "~10.1.2",
"@angular/router": "~10.1.2",
"angular": "1.8.0",
"angular-in-memory-web-api": "~0.11.0",
"angular-route": "1.7.9",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"angular-route": "1.8.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.4",
"@angular/cli": "~9.1.4",
"@angular/compiler-cli": "~9.1.4",
"@angular/language-service": "~9.1.4",
"@types/angular": "^1.6.57",
"@types/angular-route": "^1.7.0",
"@angular-devkit/build-angular": "~0.1001.2",
"@angular/cli": "~10.1.2",
"@angular/compiler-cli": "~10.1.2",
"@types/angular": "1.7.3",
"@types/angular-route": "1.7.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-marbles": "~0.6.0",
"jasmine-spec-reporter": "~4.2.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
"typescript": "~4.0.3"
}
}
18 changes: 18 additions & 0 deletions aio/tools/examples/shared/boilerplate/cli/.browserslistrc
@@ -0,0 +1,18 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
14 changes: 9 additions & 5 deletions aio/tools/examples/shared/boilerplate/cli/angular.json
Expand Up @@ -5,7 +5,11 @@
"projects": {
"angular.io-example": {
"projectType": "application",
"schematics": {},
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
Expand Down Expand Up @@ -47,13 +51,13 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
}
Expand Down
15 changes: 0 additions & 15 deletions aio/tools/examples/shared/boilerplate/cli/browserslist

This file was deleted.

Expand Up @@ -2,7 +2,7 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');

/**
* @type { import("protractor").Config }
Expand All @@ -27,6 +27,10 @@ exports.config = {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};
3 changes: 2 additions & 1 deletion aio/tools/examples/shared/boilerplate/cli/e2e/tsconfig.json
@@ -1,9 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
Expand Down
43 changes: 21 additions & 22 deletions aio/tools/examples/shared/boilerplate/cli/package.json
Expand Up @@ -13,39 +13,38 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~9.1.4",
"@angular/common": "~9.1.4",
"@angular/compiler": "~9.1.4",
"@angular/core": "~9.1.4",
"@angular/forms": "~9.1.4",
"@angular/platform-browser": "~9.1.4",
"@angular/platform-browser-dynamic": "~9.1.4",
"@angular/router": "~9.1.4",
"@angular/animations": "~10.1.2",
"@angular/common": "~10.1.2",
"@angular/compiler": "~10.1.2",
"@angular/core": "~10.1.2",
"@angular/forms": "~10.1.2",
"@angular/platform-browser": "~10.1.2",
"@angular/platform-browser-dynamic": "~10.1.2",
"@angular/router": "~10.1.2",
"angular-in-memory-web-api": "~0.11.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.4",
"@angular/cli": "~9.1.4",
"@angular/compiler-cli": "~9.1.4",
"@angular/language-service": "~9.1.4",
"@angular-devkit/build-angular": "~0.1001.2",
"@angular/cli": "~10.1.2",
"@angular/compiler-cli": "~10.1.2",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-marbles": "~0.6.0",
"jasmine-spec-reporter": "~4.2.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
"typescript": "~4.0.3"
}
}
@@ -0,0 +1,9 @@
{
"name": "angular.io-example",
"private": true,
"description_1": "This is a special package.json file that is not used by package managers.",
"description_2": "It is used to tell the tools and bundlers whether the code under this directory is free of code with non-local side-effect. Any code that does have non-local side-effects can't be well optimized (tree-shaken) and will result in unnecessary increased payload size.",
"description_3": "It should be safe to set this option to 'false' for new applications, but existing code bases could be broken when built with the production config if the application code does contain non-local side-effects that the application depends on.",
"description_4": "To learn more about this file see: https://angular.io/config/app-package-json.",
"sideEffects": false
}
@@ -1,3 +1,4 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
Expand Down
17 changes: 11 additions & 6 deletions aio/tools/examples/shared/boilerplate/cli/tsconfig.json
@@ -1,26 +1,31 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
// TODO(gkalpak): Fix examples and enable this.
// "strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"module": "es2020",
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
// TODO(gkalpak): Fix examples and enable this (i.e. switch from `fullTemplateTypeCheck` to `strictTemplates`).
"fullTemplateTypeCheck": true,// "strictTemplates": true
}
}
4 changes: 2 additions & 2 deletions aio/tools/examples/shared/boilerplate/cli/tsconfig.spec.json
@@ -1,10 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
"jasmine"
]
},
"files": [
Expand Down

0 comments on commit 240541c

Please sign in to comment.