Skip to content

Commit f8ed1f2

Browse files
authored
Merge pull request #76 from IgniteUI/vkombov/fix-22.0.x-issues
fix: update sample generation for Angular 22 compatibility
2 parents a4a53b8 + 638f5ad commit f8ed1f2

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

src/generators/SampleAssetsGenerator.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// tslint:disable:prefer-const
33
import * as fs from "fs";
44
import * as path from "path";
5-
import { DependencyResolver } from "./../services/DependencyResolver";
5+
import { DependencyResolver, DevDependencyResolver } from "./../services/DependencyResolver";
66

77
import { LiveEditingFile, SAMPLE_APP_FOLDER, SAMPLE_SRC_FOLDER } from "./misc/LiveEditingFile";
88
import { TsImportsService } from "../services/TsImportsService";
@@ -546,6 +546,14 @@ export class SampleAssetsGenerator {
546546
dependenciesString += `,\n ${replacement}`;
547547
}
548548
}
549+
// Update devDependencies in the template from the project's devDependencies
550+
const devDeps = new DevDependencyResolver().devDependencies;
551+
for (const pkg in devDeps) {
552+
const escapedPkg = pkg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
553+
const versionPattern = new RegExp(`"${escapedPkg}": "[^"]*"`, 'g');
554+
packageJsonFile = packageJsonFile.replace(versionPattern, `"${pkg}": "${devDeps[pkg]}"`);
555+
}
556+
549557
// Add packages without resolved versions
550558
for (const dep of dependencies) {
551559
if (!withVersions[dep]) {

src/services/DependencyResolver.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ const SHARED_DEV_DEPENDENCIES = {
2525
const DEPENDENCIES_WITH_FIXED_VERSION = {};
2626

2727
const SHARED_DEPENDENCIES = [
28+
"@angular/cdk",
2829
"@angular/common",
2930
"@angular/compiler",
3031
"@angular/core",
3132
"@angular/forms", // included in app.module.ts.template
3233
"@angular/platform-browser",
3334
"@angular/platform-browser-dynamic",
35+
"@angular/router",
3436
"rxjs",
3537
"zone.js",
3638

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{
22
"compileOnSave": false,
33
"compilerOptions": {
4-
"baseUrl": "./",
54
"outDir": "./dist/out-tsc",
65
"sourceMap": true,
76
"esModuleInterop": true,
87
"declaration": false,
9-
"experimentalDecorators": true,
10-
"module": "esnext",
8+
"module": "ES2022",
119
"moduleResolution": "bundler",
1210
"importHelpers": true,
1311
"target": "ES2022",
@@ -17,9 +15,11 @@
1715
"lib": [
1816
"es2022",
1917
"dom"
20-
]
21-
},
22-
"angularCompilerOptions": {
23-
"enableIvy": true
18+
],
19+
"skipLibCheck": true,
20+
"useDefineForClassFields": false,
21+
"strictPropertyInitialization": false,
22+
"strictNullChecks": false,
23+
"noImplicitAny": false
2424
}
2525
}

0 commit comments

Comments
 (0)