Skip to content

Commit 424af28

Browse files
committed
fix(@angular-devkit/build-angular): add validation to fileReplacement values
fileReplacement is meant to replace compilation source files (JavaScript or TypeScript) with other compilation source files in the build. With this change we add validation to fail the build when the files have unsupported extensions. Closes #11451
1 parent 511ffd2 commit 424af28

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

packages/angular/cli/lib/config/schema.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,12 @@
10621062
"type": "object",
10631063
"properties": {
10641064
"src": {
1065-
"type": "string"
1065+
"type": "string",
1066+
"pattern": "\\.([cm]?j|t)sx?$"
10661067
},
10671068
"replaceWith": {
1068-
"type": "string"
1069+
"type": "string",
1070+
"pattern": "\\.([cm]?j|t)sx?$"
10691071
}
10701072
},
10711073
"additionalProperties": false,
@@ -1078,10 +1080,12 @@
10781080
"type": "object",
10791081
"properties": {
10801082
"replace": {
1081-
"type": "string"
1083+
"type": "string",
1084+
"pattern": "\\.([cm]?j|t)sx?$"
10821085
},
10831086
"with": {
1084-
"type": "string"
1087+
"type": "string",
1088+
"pattern": "\\.([cm]?j|t)sx?$"
10851089
}
10861090
},
10871091
"additionalProperties": false,
@@ -1955,10 +1959,12 @@
19551959
"type": "object",
19561960
"properties": {
19571961
"src": {
1958-
"type": "string"
1962+
"type": "string",
1963+
"pattern": "\\.([cm]?j|t)sx?$"
19591964
},
19601965
"replaceWith": {
1961-
"type": "string"
1966+
"type": "string",
1967+
"pattern": "\\.([cm]?j|t)sx?$"
19621968
}
19631969
},
19641970
"additionalProperties": false,
@@ -1971,10 +1977,12 @@
19711977
"type": "object",
19721978
"properties": {
19731979
"replace": {
1974-
"type": "string"
1980+
"type": "string",
1981+
"pattern": "\\.([cm]?j|t)sx?$"
19751982
},
19761983
"with": {
1977-
"type": "string"
1984+
"type": "string",
1985+
"pattern": "\\.([cm]?j|t)sx?$"
19781986
}
19791987
},
19801988
"additionalProperties": false,

packages/angular_devkit/build_angular/src/browser/schema.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,12 @@
433433
"type": "object",
434434
"properties": {
435435
"src": {
436-
"type": "string"
436+
"type": "string",
437+
"pattern": "\\.([cm]?j|t)sx?$"
437438
},
438439
"replaceWith": {
439-
"type": "string"
440+
"type": "string",
441+
"pattern": "\\.([cm]?j|t)sx?$"
440442
}
441443
},
442444
"additionalProperties": false,
@@ -449,10 +451,12 @@
449451
"type": "object",
450452
"properties": {
451453
"replace": {
452-
"type": "string"
454+
"type": "string",
455+
"pattern": "\\.([cm]?j|t)sx?$"
453456
},
454457
"with": {
455-
"type": "string"
458+
"type": "string",
459+
"pattern": "\\.([cm]?j|t)sx?$"
456460
}
457461
},
458462
"additionalProperties": false,

packages/angular_devkit/build_angular/src/server/schema.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,12 @@
259259
"type": "object",
260260
"properties": {
261261
"src": {
262-
"type": "string"
262+
"type": "string",
263+
"pattern": "\\.([cm]?j|t)sx?$"
263264
},
264265
"replaceWith": {
265-
"type": "string"
266+
"type": "string",
267+
"pattern": "\\.([cm]?j|t)sx?$"
266268
}
267269
},
268270
"additionalProperties": false,
@@ -275,10 +277,12 @@
275277
"type": "object",
276278
"properties": {
277279
"replace": {
278-
"type": "string"
280+
"type": "string",
281+
"pattern": "\\.([cm]?j|t)sx?$"
279282
},
280283
"with": {
281-
"type": "string"
284+
"type": "string",
285+
"pattern": "\\.([cm]?j|t)sx?$"
282286
}
283287
},
284288
"additionalProperties": false,

0 commit comments

Comments
 (0)