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 275b5e7

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular-devkit/schematics-cli): rename schematic template files with a template extension
Files that contain template instructions should include a `.template` extension to prevent them from being treated as TypeScript/JSON/etc. files. Not doing so can result in parse errors or other failures when the files are incorrectly processed by other tools.
1 parent a5e8ac5 commit 275b5e7

File tree

8 files changed

+8
-5
lines changed

8 files changed

+8
-5
lines changed

‎packages/angular_devkit/schematics_cli/blank/factory.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import {
1313
SchematicsException,
1414
Tree,
1515
apply,
16+
applyTemplates,
1617
chain,
1718
mergeWith,
1819
move,
19-
template,
2020
url,
2121
} from '@angular-devkit/schematics';
2222
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
@@ -63,7 +63,7 @@ export default function (options: Schema): Rule {
6363
} catch {}
6464

6565
let source = apply(url('./schematic-files'), [
66-
template({
66+
applyTemplates({
6767
...options,
6868
coreVersion,
6969
schematicsVersion,
@@ -77,7 +77,8 @@ export default function (options: Schema): Rule {
7777
if (!collectionPath) {
7878
collectionPath = normalize('/' + options.name + '/src/collection.json');
7979
source = apply(url('./project-files'), [
80-
template({
80+
move('package.json', 'package.json.template'),
81+
applyTemplates({
8182
...(options as object),
8283
coreVersion,
8384
schematicsVersion,

‎packages/angular_devkit/schematics_cli/schematic/factory.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { strings } from '@angular-devkit/core';
1010
import {
1111
Rule,
1212
apply,
13+
applyTemplates,
1314
mergeWith,
1415
move,
1516
partitionApplyMerge,
16-
template,
1717
url,
1818
} from '@angular-devkit/schematics';
1919
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
@@ -28,9 +28,11 @@ export default function (options: Schema): Rule {
2828

2929
return mergeWith(
3030
apply(url('./files'), [
31+
// The `package.json` name is kept to allow renovate to update the dependency versions
32+
move('package.json', 'package.json.template'),
3133
partitionApplyMerge(
3234
(p) => !/\/src\/.*?\/files\//.test(p),
33-
template({
35+
applyTemplates({
3436
...options,
3537
coreVersion,
3638
schematicsVersion,

0 commit comments

Comments
(0)

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