Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 11 additions & 8 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /