Skip to content

Commit

Permalink
fix(migrations): passed in paths will be respected in nx workspaces (#…
Browse files Browse the repository at this point in the history
…52796)

This fixes a bug where if you have multiple tsconfig files, the migration would not find anything to migrate at the passed in path.
fixes: #52787

PR Close #52796
  • Loading branch information
thePunderWoman committed Nov 13, 2023
1 parent aa2d815 commit e1f84a3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {Rule, SchematicContext, SchematicsException, Tree} from '@angular-devkit
import {join, relative} from 'path';

import {normalizePath} from '../../utils/change_tracker';
import {getProjectTsConfigPaths} from '../../utils/project_tsconfig_paths';
import {canMigrateFile, createMigrationProgram} from '../../utils/typescript/compiler_host';

import {migrateTemplate} from './migration';
Expand All @@ -23,10 +22,12 @@ interface Options {

export default function(options: Options): Rule {
return async (tree: Tree, context: SchematicContext) => {
const {buildPaths, testPaths} = await getProjectTsConfigPaths(tree);
const basePath = process.cwd();
const pathToMigrate = normalizePath(join(basePath, options.path));
const allPaths = options.path !== './' ? [...buildPaths, ...testPaths] : [pathToMigrate];
let allPaths = [];
if (pathToMigrate.trim() !== '') {
allPaths.push(pathToMigrate);
}

if (!allPaths.length) {
throw new SchematicsException(
Expand Down

0 comments on commit e1f84a3

Please sign in to comment.