Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ bundle_entrypoints = [
"safe-optional-chaining",
"packages/core/schematics/migrations/safe-optional-chaining/index.js",
],
[
"can-load-to-can-match",
"packages/core/schematics/migrations/can-load-to-can-match/index.js",
],
]

rollup.rollup(
Expand All @@ -165,6 +169,7 @@ rollup.rollup(
"//:node_modules/magic-string",
"//:node_modules/semver",
"//packages/core/schematics:tsconfig_build",
"//packages/core/schematics/migrations/can-load-to-can-match",
"//packages/core/schematics/migrations/can-match-snapshot-required",
"//packages/core/schematics/migrations/change-detection-eager",
"//packages/core/schematics/migrations/http-xhr-backend",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/schematics/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"version": "22.0.0",
"description": "Wraps optional chaining expressions in $safeNavigationMigration().",
"factory": "./bundles/safe-optional-chaining.cjs#migrate"
},
"can-load-to-can-match": {
"version": "23.0.0",
"description": "Migrates CanLoad to CanMatch and Route.canLoad to Route.canMatch.",
"factory": "./bundles/can-load-to-can-match.cjs#migrate"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load("//tools:defaults.bzl", "ts_project", "zoneless_jasmine_test")

package(
default_visibility = [
"//packages/core/schematics:__pkg__",
"//packages/core/schematics/test:__pkg__",
],
)

ts_project(
name = "can-load-to-can-match",
srcs = glob(
["**/*.ts"],
exclude = ["*.spec.ts"],
),
deps = [
"//:node_modules/@angular-devkit/schematics",
"//:node_modules/@types/node",
"//:node_modules/typescript",
"//packages/compiler-cli",
"//packages/compiler-cli/private",
"//packages/core/schematics/utils",
"//packages/core/schematics/utils/tsurge",
"//packages/core/schematics/utils/tsurge/helpers/angular_devkit",
],
)

ts_project(
name = "test_lib",
testonly = True,
srcs = glob(["*.spec.ts"]),
deps = [
":can-load-to-can-match",
"//:node_modules/typescript",
"//packages/compiler-cli/private",
"//packages/core/schematics/utils/tsurge",
],
)

zoneless_jasmine_test(
name = "test",
data = [":test_lib"],
env = {"FORCE_COLOR": "3"},
)
24 changes: 24 additions & 0 deletions packages/core/schematics/migrations/can-load-to-can-match/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/

import {Rule} from '@angular-devkit/schematics';
import {runMigrationInDevkit} from '../../utils/tsurge/helpers/angular_devkit';
import {CanLoadToCanMatchMigration} from './migration';

interface Options {
path: string;
}

export function migrate(options: Options): Rule {
return async (tree, context) => {
await runMigrationInDevkit({
tree,
getMigration: (fs) => new CanLoadToCanMatchMigration(),
});
};
}
Loading
Loading