@openrewrite/recipes-angular 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -1
- package/dist/index.js.map +1 -1
- package/dist/libraries/cdk/find-cdk-signature-changes.d.ts +48 -0
- package/dist/libraries/cdk/find-cdk-signature-changes.d.ts.map +1 -0
- package/dist/libraries/cdk/find-cdk-signature-changes.js +323 -0
- package/dist/libraries/cdk/find-cdk-signature-changes.js.map +1 -0
- package/dist/libraries/cdk/find-removed-cdk-apis.d.ts +32 -0
- package/dist/libraries/cdk/find-removed-cdk-apis.d.ts.map +1 -0
- package/dist/libraries/cdk/find-removed-cdk-apis.js +75 -0
- package/dist/libraries/cdk/find-removed-cdk-apis.js.map +1 -0
- package/dist/libraries/cdk/migrate-cdk-sass-imports.d.ts +17 -0
- package/dist/libraries/cdk/migrate-cdk-sass-imports.d.ts.map +1 -0
- package/dist/libraries/cdk/migrate-cdk-sass-imports.js +177 -0
- package/dist/libraries/cdk/migrate-cdk-sass-imports.js.map +1 -0
- package/dist/libraries/cdk/migrate-cdk-stepper.d.ts +8 -0
- package/dist/libraries/cdk/migrate-cdk-stepper.d.ts.map +1 -0
- package/dist/libraries/cdk/migrate-cdk-stepper.js +92 -0
- package/dist/libraries/cdk/migrate-cdk-stepper.js.map +1 -0
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.d.ts +9 -0
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.d.ts.map +1 -0
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.js +57 -0
- package/dist/libraries/cdk/migrate-deprecated-overlay-sass.js.map +1 -0
- package/dist/libraries/cdk/migrate-drag-drop-registry.d.ts +8 -0
- package/dist/libraries/cdk/migrate-drag-drop-registry.d.ts.map +1 -0
- package/dist/libraries/cdk/migrate-drag-drop-registry.js +118 -0
- package/dist/libraries/cdk/migrate-drag-drop-registry.js.map +1 -0
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.d.ts +8 -0
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.d.ts.map +1 -0
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.js +74 -0
- package/dist/libraries/cdk/migrate-focus-trap-factory-create.js.map +1 -0
- package/dist/libraries/cdk/remove-cdk-super-arguments.d.ts +8 -0
- package/dist/libraries/cdk/remove-cdk-super-arguments.d.ts.map +1 -0
- package/dist/libraries/cdk/remove-cdk-super-arguments.js +111 -0
- package/dist/libraries/cdk/remove-cdk-super-arguments.js.map +1 -0
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.d.ts +8 -0
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.d.ts.map +1 -0
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.js +108 -0
- package/dist/libraries/cdk/remove-portal-factory-resolver-arguments.js.map +1 -0
- package/dist/libraries/cdk/remove-tilde-from-stylesheet-imports.d.ts +8 -0
- package/dist/libraries/cdk/remove-tilde-from-stylesheet-imports.d.ts.map +1 -0
- package/dist/libraries/cdk/remove-tilde-from-stylesheet-imports.js +27 -0
- package/dist/libraries/cdk/remove-tilde-from-stylesheet-imports.js.map +1 -0
- package/dist/libraries/cdk/rename-portal-template-selectors.d.ts +27 -0
- package/dist/libraries/cdk/rename-portal-template-selectors.d.ts.map +1 -0
- package/dist/libraries/cdk/rename-portal-template-selectors.js +75 -0
- package/dist/libraries/cdk/rename-portal-template-selectors.js.map +1 -0
- package/dist/libraries/cdk/upgrade-to-cdk.d.ts +38 -0
- package/dist/libraries/cdk/upgrade-to-cdk.d.ts.map +1 -0
- package/dist/libraries/cdk/upgrade-to-cdk.js +173 -0
- package/dist/libraries/cdk/upgrade-to-cdk.js.map +1 -0
- package/dist/libraries/components/lst.d.ts +9 -0
- package/dist/libraries/components/lst.d.ts.map +1 -0
- package/dist/libraries/components/lst.js +37 -0
- package/dist/libraries/components/lst.js.map +1 -0
- package/dist/libraries/components/stylesheets.d.ts +13 -0
- package/dist/libraries/components/stylesheets.d.ts.map +1 -0
- package/dist/libraries/components/stylesheets.js +71 -0
- package/dist/libraries/components/stylesheets.js.map +1 -0
- package/dist/libraries/components/symbols.d.ts +27 -0
- package/dist/libraries/components/symbols.d.ts.map +1 -0
- package/dist/libraries/components/symbols.js +120 -0
- package/dist/libraries/components/symbols.js.map +1 -0
- package/dist/libraries/components/templates.d.ts +24 -0
- package/dist/libraries/components/templates.d.ts.map +1 -0
- package/dist/libraries/components/templates.js +141 -0
- package/dist/libraries/components/templates.js.map +1 -0
- package/dist/libraries/primeng/18/mark-deprecated-components.d.ts.map +1 -1
- package/dist/libraries/primeng/18/mark-deprecated-components.js +9 -5
- package/dist/libraries/primeng/18/mark-deprecated-components.js.map +1 -1
- package/dist/migration/add-trust-proxy-headers.d.ts.map +1 -1
- package/dist/migration/add-trust-proxy-headers.js +2 -1
- package/dist/migration/add-trust-proxy-headers.js.map +1 -1
- package/dist/migration/migrate-to-solution-style-tsconfig.d.ts.map +1 -1
- package/dist/migration/migrate-to-solution-style-tsconfig.js +6 -8
- package/dist/migration/migrate-to-solution-style-tsconfig.js.map +1 -1
- package/dist/migration/replace-angular-http-imports.js +1 -1
- package/dist/migration/replace-angular-http-imports.js.map +1 -1
- package/dist/migration/replace-initial-navigation.d.ts.map +1 -1
- package/dist/migration/replace-initial-navigation.js +2 -2
- package/dist/migration/replace-initial-navigation.js.map +1 -1
- package/dist/migration/replace-node-sass-with-sass.d.ts.map +1 -1
- package/dist/migration/replace-node-sass-with-sass.js +5 -2
- package/dist/migration/replace-node-sass-with-sass.js.map +1 -1
- package/dist/migration/update-component-template-url.js +1 -1
- package/dist/migration/update-component-template-url.js.map +1 -1
- package/dist/migration/upgrade-angular-dependencies.d.ts +3 -0
- package/dist/migration/upgrade-angular-dependencies.d.ts.map +1 -0
- package/dist/migration/upgrade-angular-dependencies.js +25 -0
- package/dist/migration/upgrade-angular-dependencies.js.map +1 -0
- package/dist/migration/upgrade-to-angular-10.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-10.js +14 -17
- package/dist/migration/upgrade-to-angular-10.js.map +1 -1
- package/dist/migration/upgrade-to-angular-11.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-11.js +14 -17
- package/dist/migration/upgrade-to-angular-11.js.map +1 -1
- package/dist/migration/upgrade-to-angular-12.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-12.js +12 -14
- package/dist/migration/upgrade-to-angular-12.js.map +1 -1
- package/dist/migration/upgrade-to-angular-13.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-13.js +14 -14
- package/dist/migration/upgrade-to-angular-13.js.map +1 -1
- package/dist/migration/upgrade-to-angular-14.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-14.js +14 -14
- package/dist/migration/upgrade-to-angular-14.js.map +1 -1
- package/dist/migration/upgrade-to-angular-15.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-15.js +11 -12
- package/dist/migration/upgrade-to-angular-15.js.map +1 -1
- package/dist/migration/upgrade-to-angular-16.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-16.js +12 -13
- package/dist/migration/upgrade-to-angular-16.js.map +1 -1
- package/dist/migration/upgrade-to-angular-17.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-17.js +14 -14
- package/dist/migration/upgrade-to-angular-17.js.map +1 -1
- package/dist/migration/upgrade-to-angular-18.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-18.js +12 -13
- package/dist/migration/upgrade-to-angular-18.js.map +1 -1
- package/dist/migration/upgrade-to-angular-19.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-19.js +12 -13
- package/dist/migration/upgrade-to-angular-19.js.map +1 -1
- package/dist/migration/upgrade-to-angular-20.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-20.js +13 -12
- package/dist/migration/upgrade-to-angular-20.js.map +1 -1
- package/dist/migration/upgrade-to-angular-21.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-21.js +13 -12
- package/dist/migration/upgrade-to-angular-21.js.map +1 -1
- package/dist/migration/upgrade-to-angular-22.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-22.js +13 -12
- package/dist/migration/upgrade-to-angular-22.js.map +1 -1
- package/dist/migration/upgrade-to-angular-9.d.ts.map +1 -1
- package/dist/migration/upgrade-to-angular-9.js +14 -17
- package/dist/migration/upgrade-to-angular-9.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +97 -0
- package/src/libraries/cdk/find-cdk-signature-changes.ts +209 -0
- package/src/libraries/cdk/find-removed-cdk-apis.ts +76 -0
- package/src/libraries/cdk/migrate-cdk-sass-imports.ts +174 -0
- package/src/libraries/cdk/migrate-cdk-stepper.ts +58 -0
- package/src/libraries/cdk/migrate-deprecated-overlay-sass.ts +56 -0
- package/src/libraries/cdk/migrate-drag-drop-registry.ts +79 -0
- package/src/libraries/cdk/migrate-focus-trap-factory-create.ts +51 -0
- package/src/libraries/cdk/remove-cdk-super-arguments.ts +83 -0
- package/src/libraries/cdk/remove-portal-factory-resolver-arguments.ts +88 -0
- package/src/libraries/cdk/remove-tilde-from-stylesheet-imports.ts +22 -0
- package/src/libraries/cdk/rename-portal-template-selectors.ts +51 -0
- package/src/libraries/cdk/upgrade-to-cdk.ts +146 -0
- package/src/libraries/components/lst.ts +33 -0
- package/src/libraries/components/stylesheets.ts +55 -0
- package/src/libraries/components/symbols.ts +116 -0
- package/src/libraries/components/templates.ts +126 -0
- package/src/libraries/primeng/18/mark-deprecated-components.ts +8 -4
- package/src/migration/add-trust-proxy-headers.ts +2 -1
- package/src/migration/migrate-to-solution-style-tsconfig.ts +10 -9
- package/src/migration/replace-angular-http-imports.ts +2 -2
- package/src/migration/replace-initial-navigation.ts +3 -1
- package/src/migration/replace-node-sass-with-sass.ts +6 -3
- package/src/migration/update-component-template-url.ts +1 -1
- package/src/migration/upgrade-angular-dependencies.ts +28 -0
- package/src/migration/upgrade-to-angular-10.ts +14 -17
- package/src/migration/upgrade-to-angular-11.ts +14 -17
- package/src/migration/upgrade-to-angular-12.ts +12 -14
- package/src/migration/upgrade-to-angular-13.ts +14 -14
- package/src/migration/upgrade-to-angular-14.ts +14 -14
- package/src/migration/upgrade-to-angular-15.ts +11 -12
- package/src/migration/upgrade-to-angular-16.ts +13 -14
- package/src/migration/upgrade-to-angular-17.ts +14 -14
- package/src/migration/upgrade-to-angular-18.ts +13 -14
- package/src/migration/upgrade-to-angular-19.ts +13 -14
- package/src/migration/upgrade-to-angular-20.ts +13 -12
- package/src/migration/upgrade-to-angular-21.ts +13 -12
- package/src/migration/upgrade-to-angular-22.ts +13 -12
- package/src/migration/upgrade-to-angular-9.ts +14 -17
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {emptyMarkers, randomId} from "@openrewrite/rewrite";
|
|
8
|
+
import {JS} from "@openrewrite/rewrite/javascript";
|
|
9
|
+
import {emptySpace, Expression, isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
|
+
|
|
11
|
+
/** The argument list of a call without arguments, which the LST represents as one `J.Empty`. */
|
|
12
|
+
export function emptyArguments(container: J.Container<Expression>): J.Container<Expression> {
|
|
13
|
+
const empty: J.Empty = {kind: J.Kind.Empty, id: randomId(), prefix: emptySpace, markers: emptyMarkers};
|
|
14
|
+
return {
|
|
15
|
+
...container,
|
|
16
|
+
elements: [{kind: J.Kind.RightPadded, element: empty, after: emptySpace, markers: emptyMarkers} as J.RightPadded<Expression>],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The simple name of the class a class declaration extends, with any type arguments stripped. */
|
|
21
|
+
export function extendedClassName(classDecl: J.ClassDeclaration): string | undefined {
|
|
22
|
+
let extended: J | undefined = classDecl.extends?.element;
|
|
23
|
+
if (extended?.kind === JS.Kind.TypeTreeExpression) extended = (extended as JS.TypeTreeExpression).expression;
|
|
24
|
+
if (extended?.kind === JS.Kind.ExpressionWithTypeArguments) extended = (extended as JS.ExpressionWithTypeArguments).clazz;
|
|
25
|
+
if (extended?.kind === J.Kind.ParameterizedType) extended = (extended as J.ParameterizedType).class;
|
|
26
|
+
return extended && isIdentifier(extended) ? extended.simpleName : undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Whether a function call is a `super(...)` constructor call. */
|
|
30
|
+
export function isSuperCall(call: JS.FunctionCall): boolean {
|
|
31
|
+
const fn = call.function?.element;
|
|
32
|
+
return fn !== undefined && isIdentifier(fn) && fn.simpleName === 'super';
|
|
33
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {PlainText, PlainTextVisitor} from "@openrewrite/rewrite/text";
|
|
9
|
+
|
|
10
|
+
const COMMENT = /\/\*[\s\S]*?\*\/|\/\/[^\n]*/g;
|
|
11
|
+
const COMMENT_PLACEHOLDER = /__ngComment(\d+)__/g;
|
|
12
|
+
|
|
13
|
+
/** Rewrites the text of `.scss` and `.css` files, the stylesheets the Angular CLI compiles with Sass. */
|
|
14
|
+
export abstract class StylesheetRecipe extends Recipe {
|
|
15
|
+
protected abstract migrate(content: string): string;
|
|
16
|
+
|
|
17
|
+
protected acceptsPath(sourcePath: string): boolean {
|
|
18
|
+
return isStylesheet(sourcePath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
22
|
+
const migrate = (content: string) => this.migrate(content);
|
|
23
|
+
const acceptsPath = (sourcePath: string) => this.acceptsPath(sourcePath);
|
|
24
|
+
return new class extends PlainTextVisitor<ExecutionContext> {
|
|
25
|
+
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
26
|
+
const t = await super.visitText(text, p) as PlainText;
|
|
27
|
+
if (!t || !acceptsPath(t.sourcePath)) return t;
|
|
28
|
+
const updated = migrate(t.text);
|
|
29
|
+
return updated === t.text ? t : {...t, text: updated, snippets: []};
|
|
30
|
+
}
|
|
31
|
+
}();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isStylesheet(sourcePath: string): boolean {
|
|
36
|
+
return sourcePath.endsWith('.scss') || sourcePath.endsWith('.css');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Applies `migrate` to a stylesheet with its comments masked, so commented-out code stays as written. */
|
|
40
|
+
export function withoutComments(content: string, migrate: (masked: string) => string): string {
|
|
41
|
+
const comments: string[] = [];
|
|
42
|
+
const masked = content.replace(COMMENT, comment => {
|
|
43
|
+
comments.push(comment);
|
|
44
|
+
return `__ngComment${comments.length - 1}__`;
|
|
45
|
+
});
|
|
46
|
+
return migrate(masked).replace(COMMENT_PLACEHOLDER, (_, index) => comments[Number(index)]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function maskComments(content: string): string {
|
|
50
|
+
return content.replace(COMMENT, '');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function escapeRegExp(value: string): string {
|
|
54
|
+
return value.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
55
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {ExecutionContext, findMarker, foundSearchResult, MarkersKind, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {ChangeImport, JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
|
+
import {isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
|
+
|
|
11
|
+
/** An exported symbol of an `angular/components` entry point that a major version renamed. */
|
|
12
|
+
export interface RenamedSymbol {
|
|
13
|
+
module: string;
|
|
14
|
+
name: string;
|
|
15
|
+
newName: string;
|
|
16
|
+
newModule?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** An exported symbol of an `angular/components` entry point that a major version removed. */
|
|
20
|
+
export interface RemovedSymbol {
|
|
21
|
+
module: string;
|
|
22
|
+
name: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** One `ChangeImport` per renamed symbol, which also carries every reference bound to the import. */
|
|
27
|
+
export function renameSymbols(symbols: RenamedSymbol[]): Recipe[] {
|
|
28
|
+
return symbols.map(s => new ChangeImport({
|
|
29
|
+
oldModule: s.module,
|
|
30
|
+
oldMember: s.name,
|
|
31
|
+
newModule: s.newModule ?? s.module,
|
|
32
|
+
newMember: s.newName,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Local names that the imports of a compilation unit bind to the given symbols of the given module. */
|
|
37
|
+
export function importedNames(cu: JS.CompilationUnit, module: string, symbols: string[]): Map<string, string> {
|
|
38
|
+
const names = new Map<string, string>();
|
|
39
|
+
for (const statement of cu.statements) {
|
|
40
|
+
const imp = statement.element;
|
|
41
|
+
if (imp.kind !== JS.Kind.Import) continue;
|
|
42
|
+
const named = (imp as JS.Import).importClause?.namedBindings;
|
|
43
|
+
if (moduleOf(imp as JS.Import) !== module || named?.kind !== JS.Kind.NamedImports) continue;
|
|
44
|
+
for (const element of (named as JS.NamedImports).elements.elements) {
|
|
45
|
+
const spec = element.element as JS.ImportSpecifier;
|
|
46
|
+
const imported = importedName(spec);
|
|
47
|
+
if (imported && symbols.includes(imported)) {
|
|
48
|
+
names.set(localName(spec) ?? imported, imported);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return names;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Marks named imports of removed symbols, so a removed API shows up at the import that pulls it in.
|
|
57
|
+
*/
|
|
58
|
+
export abstract class FindRemovedSymbols extends Recipe {
|
|
59
|
+
protected abstract readonly symbols: RemovedSymbol[];
|
|
60
|
+
|
|
61
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
62
|
+
const symbols = this.symbols;
|
|
63
|
+
return new class extends JavaScriptVisitor<ExecutionContext> {
|
|
64
|
+
protected async visitImportDeclaration(jsImport: JS.Import, p: ExecutionContext): Promise<J | undefined> {
|
|
65
|
+
const imp = await super.visitImportDeclaration(jsImport, p) as JS.Import;
|
|
66
|
+
const module = moduleOf(imp);
|
|
67
|
+
const named = imp.importClause?.namedBindings;
|
|
68
|
+
if (!module || named?.kind !== JS.Kind.NamedImports) return imp;
|
|
69
|
+
|
|
70
|
+
const removed = symbols.filter(s => s.module === module);
|
|
71
|
+
if (removed.length === 0) return imp;
|
|
72
|
+
|
|
73
|
+
const namedImports = named as JS.NamedImports;
|
|
74
|
+
let changed = false;
|
|
75
|
+
const elements = await Promise.all(namedImports.elements.elements.map(async element => {
|
|
76
|
+
const spec = element.element as JS.ImportSpecifier;
|
|
77
|
+
const symbol = removed.find(s => s.name === importedName(spec));
|
|
78
|
+
if (!symbol || findMarker(spec, MarkersKind.SearchResult)) return element;
|
|
79
|
+
changed = true;
|
|
80
|
+
return {...element, element: foundSearchResult(spec, symbol.message)};
|
|
81
|
+
}));
|
|
82
|
+
if (!changed) return imp;
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
...imp,
|
|
86
|
+
importClause: {
|
|
87
|
+
...imp.importClause!,
|
|
88
|
+
namedBindings: {...namedImports, elements: {...namedImports.elements, elements}},
|
|
89
|
+
},
|
|
90
|
+
} as JS.Import;
|
|
91
|
+
}
|
|
92
|
+
}();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function moduleOf(imp: JS.Import): string | undefined {
|
|
97
|
+
const specifier = imp.moduleSpecifier?.element;
|
|
98
|
+
return specifier?.kind === J.Kind.Literal ? (specifier as J.Literal).value as string : undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function importedName(spec: JS.ImportSpecifier): string | undefined {
|
|
102
|
+
const specifier = spec.specifier;
|
|
103
|
+
if (isIdentifier(specifier)) return specifier.simpleName;
|
|
104
|
+
if (specifier.kind === JS.Kind.Alias) {
|
|
105
|
+
const propertyName = (specifier as JS.Alias).propertyName.element;
|
|
106
|
+
return isIdentifier(propertyName) ? propertyName.simpleName : undefined;
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function localName(spec: JS.ImportSpecifier): string | undefined {
|
|
112
|
+
const specifier = spec.specifier;
|
|
113
|
+
if (specifier.kind !== JS.Kind.Alias) return undefined;
|
|
114
|
+
const alias = (specifier as JS.Alias).alias;
|
|
115
|
+
return isIdentifier(alias) ? alias.simpleName : undefined;
|
|
116
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {Cursor, ExecutionContext, Recipe, Tree, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
+
import {PlainText, PlainTextVisitor} from "@openrewrite/rewrite/text";
|
|
9
|
+
import {JavaScriptVisitor} from "@openrewrite/rewrite/javascript";
|
|
10
|
+
import {isIdentifier, isLiteral, J} from "@openrewrite/rewrite/java";
|
|
11
|
+
import {create} from "mutative";
|
|
12
|
+
import {escapeRegExp} from "./stylesheets";
|
|
13
|
+
|
|
14
|
+
/** A directive selector or input that a major version renamed, as it appears in a template attribute. */
|
|
15
|
+
export interface TemplateAttributeRename {
|
|
16
|
+
name: string;
|
|
17
|
+
newName: string;
|
|
18
|
+
/** Restricts the rename to elements with this tag name. */
|
|
19
|
+
element?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A directive `exportAs` name that a major version renamed, as it appears in a template reference variable. */
|
|
23
|
+
export interface TemplateExportAsRename {
|
|
24
|
+
name: string;
|
|
25
|
+
newName: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Renames attributes and `exportAs` references in `.html` templates and in inline `template` metadata.
|
|
30
|
+
*/
|
|
31
|
+
export abstract class RenameTemplateAttributes extends Recipe {
|
|
32
|
+
protected abstract readonly attributes: TemplateAttributeRename[];
|
|
33
|
+
protected readonly exportAs: TemplateExportAsRename[] = [];
|
|
34
|
+
|
|
35
|
+
async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
36
|
+
const migrate = (template: string) => renameTemplateAttributes(template, this.attributes, this.exportAs);
|
|
37
|
+
const html = new class extends PlainTextVisitor<ExecutionContext> {
|
|
38
|
+
override async visitText(text: PlainText, p: ExecutionContext): Promise<PlainText | undefined> {
|
|
39
|
+
const t = await super.visitText(text, p) as PlainText;
|
|
40
|
+
if (!t || !t.sourcePath.endsWith('.html')) return t;
|
|
41
|
+
const updated = migrate(t.text);
|
|
42
|
+
return updated === t.text ? t : {...t, text: updated, snippets: []};
|
|
43
|
+
}
|
|
44
|
+
}();
|
|
45
|
+
const inline = new class extends JavaScriptVisitor<ExecutionContext> {
|
|
46
|
+
protected async visitPropertyAssignment(property: any, p: ExecutionContext): Promise<J | undefined> {
|
|
47
|
+
const prop = await super.visitPropertyAssignment(property, p) as any;
|
|
48
|
+
const name = prop?.name?.element;
|
|
49
|
+
if (!isIdentifier(name) || name.simpleName !== 'template') return prop;
|
|
50
|
+
|
|
51
|
+
const initializer = prop.initializer;
|
|
52
|
+
if (!initializer || !isLiteral(initializer) || typeof initializer.value !== 'string') return prop;
|
|
53
|
+
const valueSource = migrate(initializer.valueSource ?? '');
|
|
54
|
+
if (valueSource === initializer.valueSource) return prop;
|
|
55
|
+
|
|
56
|
+
return create(prop, (draft: any) => {
|
|
57
|
+
draft.initializer.valueSource = valueSource;
|
|
58
|
+
draft.initializer.value = migrate(initializer.value as string);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}();
|
|
62
|
+
// Each visitor returns a source file it does not accept unchanged.
|
|
63
|
+
return new class extends TreeVisitor<any, ExecutionContext> {
|
|
64
|
+
async visit<R extends Tree>(tree: Tree, p: ExecutionContext, parent?: Cursor): Promise<R | undefined> {
|
|
65
|
+
const visited = await html.visit<Tree>(tree, p, parent);
|
|
66
|
+
return visited && await inline.visit(visited, p, parent) as R | undefined;
|
|
67
|
+
}
|
|
68
|
+
}();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Renames attributes inside opening tags and `exportAs` values of reference variables. */
|
|
73
|
+
export function renameTemplateAttributes(template: string, attributes: TemplateAttributeRename[],
|
|
74
|
+
exportAs: TemplateExportAsRename[] = []): string {
|
|
75
|
+
if (![...attributes, ...exportAs].some(r => template.includes(r.name))) return template;
|
|
76
|
+
return mapOpeningTags(template, (tagName, attrs) => {
|
|
77
|
+
let updated = attrs;
|
|
78
|
+
for (const rename of attributes) {
|
|
79
|
+
if (rename.element && rename.element !== tagName) continue;
|
|
80
|
+
updated = renameAttribute(updated, rename.name, rename.newName);
|
|
81
|
+
}
|
|
82
|
+
for (const rename of exportAs) {
|
|
83
|
+
updated = updated.replace(
|
|
84
|
+
new RegExp(`((?:^|\\s)(?:#|ref-)[\\w-]+\\s*=\\s*)(["'])${escapeRegExp(rename.name)}\\2`, 'g'),
|
|
85
|
+
`$1$2${rename.newName}$2`);
|
|
86
|
+
}
|
|
87
|
+
return updated;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Renames a plain, `[input]`, `(output)`, `[(model)]` or `*structural` attribute, leaving attribute values alone. */
|
|
92
|
+
function renameAttribute(attrs: string, name: string, newName: string): string {
|
|
93
|
+
const pattern = new RegExp(`(^|\\s)(\\[\\(|\\[|\\(|\\*)?${escapeRegExp(name)}(?=[\\s=\\])/]|$)`, 'g');
|
|
94
|
+
return mapOutsideQuotes(attrs, segment => segment.replace(pattern, `$1$2${newName}`));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Calls `fn` for the attribute text of every opening tag, honoring quoted attribute values that contain `>`. */
|
|
98
|
+
function mapOpeningTags(template: string, fn: (tagName: string, attrs: string) => string): string {
|
|
99
|
+
let result = '';
|
|
100
|
+
let index = 0;
|
|
101
|
+
const tagStart = /<([a-zA-Z][\w-]*)/g;
|
|
102
|
+
let match: RegExpExecArray | null;
|
|
103
|
+
while ((match = tagStart.exec(template)) !== null) {
|
|
104
|
+
const attrsStart = match.index + match[0].length;
|
|
105
|
+
let quote: string | undefined;
|
|
106
|
+
let end = attrsStart;
|
|
107
|
+
for (; end < template.length; end++) {
|
|
108
|
+
const c = template[end];
|
|
109
|
+
if (quote) {
|
|
110
|
+
if (c === quote) quote = undefined;
|
|
111
|
+
} else if (c === '"' || c === "'") {
|
|
112
|
+
quote = c;
|
|
113
|
+
} else if (c === '>') {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
result += template.slice(index, attrsStart) + fn(match[1], template.slice(attrsStart, end));
|
|
118
|
+
index = end;
|
|
119
|
+
tagStart.lastIndex = end;
|
|
120
|
+
}
|
|
121
|
+
return result + template.slice(index);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function mapOutsideQuotes(text: string, fn: (segment: string) => string): string {
|
|
125
|
+
return text.split(/("[^"]*"|'[^']*')/).map((part, i) => i % 2 === 0 ? fn(part) : part).join('');
|
|
126
|
+
}
|
|
@@ -77,9 +77,13 @@ export class MarkDeprecatedPrimengComponents extends Recipe {
|
|
|
77
77
|
const deprecation = DEPRECATED_MODULES[moduleName];
|
|
78
78
|
if (!deprecation) return imp;
|
|
79
79
|
|
|
80
|
-
// Idempotence: skip if our TODO marker is already attached.
|
|
80
|
+
// Idempotence: skip if our TODO marker is already attached. Comments leading the
|
|
81
|
+
// file's first statement are parsed into the compilation unit's prefix instead.
|
|
81
82
|
const existingComments = imp.prefix?.comments ?? [];
|
|
82
|
-
|
|
83
|
+
const cu = this.cursor.firstEnclosing<JS.CompilationUnit>((o: any): o is JS.CompilationUnit => o?.kind === JS.Kind.CompilationUnit);
|
|
84
|
+
const fileLeadingComments = cu?.statements[0]?.element.id === imp.id ? cu.prefix.comments : [];
|
|
85
|
+
const todoMarker = `TODO: PrimeNG 18 — ${deprecation.todo}`;
|
|
86
|
+
if ([...existingComments, ...fileLeadingComments].some(c => (c as any).text?.includes(todoMarker))) {
|
|
83
87
|
return imp;
|
|
84
88
|
}
|
|
85
89
|
|
|
@@ -95,7 +99,7 @@ export class MarkDeprecatedPrimengComponents extends Recipe {
|
|
|
95
99
|
}
|
|
96
100
|
if (importedNames.length === 0) return imp;
|
|
97
101
|
|
|
98
|
-
const sourcePath =
|
|
102
|
+
const sourcePath = cu?.sourcePath ?? '';
|
|
99
103
|
for (const name of importedNames) {
|
|
100
104
|
dataTable.insertRow(p, {
|
|
101
105
|
sourcePath,
|
|
@@ -109,7 +113,7 @@ export class MarkDeprecatedPrimengComponents extends Recipe {
|
|
|
109
113
|
const todoComment = {
|
|
110
114
|
kind: J.Kind.TextComment,
|
|
111
115
|
multiline: true,
|
|
112
|
-
text: `
|
|
116
|
+
text: ` ${todoMarker} (import: \`{ ${importedNames.join(', ')} } from '${moduleName}'\`) `,
|
|
113
117
|
suffix: '\n',
|
|
114
118
|
markers: {kind: 'org.openrewrite.marker.Markers', id: imp.id, markers: []},
|
|
115
119
|
};
|
|
@@ -40,7 +40,8 @@ export class AddTrustProxyHeaders extends Recipe {
|
|
|
40
40
|
|
|
41
41
|
let builder = Template.builder().code(`new ${engine}({\n ${TODO_COMMENT}\n trustProxyHeaders: ['x-forwarded-host', 'x-forwarded-proto'],`);
|
|
42
42
|
for (const statement of existing) {
|
|
43
|
-
|
|
43
|
+
// As a list, the option takes the place of the template's property rather than becoming its name
|
|
44
|
+
builder = builder.code('\n ').param([statement.element]).code(',');
|
|
44
45
|
}
|
|
45
46
|
const t = builder.code('\n})').build();
|
|
46
47
|
return await t.apply(n, this.cursor);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {ExecutionContext, ScanningRecipe, SourceFile, Tree, TreePrinters, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
-
import {isJson, Json, JsonParser, JsonVisitor, getMemberKeyName, isLiteral} from "@openrewrite/rewrite/json";
|
|
8
|
+
import {isJson, Json, JsonParser, JsonVisitor, getMemberKeyName, isLiteral, isObject} from "@openrewrite/rewrite/json";
|
|
9
9
|
|
|
10
10
|
interface Accumulator {
|
|
11
11
|
originalTsconfigContent: string | null;
|
|
@@ -53,14 +53,15 @@ export class MigrateToSolutionStyleTsconfig extends ScanningRecipe<Accumulator>
|
|
|
53
53
|
return doc;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
if (/^tsconfig\.\w+\.json$/.test(doc.sourcePath)) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
if (/^tsconfig\.\w+\.json$/.test(doc.sourcePath) && isObject(doc.value)) {
|
|
57
|
+
// TypeScript configs commonly contain comments or trailing commas. The parser has already
|
|
58
|
+
// read JSONC; JSON.parse(print(doc)) would silently miss these extending configurations.
|
|
59
|
+
const extending = doc.value.members.map(padded => padded.element).find(member =>
|
|
60
|
+
member.kind === Json.Kind.Member && getMemberKeyName(member as Json.Member) === 'extends'
|
|
61
|
+
) as Json.Member | undefined;
|
|
62
|
+
if (extending && isLiteral(extending.value) && extending.value.value === './tsconfig.json') {
|
|
63
|
+
acc.extendingPaths.push(doc.sourcePath);
|
|
64
|
+
}
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
return doc;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
|
-
import {JavaScriptVisitor, JS, maybeRebind, maybeUnbind} from "@openrewrite/rewrite/javascript";
|
|
8
|
+
import {JavaScriptVisitor, JS, maybeRebind, maybeUnbind, moduleExportName} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
import {isIdentifier, J} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {isHttpReceiver, isOldShapeRequest, moduleOf, NEW_MODULE, OLD_MODULE, usesOldTestingModule} from "./angular-http-support";
|
|
11
11
|
|
|
@@ -60,7 +60,7 @@ export class ReplaceAngularHttpImports extends Recipe {
|
|
|
60
60
|
for (const specifier of (namedBindings as JS.NamedImports).elements.elements) {
|
|
61
61
|
const named = (specifier.element as JS.ImportSpecifier).specifier;
|
|
62
62
|
const member = named.kind === JS.Kind.Alias
|
|
63
|
-
? (named as JS.Alias).propertyName.element
|
|
63
|
+
? moduleExportName((named as JS.Alias).propertyName.element)
|
|
64
64
|
: isIdentifier(named) ? (named as J.Identifier).simpleName : undefined;
|
|
65
65
|
if (member === undefined || (member === "Http" && this.keepsHttp)) continue;
|
|
66
66
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {ExecutionContext, Recipe, TreeVisitor} from "@openrewrite/rewrite";
|
|
8
8
|
import {JavaScriptVisitor, JS} from "@openrewrite/rewrite/javascript";
|
|
9
|
-
import {J, isIdentifier, isLiteral} from "@openrewrite/rewrite/java";
|
|
9
|
+
import {J, isIdentifier, isLiteral, Type} from "@openrewrite/rewrite/java";
|
|
10
10
|
import {create} from "mutative";
|
|
11
11
|
|
|
12
12
|
export class ReplaceInitialNavigation extends Recipe {
|
|
@@ -52,6 +52,7 @@ export class ReplaceInitialNavigation extends Recipe {
|
|
|
52
52
|
...lit,
|
|
53
53
|
value: 'enabledBlocking',
|
|
54
54
|
valueSource: `'enabledBlocking'`,
|
|
55
|
+
type: Type.Primitive.String,
|
|
55
56
|
};
|
|
56
57
|
}) as JS.PropertyAssignment;
|
|
57
58
|
}
|
|
@@ -61,6 +62,7 @@ export class ReplaceInitialNavigation extends Recipe {
|
|
|
61
62
|
...lit,
|
|
62
63
|
value: 'disabled',
|
|
63
64
|
valueSource: `'disabled'`,
|
|
65
|
+
type: Type.Primitive.String,
|
|
64
66
|
};
|
|
65
67
|
}) as JS.PropertyAssignment;
|
|
66
68
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
-
import {
|
|
8
|
+
import {changeDependency} from "@openrewrite/rewrite/javascript";
|
|
9
9
|
|
|
10
10
|
export class ReplaceNodeSassWithSass extends Recipe {
|
|
11
11
|
readonly name = "org.openrewrite.angular.migration.replace-node-sass-with-sass";
|
|
@@ -15,8 +15,11 @@ export class ReplaceNodeSassWithSass extends Recipe {
|
|
|
15
15
|
|
|
16
16
|
async recipeList(): Promise<Recipe[]> {
|
|
17
17
|
return [
|
|
18
|
-
await
|
|
19
|
-
|
|
18
|
+
await changeDependency({
|
|
19
|
+
oldPackageName: "node-sass",
|
|
20
|
+
newPackageName: "sass",
|
|
21
|
+
newVersion: "^1.35.0",
|
|
22
|
+
}),
|
|
20
23
|
];
|
|
21
24
|
}
|
|
22
25
|
}
|
|
@@ -41,7 +41,7 @@ export class UpdateComponentTemplateUrl extends Recipe {
|
|
|
41
41
|
|
|
42
42
|
@Option({
|
|
43
43
|
displayName: "Use regex pattern",
|
|
44
|
-
description: "If `true`, treats `oldTemplateUrl` as a regex pattern and supports capture groups in `newTemplateUrl`. Default: `false`",
|
|
44
|
+
description: "If `true`, treats `oldTemplateUrl` as a regex pattern and supports capture groups in `newTemplateUrl`. The pattern should not match the new URL, or every run rewrites it again. Default: `false`",
|
|
45
45
|
example: "true",
|
|
46
46
|
required: false
|
|
47
47
|
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 the original author or authors.
|
|
3
|
+
*
|
|
4
|
+
* Moderne Proprietary. Only for use by Moderne customers under the terms of a commercial contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
+
import {prepareJavaRecipe} from "@openrewrite/rewrite/rpc";
|
|
9
|
+
|
|
10
|
+
// Upgrade the maintained framework and tooling packages, rather than every package in the scope.
|
|
11
|
+
// For example, @angular/flex-layout ended at 15.0.0-beta.42 and has no Angular 16 release.
|
|
12
|
+
const angularPackages = [
|
|
13
|
+
"animations", "common", "compiler", "compiler-cli", "core", "elements", "forms",
|
|
14
|
+
"language-service", "localize", "platform-browser", "platform-browser-dynamic",
|
|
15
|
+
"platform-server", "router", "service-worker", "ssr", "upgrade", "cli", "build",
|
|
16
|
+
"cdk", "cdk-experimental", "material", "material-experimental", "material-date-fns-adapter",
|
|
17
|
+
"material-luxon-adapter", "material-moment-adapter", "google-maps", "youtube-player",
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export function upgradeAngularDependencies(major: number, versions: Record<string, string>): Promise<Recipe> {
|
|
21
|
+
return prepareJavaRecipe("org.openrewrite.javascript.UpgradeDependencyVersions", {
|
|
22
|
+
versions: {
|
|
23
|
+
...Object.fromEntries(angularPackages.map(name => [`@angular/${name}`, `${major}.x`])),
|
|
24
|
+
...versions,
|
|
25
|
+
},
|
|
26
|
+
reconcileNpmPeerDependencies: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
-
import {
|
|
8
|
+
import {upgradeAngularDependencies} from "./upgrade-angular-dependencies";
|
|
9
9
|
import {UpgradeToAngular9CodeChanges} from "./upgrade-to-angular-9";
|
|
10
10
|
import {RemoveEs5BrowserSupport} from "./remove-es5-browser-support";
|
|
11
11
|
import {FindBareModuleWithProviders} from "../search/find-bare-module-with-providers";
|
|
@@ -47,22 +47,19 @@ export class UpgradeToAngular10 extends Recipe {
|
|
|
47
47
|
async recipeList(): Promise<Recipe[]> {
|
|
48
48
|
return [
|
|
49
49
|
new UpgradeToAngular10CodeChanges(),
|
|
50
|
-
// Angular
|
|
51
|
-
await
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await upgradeDependencyVersion({packageName: "typescript", newVersion: "3.9.x"}),
|
|
64
|
-
// tslib
|
|
65
|
-
await upgradeDependencyVersion({packageName: "tslib", newVersion: "2.x"}),
|
|
50
|
+
// Resolve the aligned Angular, DevKit and compiler upgrades as one dependency edit.
|
|
51
|
+
await upgradeAngularDependencies(10, {
|
|
52
|
+
"@angular-devkit/core": "10.x",
|
|
53
|
+
"@angular-devkit/schematics": "10.x",
|
|
54
|
+
"@angular-devkit/build-angular": "0.1002.x",
|
|
55
|
+
"@angular-devkit/schematics-cli": "0.1002.x",
|
|
56
|
+
"@angular-devkit/architect*": "0.1002.x",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1002.x",
|
|
58
|
+
"@schematics/angular": "10.x",
|
|
59
|
+
"zone.js": "0.10.x",
|
|
60
|
+
"typescript": "3.9.x",
|
|
61
|
+
"tslib": "2.x",
|
|
62
|
+
}),
|
|
66
63
|
];
|
|
67
64
|
}
|
|
68
65
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {Recipe} from "@openrewrite/rewrite";
|
|
8
|
-
import {
|
|
8
|
+
import {upgradeAngularDependencies} from "./upgrade-angular-dependencies";
|
|
9
9
|
import {UpgradeToAngular10CodeChanges} from "./upgrade-to-angular-10";
|
|
10
10
|
import {ReplaceViewEncapsulationNative} from "./replace-view-encapsulation-native";
|
|
11
11
|
import {RemoveExtractCss} from "./remove-extract-css";
|
|
@@ -47,22 +47,19 @@ export class UpgradeToAngular11 extends Recipe {
|
|
|
47
47
|
async recipeList(): Promise<Recipe[]> {
|
|
48
48
|
return [
|
|
49
49
|
new UpgradeToAngular11CodeChanges(),
|
|
50
|
-
// Angular
|
|
51
|
-
await
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await upgradeDependencyVersion({packageName: "typescript", newVersion: "4.0.x"}),
|
|
64
|
-
// tslib
|
|
65
|
-
await upgradeDependencyVersion({packageName: "tslib", newVersion: "2.x"}),
|
|
50
|
+
// Resolve the aligned Angular, DevKit and compiler upgrades as one dependency edit.
|
|
51
|
+
await upgradeAngularDependencies(11, {
|
|
52
|
+
"@angular-devkit/core": "11.x",
|
|
53
|
+
"@angular-devkit/schematics": "11.x",
|
|
54
|
+
"@angular-devkit/build-angular": "0.1102.x",
|
|
55
|
+
"@angular-devkit/schematics-cli": "0.1102.x",
|
|
56
|
+
"@angular-devkit/architect*": "0.1102.x",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1102.x",
|
|
58
|
+
"@schematics/angular": "11.x",
|
|
59
|
+
"zone.js": "0.11.x",
|
|
60
|
+
"typescript": "4.0.x",
|
|
61
|
+
"tslib": "2.x",
|
|
62
|
+
}),
|
|
66
63
|
];
|
|
67
64
|
}
|
|
68
65
|
}
|