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