Too slow to move
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
This operation is too slow. Is there any way to speed it up? thank you.
``` typescript
const pathValue = targetNode.getProperty('path').getFirstChildByKind(ts.SyntaxKind.StringLiteral);
const oldPath = pathValue.getText();
if (oldPath !== itemData.path) {
pathValue.setLiteralValue(itemData.path);
// Modify directory and file names
const dir = project.getDirectory(path.dirname(itemData.component.path));
dir.move(path.join('..', itemData.path)); // <- slow
dir.getSourceFiles().forEach(sourceFile => {
const newFileName = sourceFile.getBaseName().replace(/(.*)\.(.*)\.(.*)/, itemData.path + '.$2.$3');
sourceFile.move(newFileName); // <- slow
});
}
```
Contributor guide
Assessment
This issue has not been assessed yet.