Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Angular 13 #1567

Merged
merged 37 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
22c5976
87968: Upgrade to Angular 12
ybnd Feb 24, 2022
29d8dd6
87968: Remove html-webpack-plugin
ybnd Feb 24, 2022
9093ef4
87968: Karma needs ts-node 10.2.1
ybnd Feb 25, 2022
621a874
87968: Include theme modules in tsconfig.spec.ts
ybnd Feb 25, 2022
a47d7dd
Upgrade ng-dynamic forms
artlowel Mar 2, 2022
808d4e9
Enable source maps in dev mode
artlowel Mar 2, 2022
0e178ce
87968: Fix missing theme assets
ybnd Mar 3, 2022
5476062
87968: Add unmet peer dependencies
ybnd Mar 4, 2022
3eb3afc
87968: Fix rxjs/internal imports
ybnd Mar 4, 2022
26d45fd
87968: Remove angular2-text-mask dependency
ybnd Mar 4, 2022
ae89571
87968: Fix unit tests
ybnd Mar 3, 2022
47c8ca7
87968: Lift readyState complete check from Universal 12
ybnd Mar 18, 2022
1b460fe
87968: Automatic upgrade to Angular 13
ybnd Mar 11, 2022
c1d870c
87968: Clean up after automatic upgrade
ybnd Mar 11, 2022
49f470c
87968: Various dependency changes
ybnd Mar 11, 2022
8f7389c
87968: Fix JSON5 parsing in Universal loader
ybnd Mar 11, 2022
8e4f199
87968: Automatic upgrade to NgRx 13
ybnd Mar 14, 2022
563956c
87968: Manual fixes after NgRx migration
ybnd Mar 15, 2022
d78019c
87968: Fix unit tests
ybnd Mar 16, 2022
bfdda43
87968: Update devServer configuration
ybnd Mar 16, 2022
48efccb
87968: Upgrade ngx-gallery
ybnd Mar 18, 2022
5488d0f
87968: Remove unused import
ybnd Mar 18, 2022
59d46ff
87968: Upgrade ng-bootstrap to v11
ybnd Mar 21, 2022
cad76ff
87968: Increase Node --max_old_space_size
ybnd Mar 22, 2022
ec6327e
87968: Automatic ESLint install
ybnd Mar 25, 2022
245977a
87968: Automatic migration from TSLint to ESLint
ybnd Mar 25, 2022
b5911b8
87968: Manual ESLint configuration
ybnd Mar 25, 2022
bb51609
87968: Update ESLint disable/enable comments
ybnd Mar 25, 2022
99c41b9
87968: Minor code changes to pass lint
ybnd Mar 25, 2022
22ac667
87968: Kill app if still up after e2e tests
ybnd Mar 29, 2022
a14cc6f
87968: Run CI ESLint in --quiet mode
ybnd Mar 29, 2022
0115c52
87968: Turn off preserveWhitespaces by default
ybnd Mar 29, 2022
7083755
add margin to compensate for the switch to preserveWhiteSpaces = false
artlowel Mar 31, 2022
c736eba
Revert "87968: Increase Node --max_old_space_size"
ybnd Apr 4, 2022
042a0dd
87968: Revert previous spacing fixes
ybnd Apr 8, 2022
3f340c1
87968: Fix spacing issues via custom CSS
ybnd Apr 8, 2022
f829721
87968: Fix unstyled link issue
ybnd Apr 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
# 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

> 0.5%
last 2 versions
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-11 # For IE 9-11 support, remove 'not'.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
222 changes: 222 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"root": true,
"plugins": [
"@typescript-eslint",
"@angular-eslint/eslint-plugin",
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"eslint-plugin-deprecation",
"eslint-plugin-unused-imports"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"./tsconfig.json",
"./cypress/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"max-classes-per-file": [
"error",
1
],
"comma-dangle": [
"off",
"always-multiline"
],
"eol-last": [
"error",
"always"
],
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"debug",
"info",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"curly": "error",
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"radix": "error",
"guard-for-in": "error",
"no-bitwise": "error",
"no-restricted-imports": "error",
"no-caller": "error",
"no-debugger": "error",
"no-redeclare": "error",
"no-eval": "error",
"no-fallthrough": "error",
"no-trailing-spaces": "error",
"space-infix-ops": "error",
"keyword-spacing": "error",
"no-var": "error",
"no-unused-expressions": [
"error",
{
"allowTernary": true
}
],
"prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint)
"prefer-spread": "off",
"no-underscore-dangle": "off",

// todo: disabled rules from eslint:recommended, consider re-enabling & fixing
"no-prototype-builtins": "off",
"no-useless-escape": "off",
"no-case-declarations": "off",
"no-extra-boolean-cast": "off",

"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "ds",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ds",
"style": "kebab-case"
}
],
"@angular-eslint/pipe-prefix": [
"error",
{
"prefixes": [
"ds"
]
}
],
"@angular-eslint/no-attribute-decorator": "error",
"@angular-eslint/no-forward-ref": "error",
"@angular-eslint/no-output-native": "warn",
"@angular-eslint/no-output-on-prefix": "warn",
"@angular-eslint/no-conflicting-lifecycle": "warn",

"@typescript-eslint/no-inferrable-types":[
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/semi": "error",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "property",
"format": null
}
],
"@typescript-eslint/member-ordering": [
"error",
{
"default": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/require-await": "off",

"deprecation/deprecation": "warn",

"import/order": "off",
"import/no-deprecated": "warn"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
// todo: re-enable & fix errors
"@angular-eslint/template/no-negated-async": "off",
"@angular-eslint/template/eqeqeq": "off"
}
}
]
}
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: yarn install --frozen-lockfile

- name: Run lint
run: yarn run lint
run: yarn run lint --quiet

- name: Run build
run: yarn run build:prod
Expand Down Expand Up @@ -128,6 +128,14 @@ jobs:
name: e2e-test-screenshots
path: cypress/screenshots

- name: Stop app (in case it stays up after e2e tests)
run: |
app_pid=$(lsof -t -i:4000)
if [[ ! -z $app_pid ]]; then
echo "App was still up! (PID: $app_pid)"
kill -9 $app_pid
fi

# Start up the app with SSR enabled (run in background)
- name: Start app in SSR (server-side rendering) mode
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.angular/cache
/__build__
/__server_build__
/node_modules
Expand Down
44 changes: 27 additions & 17 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"extractCss": true,
"preserveSymlinks": true,
"customWebpackConfig": {
"path": "./webpack/webpack.browser.ts",
Expand Down Expand Up @@ -67,6 +66,14 @@
"scripts": []
},
"configurations": {
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"production": {
"fileReplacements": [
{
Expand All @@ -76,7 +83,6 @@
],
"optimization": true,
"outputHashing": "all",
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand Down Expand Up @@ -104,6 +110,9 @@
"port": 4000
},
"configurations": {
"development": {
"browserTarget": "dspace-angular:build:development"
},
"production": {
"browserTarget": "dspace-angular:build:production"
}
Expand Down Expand Up @@ -157,19 +166,6 @@
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"cypress/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@cypress/schematic:cypress",
"options": {
Expand Down Expand Up @@ -197,6 +193,10 @@
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"development": {
"sourceMap": true,
"optimization": false
},
"production": {
"sourceMap": false,
"optimization": true,
Expand Down Expand Up @@ -253,12 +253,22 @@
"watch": true,
"headless": false
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"defaultProject": "dspace-angular",
"cli": {
"analytics": false
"analytics": false,
"defaultCollection": "@angular-eslint/schematics"
}
}
}
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function (config) {
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['mocha', 'kjhtml'],
reporters: ['mocha', 'kjhtml', 'coverage-istanbul'],
mochaReporter: {
ignoreSkipped: true,
output: 'autowatch'
Expand Down
Loading