fix(devkit): move files to a directory using normalized paths to handle windows correctly (#7264)
This commit is contained in:
parent
3881d002fe
commit
c21835d40a
@ -1,4 +1,5 @@
|
|||||||
import { Tree } from '@nrwl/tao/src/shared/tree';
|
import { Tree } from '@nrwl/tao/src/shared/tree';
|
||||||
|
import { relative } from 'path';
|
||||||
import { visitNotIgnoredFiles } from '../generators/visit-not-ignored-files';
|
import { visitNotIgnoredFiles } from '../generators/visit-not-ignored-files';
|
||||||
import { normalizePath } from './path';
|
import { normalizePath } from './path';
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ export function moveFilesToNewDirectory(
|
|||||||
newDir = normalizePath(newDir);
|
newDir = normalizePath(newDir);
|
||||||
visitNotIgnoredFiles(tree, oldDir, (file) => {
|
visitNotIgnoredFiles(tree, oldDir, (file) => {
|
||||||
try {
|
try {
|
||||||
tree.rename(file, file.replace(oldDir, newDir));
|
tree.rename(file, `${newDir}/${relative(oldDir, file)}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!tree.exists(oldDir)) {
|
if (!tree.exists(oldDir)) {
|
||||||
console.warn(`Path ${oldDir} does not exist`);
|
console.warn(`Path ${oldDir} does not exist`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user