Skip to content

Commit 777388e

Browse files
committed
Migracion Angular. Versiones compatibles node,ts y zone. Algunas dependencias actualizadas. Configuracion cambiada
1 parent 8625311 commit 777388e

13 files changed

Lines changed: 2546 additions & 1971 deletions

File tree

GUIA ANGULAR 20.md

Lines changed: 325 additions & 224 deletions
Large diffs are not rendered by default.

angular.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,33 @@
126126
"flat": true,
127127
"skipTests": true,
128128
"prefix": "bc",
129+
"type": "component",
129130
"style": "css"
130131
},
131132
"@schematics/angular:directive": {
133+
"type": "directive",
132134
"prefix": "bc"
135+
},
136+
"@schematics/angular:service": {
137+
"type": "service"
138+
},
139+
"@schematics/angular:guard": {
140+
"typeSeparator": "."
141+
},
142+
"@schematics/angular:interceptor": {
143+
"typeSeparator": "."
144+
},
145+
"@schematics/angular:module": {
146+
"typeSeparator": "."
147+
},
148+
"@schematics/angular:pipe": {
149+
"typeSeparator": "."
150+
},
151+
"@schematics/angular:resolver": {
152+
"typeSeparator": "."
133153
}
134154
},
135155
"cli": {
136156
"analytics": false
137157
}
138-
}
158+
}

demo/app/books/components/books.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { BooksService, Book } from './../books.service';
88
import { AuthorsService } from './../../authors/authors.service';
99
import { PhotosService } from '../../photos/photos.service';
1010
// ActivatedRoute already imported above
11-
import { Observable } from 'rxjs';
11+
import { Observable, lastValueFrom } from 'rxjs';
1212

1313
@Component({
1414
selector: 'demo-books',
@@ -63,7 +63,7 @@ export class BooksComponent {
6363
},
6464
(error) => console.log('error books controller', error)
6565
);
66-
books$.toPromise().then((_success) => console.log('books loaded PROMISE'));
66+
lastValueFrom(books$).then((_success) => console.log('books loaded PROMISE'));
6767
}
6868

6969
public delete(book: Resource): void {

demo/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"downlevelIteration": true,
44
"sourceMap": true,
55
"declaration": false,
6-
"moduleResolution": "node",
6+
"moduleResolution": "bundler",
77
"experimentalDecorators": true,
88
"lib": ["es2017", "dom"],
99
"outDir": "../out-tsc/app",

jest.base.config.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
module.exports = {
22
preset: 'jest-preset-angular',
3+
testEnvironment: 'jsdom',
34
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
4-
transform: { '^.+.(ts|mjs|js|html)$': 'jest-preset-angular' },
5+
transform: {
6+
'^.+\\.(ts|mjs|js|html)$': [
7+
'jest-preset-angular',
8+
{
9+
tsconfig: '<rootDir>/projects/ngx-jsonapi-lib/tsconfig.spec.json',
10+
stringifyContentPathRegex: '\\.(html|svg)$'
11+
}
12+
]
13+
},
514
moduleFileExtensions: ['ts', 'js', 'mjs', 'html', 'json'],
6-
transformIgnorePatterns: ['node_modules/(?!(lodash-es|@angular|zone.js|ngx-jsonapi|@ngrx|@ngxs)/)'],
15+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|@angular|rxjs|zone\\.js|lodash-es|dexie)'],
716
modulePathIgnorePatterns: ['dist'],
817
moduleNameMapper: {
918
'^lodash-es$': 'lodash',
1019
'^ngx-jsonapi/(?!db)(.*)': '<rootDir>/projects/ngx-jsonapi-lib/src/$1'
1120
},
12-
globals: {
13-
'ts-jest': {
14-
tsconfig: '<rootDir>/tsconfig.spec.json',
15-
stringifyContentPathRegex: '\\.(html|svg)$'
16-
}
17-
},
1821
snapshotSerializers: [
1922
'jest-preset-angular/build/serializers/no-ng-attributes',
2023
'jest-preset-angular/build/serializers/ng-snapshot',

jest.demo.config.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
const baseConfig = require('./jest.base.config');
22

33
module.exports = {
4-
...baseConfig,
5-
roots: ['<rootDir>/demo'],
6-
modulePaths: ['<rootDir>/dist'],
7-
moduleNameMapper: {
8-
'^ngx-jsonapi$': '<rootDir>/projects/ngx-jsonapi-lib/src/public_api.ts',
9-
'^ngx-jsonapi/(.*)$': '<rootDir>/projects/ngx-jsonapi-lib/src/$1'
10-
},
11-
coveragePathIgnorePatterns: [
12-
'/node_modules/',
13-
'/src/*.*/'
14-
],
4+
...baseConfig,
5+
roots: ['<rootDir>/demo'],
6+
modulePaths: ['<rootDir>/dist'],
157
moduleNameMapper: {
16-
'\\.(html)$': '<rootDir>/demo/__mocks__/htmlMock.js',
8+
...baseConfig.moduleNameMapper,
9+
'^ngx-jsonapi$': '<rootDir>/projects/ngx-jsonapi-lib/src/public_api.ts',
10+
'\\.(html)$': '<rootDir>/demo/__mocks__/htmlMock.js'
1711
},
18-
19-
globals: {
20-
'ts-jest': {
21-
tsConfigFile: 'demo/tsconfig.spec.json'
22-
},
23-
stringifyContentPathRegex: true
24-
},
12+
coveragePathIgnorePatterns: ['/node_modules/', '/src/*.*/']
2513
};

jest.lib.config.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,5 @@ module.exports = {
66
coveragePathIgnorePatterns: ['/node_modules/', '/demo/*.*/'],
77
testEnvironmentOptions: {
88
url: 'http://localhost/'
9-
},
10-
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
11-
globals: {
12-
'ts-jest': {
13-
tsconfig: 'projects/ngx-jsonapi-lib/tsconfig.spec.json'
14-
},
15-
stringifyContentPathRegex: true
169
}
1710
};

package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,24 @@
101101
"esbuild-wasm": "0.14.54"
102102
},
103103
"devDependencies": {
104-
"@angular-devkit/build-angular": "^19.0.0",
105-
"@angular-eslint/builder": "^19.0.0",
106-
"@angular-eslint/eslint-plugin": "^19.0.0",
107-
"@angular-eslint/eslint-plugin-template": "^19.0.0",
108-
"@angular-eslint/schematics": "^19.0.0",
109-
"@angular-eslint/template-parser": "^19.0.0",
110-
"@angular/animations": "^19.0.0",
111-
"@angular/cli": "^19.0.0",
112-
"@angular/common": "^19.0.0",
113-
"@angular/compiler": "19",
114-
"@angular/compiler-cli": "^19.0.0",
115-
"@angular/core": "^19.0.0",
116-
"@angular/forms": "^19.0.0",
117-
"@angular/platform-browser": "^19.0.0",
118-
"@angular/platform-browser-dynamic": "^19.0.0",
119-
"@angular/platform-server": "^19.0.0",
120-
"@angular/router": "^19.0.0",
104+
"@angular-devkit/build-angular": "^20.3.15",
105+
"@angular-eslint/builder": "^20.0.0",
106+
"@angular-eslint/eslint-plugin": "^20.0.0",
107+
"@angular-eslint/eslint-plugin-template": "^20.0.0",
108+
"@angular-eslint/schematics": "^20.0.0",
109+
"@angular-eslint/template-parser": "^20.0.0",
110+
"@angular/animations": "^20.3.16",
111+
"@angular/cli": "^20.3.15",
112+
"@angular/common": "^20.3.16",
113+
"@angular/compiler": "20.3.16",
114+
"@angular/compiler-cli": "^20.3.16",
115+
"@angular/core": "^20.3.16",
116+
"@angular/forms": "^20.3.16",
117+
"@angular/platform-browser": "^20.3.16",
118+
"@angular/platform-browser-dynamic": "^20.3.16",
119+
"@angular/platform-server": "^20.3.16",
120+
"@angular/router": "^20.3.16",
121121
"@eslint/js": "^9.0.0",
122-
"typescript-eslint": "^8.0.0",
123122
"@types/faker": "4.1.5",
124123
"@types/fs-extra": "2.1.0",
125124
"@types/glob": "5.0.33",
@@ -157,12 +156,12 @@
157156
"jasmine-spec-reporter": "5.0.0",
158157
"jest": "29.6.2",
159158
"jest-environment-jsdom": "29.6.2",
160-
"jest-preset-angular": "13.1.1",
159+
"jest-preset-angular": "^14.0.0",
161160
"jest-zone-patch": "0.0.10",
162161
"lint-staged": "7.2.2",
163162
"module-alias": "2.0.0",
164163
"ncp": "2.0.0",
165-
"ng-packagr": "^19.0.0",
164+
"ng-packagr": "^20.3.2",
166165
"nyc": "14.1.1",
167166
"ora": "1.3.0",
168167
"prettier": "3.0.0",
@@ -173,19 +172,20 @@
173172
"rollup": "0.50.0",
174173
"rxjs-tslint-rules": "4.7.2",
175174
"sorcery": "0.10.0",
175+
"to-fast-properties": "^2.0.0",
176176
"ts-jest": "29.1.1",
177177
"ts-mockito": "2.3.1",
178178
"ts-node": "3.1.0",
179179
"typescript": "5.8.2",
180+
"typescript-eslint": "^8.0.0",
180181
"uglify-js": "3.1.9",
181-
"to-fast-properties": "^2.0.0",
182-
"zone.js": "0.15.1"
182+
"zone.js": "~0.16.0"
183183
},
184184
"dependencies": {
185-
"dexie": "2.0.4",
186-
"lodash-es": "4.17.15",
185+
"dexie": "^4.0.11",
186+
"lodash-es": "^4.17.21",
187187
"rxjs": "^7.8.0",
188-
"tsickle": "0.39.1",
188+
"tsickle": "^0.46.3",
189189
"tslib": "^2.6.0"
190190
},
191191
"version": "2.6.2"

projects/ngx-jsonapi-lib/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"license": "MIT",
1919
"homepage": "https://github.com/reyesoft/ngx-jsonapi#readme",
2020
"peerDependencies": {
21-
"@angular/animations": "^18.0.0 || ^19.0.0",
22-
"@angular/common": "^18.0.0 || ^19.0.0",
23-
"@angular/compiler": "^18.0.0 || ^19.0.0",
24-
"@angular/core": "^18.0.0 || ^19.0.0",
25-
"@angular/forms": "^18.0.0 || ^19.0.0",
26-
"@angular/platform-browser": "^18.0.0 || ^19.0.0",
27-
"@angular/platform-browser-dynamic": "^18.0.0 || ^19.0.0",
28-
"@angular/platform-server": "^18.0.0 || ^19.0.0",
29-
"@angular/router": "^18.0.0 || ^19.0.0",
21+
"@angular/animations": "^18.0.0 || ^19.0.0 || ^20.0.0",
22+
"@angular/common": "^18.0.0 || ^19.0.0 || ^20.0.0",
23+
"@angular/compiler": "^18.0.0 || ^19.0.0 || ^20.0.0",
24+
"@angular/core": "^18.0.0 || ^19.0.0 || ^20.0.0",
25+
"@angular/forms": "^18.0.0 || ^19.0.0 || ^20.0.0",
26+
"@angular/platform-browser": "^18.0.0 || ^19.0.0 || ^20.0.0",
27+
"@angular/platform-browser-dynamic": "^18.0.0 || ^19.0.0 || ^20.0.0",
28+
"@angular/platform-server": "^18.0.0 || ^19.0.0 || ^20.0.0",
29+
"@angular/router": "^18.0.0 || ^19.0.0 || ^20.0.0",
3030
"lodash-es": "^4.17",
31-
"dexie": "^2.0.4"
31+
"dexie": "^2.0.4 || ^4.0.0"
3232
},
3333
"sideEffects": false
3434
}

setup-jest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ try {
66
try {
77
require('zone.js/testing');
88
} catch (e) {}
9-
import 'jest-preset-angular';
9+
import 'jest-preset-angular/setup-jest';
1010
import 'fake-indexeddb/auto';
1111
import { TestBed } from '@angular/core/testing';
1212
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

0 commit comments

Comments
 (0)