Skip to content
Closed
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
fix(core): ensure default path is set for control flow migration
When running the control flow migration via `ng update`, the path parameter could be undefined. This change ensures a default value of './' is used when no path is explicitly provided, making the migration work consistently between `ng update` and `ng generate` commands.

Fixes #63294
  • Loading branch information
aparzi committed Oct 8, 2025
commit c30618893901bec3a122437bacfc2fd85424cfa0
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ interface Options {

export function migrate(options: Options): Rule {
return async (tree: Tree, context: SchematicContext) => {
// Apply default values from schema when not provided by the migration system
const resolvedOptions = {
path: options.path ?? './',
format: options.format ?? true,
};

let allPaths = [];
const basePath = process.cwd();
let pathToMigrate: string | undefined;
if (options.path) {
if (options.path.startsWith('..')) {

if (resolvedOptions.path) {
if (resolvedOptions.path.startsWith('..')) {
throw new SchematicsException(
'Cannot run control flow migration outside of the current project.',
);
}

pathToMigrate = normalizePath(join(basePath, options.path));
pathToMigrate = normalizePath(join(basePath, resolvedOptions.path));
if (pathToMigrate.trim() !== '') {
allPaths.push(pathToMigrate);
}
Expand Down