From 2a378684a7ee27252cc00507dcf41748f317c7e8 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:06:33 -0400 Subject: [PATCH] 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. --- .../angular/utility/generate-from-files.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/schematics/angular/utility/generate-from-files.ts b/packages/schematics/angular/utility/generate-from-files.ts index 98dd04ec4158..ac79813b7111 100644 --- a/packages/schematics/angular/utility/generate-from-files.ts +++ b/packages/schematics/angular/utility/generate-from-files.ts @@ -60,14 +60,17 @@ export function generateFromFiles( ...extraTemplateValues, }), !options.type - ? forEach(((file) => { - return file.path.includes('..') - ? { - content: file.content, - path: file.path.replace('..', '.'), - } - : file; - }) as FileOperator) + ? forEach((file) => { + let filePath: string = file.path; + while (filePath.includes('..')) { + filePath = filePath.replaceAll('..', '.'); + } + + return { + content: file.content, + path: filePath, + } as ReturnType; + }) : noop(), move(parsedPath.path + (options.flat ? '' : '/' + strings.dasherize(options.name))), ]);