diff --git a/packages/angular/src/schematics/move/lib/update-module-name.ts b/packages/angular/src/schematics/move/lib/update-module-name.ts index 9abbc0a9bb..0aa4bf3e20 100644 --- a/packages/angular/src/schematics/move/lib/update-module-name.ts +++ b/packages/angular/src/schematics/move/lib/update-module-name.ts @@ -32,7 +32,7 @@ export function updateModuleName(schema: Schema) { to: classify(newProjectName) }; - const findModuleName = new RegExp(moduleName.from, 'g'); + const findModuleName = new RegExp(`\\b${moduleName.from}`, 'g'); const moduleFile = { from: `${schema.projectName}.module`, diff --git a/packages/workspace/src/schematics/move/lib/update-jest-config.ts b/packages/workspace/src/schematics/move/lib/update-jest-config.ts index f6d355d67d..9f2daf2397 100644 --- a/packages/workspace/src/schematics/move/lib/update-jest-config.ts +++ b/packages/workspace/src/schematics/move/lib/update-jest-config.ts @@ -31,11 +31,11 @@ export function updateJestConfig(schema: Schema): Rule { const oldContent = tree.read(jestConfigPath).toString('utf-8'); - const findName = new RegExp(schema.projectName, 'g'); + const findName = new RegExp(`'${schema.projectName}'`, 'g'); const findDir = new RegExp(project.root, 'g'); const newContent = oldContent - .replace(findName, newProjectName) + .replace(findName, `'${newProjectName}'`) .replace(findDir, destination); tree.overwrite(jestConfigPath, newContent); diff --git a/packages/workspace/src/schematics/move/lib/update-project-root-files.ts b/packages/workspace/src/schematics/move/lib/update-project-root-files.ts index ebb0874b21..d6ff8ce19c 100644 --- a/packages/workspace/src/schematics/move/lib/update-project-root-files.ts +++ b/packages/workspace/src/schematics/move/lib/update-project-root-files.ts @@ -22,14 +22,14 @@ export function updateProjectRootFiles(schema: Schema): Rule { const project = workspace.projects.get(schema.projectName); const destination = getDestination(schema, workspace); - const newRelativeRoot = path.relative( - path.join(appRootPath, destination), - appRootPath - ); - const oldRelativeRoot = path.relative( - path.join(appRootPath, project.root), - appRootPath - ); + const newRelativeRoot = path + .relative(path.join(appRootPath, destination), appRootPath) + .split(path.sep) + .join('/'); + const oldRelativeRoot = path + .relative(path.join(appRootPath, project.root), appRootPath) + .split(path.sep) + .join('/'); if (newRelativeRoot === oldRelativeRoot) { // nothing to do diff --git a/packages/workspace/src/schematics/move/lib/utils.ts b/packages/workspace/src/schematics/move/lib/utils.ts index 454f4c71da..b8b5e31ceb 100644 --- a/packages/workspace/src/schematics/move/lib/utils.ts +++ b/packages/workspace/src/schematics/move/lib/utils.ts @@ -27,7 +27,10 @@ export function getDestination( if (projectType === 'application') { rootFolder = 'apps'; } - return path.join(rootFolder, schema.destination); + return path + .join(rootFolder, schema.destination) + .split(path.sep) + .join('/'); } /**