Skip to content

Commit 4a2f4dc

Browse files
Brent Schmidtclydin
Brent Schmidt
authored andcommitted
refactor(@angular-devkit/schematics): Delete 'rename' rule
- Based on discussion in closed PR #23673, delete `rename` rule.
1 parent e02d718 commit 4a2f4dc

File tree

3 files changed

+10
-104
lines changed

3 files changed

+10
-104
lines changed

packages/angular_devkit/schematics/src/rules/rename.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/angular_devkit/schematics/src/rules/rename_spec.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

packages/angular_devkit/schematics/src/rules/template.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { TextDecoder } from 'util';
1111
import { FileOperator, Rule } from '../engine/interface';
1212
import { FileEntry } from '../tree/interface';
1313
import { chain, composeFileOperators, forEach, when } from './base';
14-
import { rename } from './rename';
1514

1615
export const TEMPLATE_FILENAME_RE = /\.template$/;
1716

@@ -157,10 +156,16 @@ export function pathTemplate<T extends PathTemplateData>(options: T): Rule {
157156
* Remove every `.template` suffix from file names.
158157
*/
159158
export function renameTemplateFiles(): Rule {
160-
return rename(
161-
(path) => !!path.match(TEMPLATE_FILENAME_RE),
162-
(path) => path.replace(TEMPLATE_FILENAME_RE, ''),
163-
);
159+
return forEach((entry) => {
160+
if (entry.path.match(TEMPLATE_FILENAME_RE)) {
161+
return {
162+
content: entry.content,
163+
path: normalize(entry.path.replace(TEMPLATE_FILENAME_RE, '')),
164+
};
165+
} else {
166+
return entry;
167+
}
168+
});
164169
}
165170

166171
export function template<T extends object>(options: T): Rule {

0 commit comments

Comments
 (0)