Skip to content

Commit

Permalink
feat(core): migrate to Angular 14 and Nx 14 (#125)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Angular 14 is now the minimum required version to use the module.

Closes #123
  • Loading branch information
tinesoft committed Oct 10, 2022
1 parent ba938bd commit 7d8024d
Show file tree
Hide file tree
Showing 19 changed files with 14,225 additions and 14,106 deletions.
6 changes: 3 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/ngx-cookieconsent"],
"options": {
"jestConfig": "libs/ngx-cookieconsent/jest.config.js",
"jestConfig": "libs/ngx-cookieconsent/jest.config.ts",
"passWithNoTests": true
}
},
Expand All @@ -53,7 +53,7 @@
}
},
"release": {
"builder": "@nrwl/workspace:run-commands",
"builder": "nx:run-commands",
"options": {
"command": "npx semantic-release",
"cwd": "libs/ngx-cookieconsent"
Expand Down Expand Up @@ -152,7 +152,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/apps/ngx-cookieconsent-demo"],
"options": {
"jestConfig": "apps/ngx-cookieconsent-demo/jest.config.js",
"jestConfig": "apps/ngx-cookieconsent-demo/jest.config.ts",
"passWithNoTests": true
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'ngx-cookieconsent-demo',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
Expand Down
33 changes: 19 additions & 14 deletions apps/ngx-cookieconsent-demo/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,26 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

export const routes: Routes = [
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{
path: 'getting-started',
loadChildren: () => import('./getting-started/getting-started.module').then((m) => m.GettingStartedModule)
}
{
path: '',
redirectTo: 'home',
pathMatch: 'full',
},
{
path: 'getting-started',
loadChildren: () =>
import('./getting-started/getting-started.module').then(
(m) => m.GettingStartedModule
),
},
];

@NgModule({
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabled'
})],
exports: [RouterModule]
imports: [
RouterModule.forRoot(routes, {
initialNavigation: 'enabledBlocking',
}),
],
exports: [RouterModule],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
3 changes: 2 additions & 1 deletion apps/ngx-cookieconsent-demo/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"]
"include": ["src/**/*.d.ts"],
"exclude": ["jest.config.ts"]
}
3 changes: 2 additions & 1 deletion apps/ngx-cookieconsent-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"target": "es2020"
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/ngx-cookieconsent-demo/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"]
}
2 changes: 1 addition & 1 deletion decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function symlinkNgCLItoNxCLI() {

try {
symlinkNgCLItoNxCLI();
require('nx/src/cli/decorate-cli').decorateCli();
require('nx/src/adapter/decorate-cli').decorateCli();
output.log({ title: 'Angular CLI has been decorated to enable computation caching.' });
} catch(e) {
output.error({ title: 'Decoration of the Angular CLI did not complete successfully' });
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js → jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
export default {
projects: [
...getJestProjects(),
'<rootDir>/apps/ngx-cookieconsent-demo',
Expand Down
2 changes: 1 addition & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');
const nxPreset = require('@nrwl/jest/preset').default;

module.exports = { ...nxPreset };
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'ngx-cookieconsent',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
Expand Down
4 changes: 2 additions & 2 deletions libs/ngx-cookieconsent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "ngx-cookieconsent",
"version": "0.0.0-development",
"peerDependencies": {
"@angular/common": ">=12.0.1",
"@angular/core": ">=12.0.1",
"@angular/common": ">=14.0.0",
"@angular/core": ">=14.0.0",
"cookieconsent": "^3.1.1"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion libs/ngx-cookieconsent/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"target": "es2020"
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
Expand Down
9 changes: 7 additions & 2 deletions libs/ngx-cookieconsent/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"],
"exclude": [
"src/test-setup.ts",
"**/*.spec.ts",
"**/*.test.ts",
"jest.config.ts"
],
"include": ["**/*.ts"]
}
3 changes: 2 additions & 1 deletion libs/ngx-cookieconsent/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
},
"exclude": ["jest.config.ts"]
}
2 changes: 1 addition & 1 deletion libs/ngx-cookieconsent/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "jest.config.ts"]
}
Loading

0 comments on commit 7d8024d

Please sign in to comment.