Skip to content

Commit

Permalink
feat(core): migrate to Angular 13 and Nx 13
Browse files Browse the repository at this point in the history
  • Loading branch information
jcb-entrnce authored and tinesoft committed Apr 6, 2022
1 parent a96bda4 commit c398496
Show file tree
Hide file tree
Showing 20 changed files with 53,119 additions and 22,024 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
!.vscode/extensions.json

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand Down
164 changes: 69 additions & 95 deletions angular.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,67 @@
{
"version": 1,
"cli": {
"defaultCollection": "@nrwl/angular"
},
"defaultProject": "ngx-cookieconsent-demo",
"schematics": {
"@nrwl/angular": {
"application": {
"linter": "eslint"
},
"library": {
"linter": "eslint"
"projects": {
"ngx-cookieconsent": {
"projectType": "library",
"root": "libs/ngx-cookieconsent",
"sourceRoot": "libs/ngx-cookieconsent/src",
"prefix": "ngc",
"architect": {
"build": {
"builder": "@nrwl/angular:package",
"options": {
"project": "libs/ngx-cookieconsent/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/ngx-cookieconsent"],
"options": {
"jestConfig": "libs/ngx-cookieconsent/jest.config.js",
"passWithNoTests": true
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/ngx-cookieconsent/src/**/*.ts",
"libs/ngx-cookieconsent/src/**/*.html"
]
},
"outputs": ["{options.outputFile}"]
},
"compodoc": {
"builder": "@twittwer/compodoc:compodoc",
"options": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.json",
"outputPath": "dist/compodoc/ngx-cookieconsent"
},
"configurations": {
"json": {
"exportFormat": "json"
}
}
},
"release": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "npx semantic-release",
"cwd": "libs/ngx-cookieconsent"
}
}
},
"storybook-configuration": {
"linter": "eslint"
}
},
"@nrwl/angular:application": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest",
"e2eTestRunner": "cypress"
"tags": []
},
"@nrwl/angular:library": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest"
},
"@nrwl/angular:component": {
"style": "scss"
}
},
"projects": {
"ngx-cookieconsent-demo": {
"projectType": "application",
"root": "apps/ngx-cookieconsent-demo",
Expand Down Expand Up @@ -115,7 +145,8 @@
"apps/ngx-cookieconsent-demo/src/**/*.ts",
"apps/ngx-cookieconsent-demo/src/**/*.html"
]
}
},
"outputs": ["{options.outputFile}"]
},
"test": {
"builder": "@nrwl/jest:jest",
Expand Down Expand Up @@ -168,9 +199,7 @@
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"routes": [
"/"
]
"routes": ["/"]
},
"configurations": {
"production": {
Expand All @@ -182,7 +211,8 @@
},
"defaultConfiguration": "production"
}
}
},
"tags": []
},
"ngx-cookieconsent-demo-e2e": {
"root": "apps/ngx-cookieconsent-demo-e2e",
Expand All @@ -206,68 +236,12 @@
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/ngx-cookieconsent-demo-e2e/**/*.{js,ts}"]
}
}
}
},
"ngx-cookieconsent": {
"projectType": "library",
"root": "libs/ngx-cookieconsent",
"sourceRoot": "libs/ngx-cookieconsent/src",
"prefix": "ngc",
"architect": {
"build": {
"builder": "@nrwl/angular:package",
"options": {
"project": "libs/ngx-cookieconsent/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/ngx-cookieconsent"],
"options": {
"jestConfig": "libs/ngx-cookieconsent/jest.config.js",
"passWithNoTests": true
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/ngx-cookieconsent/src/**/*.ts",
"libs/ngx-cookieconsent/src/**/*.html"
]
}
},
"compodoc": {
"builder": "@twittwer/compodoc:compodoc",
"options": {
"tsConfig": "libs/ngx-cookieconsent/tsconfig.lib.json",
"outputPath": "dist/compodoc/ngx-cookieconsent"
},
"configurations": {
"json": {
"exportFormat": "json"
}
}
},
"release": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"command": "npx semantic-release",
"cwd": "libs/ngx-cookieconsent"
}
"outputs": ["{options.outputFile}"]
}
}
},
"tags": [],
"implicitDependencies": ["ngx-cookieconsent-demo"]
}
}
}
3 changes: 0 additions & 3 deletions apps/ngx-cookieconsent-demo-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": "apps/ngx-cookieconsent-demo-e2e/tsconfig.*?.json"
},
"rules": {}
},
{
Expand Down
3 changes: 0 additions & 3 deletions apps/ngx-cookieconsent-demo/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": {
"project": ["apps/ngx-cookieconsent-demo/tsconfig.*?.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
Expand Down
11 changes: 5 additions & 6 deletions apps/ngx-cookieconsent-demo/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ module.exports = {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
},
coverageDirectory: '../../coverage/apps/ngx-cookieconsent-demo',
Expand All @@ -20,4 +14,9 @@ module.exports = {
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
testRunner: 'jest-jasmine2',
};
12 changes: 0 additions & 12 deletions apps/ngx-cookieconsent-demo/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ import '@angular/localize/init';
* BROWSER POLYFILLS
*/

/**
* IE11 requires the following for NgClass support on SVG elements
*/
// import 'classlist.js'; // Run `npm install --save classlist.js`.

/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
Expand Down
13 changes: 13 additions & 0 deletions apps/ngx-cookieconsent-demo/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import 'jest-preset-angular/setup-jest';

import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

getTestBed().resetTestEnvironment();
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
);
10 changes: 2 additions & 8 deletions apps/ngx-cookieconsent-demo/tsconfig.server.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "../../out-tsc/server",
"target": "es2019",
"types": [
"node"
]
"types": ["node"]
},
"files": [
"src/main.server.ts",
"server.ts"
],
"files": ["src/main.server.ts", "server.ts"],
"angularCompilerOptions": {
"entryModule": "./src/app/app.server.module#AppServerModule"
}
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", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.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('@nrwl/cli/lib/decorate-cli').decorateCli();
require('nx/src/cli/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
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
projects: [
...getJestProjects(),
'<rootDir>/apps/ngx-cookieconsent-demo',
'<rootDir>/libs/ngx-cookieconsent',
],
Expand Down
3 changes: 0 additions & 3 deletions libs/ngx-cookieconsent/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": {
"project": ["libs/ngx-cookieconsent/tsconfig.*?.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
Expand Down
11 changes: 5 additions & 6 deletions libs/ngx-cookieconsent/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ module.exports = {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
},
coverageDirectory: '../../coverage/libs/ngx-cookieconsent',
Expand All @@ -20,4 +14,9 @@ module.exports = {
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
testRunner: 'jest-jasmine2',
};
14 changes: 13 additions & 1 deletion libs/ngx-cookieconsent/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import 'jest-preset-angular/setup-jest';


import 'cookieconsent/build/cookieconsent.min.js';
//import 'cookieconsent/build/cookieconsent.min.css';

import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';

getTestBed().resetTestEnvironment();
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } }
);
2 changes: 1 addition & 1 deletion libs/ngx-cookieconsent/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"],
"include": ["**/*.ts"]
}
1 change: 0 additions & 1 deletion libs/ngx-cookieconsent/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
Expand Down
Loading

0 comments on commit c398496

Please sign in to comment.