Browse Source

fix: clear files as well as folders in proxy

pull/5246/head
Arman Ozak 6 years ago
parent
commit
155da7fdb0
  1. 9
      npm/ng-packs/packages/schematics/src/utils/source.ts

9
npm/ng-packs/packages/schematics/src/utils/source.ts

@ -106,15 +106,18 @@ export function createProxyConfigReader(targetPath: string) {
export function createProxyClearer(targetPath: string) {
targetPath += PROXY_PATH;
const proxyIndexPath = `${targetPath}/index.ts`;
return (tree: Tree) => {
try {
tree.getDir(targetPath).subdirs.forEach(dirName => {
if (!['enums', 'models', 'services'].includes(dirName)) return;
tree.delete(`${targetPath}/${dirName}`);
const dirPath = `${targetPath}/${dirName}`;
tree.getDir(dirPath).visit(filePath => tree.delete(filePath));
tree.delete(dirPath);
});
if (tree.exists(proxyIndexPath)) tree.delete(proxyIndexPath);
return tree;
} catch (_) {
throw new SchematicsException(interpolate(Exception.DirRemoveFailed, targetPath));

Loading…
Cancel
Save