Skip to content

Commit 20af866

Browse files
committed
refactor(@schematics/angular): more comprehensive empty type file name cleanup
The potential double periods within file name templates are now more completely removed in cases where there may be more than one set.
1 parent da7063f commit 20af866

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/schematics/angular/utility/generate-from-files.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ export function generateFromFiles(
6060
...extraTemplateValues,
6161
}),
6262
!options.type
63-
? forEach(((file) => {
64-
return file.path.includes('..')
65-
? {
66-
content: file.content,
67-
path: file.path.replace('..', '.'),
68-
}
69-
: file;
70-
}) as FileOperator)
63+
? forEach((file) => {
64+
let filePath: string = file.path;
65+
while (filePath.includes('..')) {
66+
filePath = filePath.replaceAll('..', '.');
67+
}
68+
69+
return {
70+
content: file.content,
71+
path: filePath,
72+
} as ReturnType<FileOperator>;
73+
})
7174
: noop(),
7275
move(parsedPath.path + (options.flat ? '' : '/' + strings.dasherize(options.name))),
7376
]);

0 commit comments

Comments
 (0)