mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 11:03:53 +08:00
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.
This commit is contained in:
parent
a5e8ac5821
commit
275b5e7480
@ -13,10 +13,10 @@ import {
|
||||
SchematicsException,
|
||||
Tree,
|
||||
apply,
|
||||
applyTemplates,
|
||||
chain,
|
||||
mergeWith,
|
||||
move,
|
||||
template,
|
||||
url,
|
||||
} from '@angular-devkit/schematics';
|
||||
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
||||
@ -63,7 +63,7 @@ export default function (options: Schema): Rule {
|
||||
} catch {}
|
||||
|
||||
let source = apply(url('./schematic-files'), [
|
||||
template({
|
||||
applyTemplates({
|
||||
...options,
|
||||
coreVersion,
|
||||
schematicsVersion,
|
||||
@ -77,7 +77,8 @@ export default function (options: Schema): Rule {
|
||||
if (!collectionPath) {
|
||||
collectionPath = normalize('/' + options.name + '/src/collection.json');
|
||||
source = apply(url('./project-files'), [
|
||||
template({
|
||||
move('package.json', 'package.json.template'),
|
||||
applyTemplates({
|
||||
...(options as object),
|
||||
coreVersion,
|
||||
schematicsVersion,
|
||||
|
@ -10,10 +10,10 @@ import { strings } from '@angular-devkit/core';
|
||||
import {
|
||||
Rule,
|
||||
apply,
|
||||
applyTemplates,
|
||||
mergeWith,
|
||||
move,
|
||||
partitionApplyMerge,
|
||||
template,
|
||||
url,
|
||||
} from '@angular-devkit/schematics';
|
||||
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
||||
@ -28,9 +28,11 @@ export default function (options: Schema): Rule {
|
||||
|
||||
return mergeWith(
|
||||
apply(url('./files'), [
|
||||
// The `package.json` name is kept to allow renovate to update the dependency versions
|
||||
move('package.json', 'package.json.template'),
|
||||
partitionApplyMerge(
|
||||
(p) => !/\/src\/.*?\/files\//.test(p),
|
||||
template({
|
||||
applyTemplates({
|
||||
...options,
|
||||
coreVersion,
|
||||
schematicsVersion,
|
||||
|
Loading…
x
Reference in New Issue
Block a user