@angular-devkit/schematics 11.1.0 → 11.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/rules/schematic.js +4 -1
- package/src/tree/host-tree.d.ts +1 -0
- package/src/tree/host-tree.js +17 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/schematics",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.4",
|
|
4
4
|
"description": "Angular Schematics - Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"schematics"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-devkit/core": "11.1.
|
|
21
|
+
"@angular-devkit/core": "11.1.4",
|
|
22
22
|
"ora": "5.2.0",
|
|
23
23
|
"rxjs": "6.6.3"
|
|
24
24
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">= 10.13.0",
|
|
31
|
-
"npm": "
|
|
31
|
+
"npm": "^6.11.0",
|
|
32
32
|
"yarn": ">= 1.13.0"
|
|
33
33
|
},
|
|
34
34
|
"author": "Angular Authors",
|
package/src/rules/schematic.js
CHANGED
|
@@ -23,7 +23,10 @@ function externalSchematic(collectionName, schematicName, options, executionOpti
|
|
|
23
23
|
return (input, context) => {
|
|
24
24
|
const collection = context.engine.createCollection(collectionName, context.schematic.collection);
|
|
25
25
|
const schematic = collection.createSchematic(schematicName);
|
|
26
|
-
return schematic.call(options, rxjs_1.of(static_1.branch(input)), context, executionOptions)
|
|
26
|
+
return schematic.call(options, rxjs_1.of(static_1.branch(input)), context, executionOptions).pipe(operators_1.last(), operators_1.map(x => {
|
|
27
|
+
input.merge(x, interface_1.MergeStrategy.AllowOverwriteConflict);
|
|
28
|
+
return input;
|
|
29
|
+
}));
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
exports.externalSchematic = externalSchematic;
|
package/src/tree/host-tree.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare class HostTree implements Tree {
|
|
|
37
37
|
protected _willDelete(path: Path): boolean;
|
|
38
38
|
protected _willRename(path: Path): boolean;
|
|
39
39
|
branch(): Tree;
|
|
40
|
+
private isAncestorOf;
|
|
40
41
|
merge(other: Tree, strategy?: MergeStrategy): void;
|
|
41
42
|
get root(): DirEntry;
|
|
42
43
|
read(path: string): Buffer | null;
|
package/src/tree/host-tree.js
CHANGED
|
@@ -12,9 +12,11 @@ const core_1 = require("@angular-devkit/core");
|
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
14
14
|
const exception_1 = require("../exception/exception");
|
|
15
|
+
const delegate_1 = require("./delegate");
|
|
15
16
|
const entry_1 = require("./entry");
|
|
16
17
|
const interface_1 = require("./interface");
|
|
17
18
|
const recorder_1 = require("./recorder");
|
|
19
|
+
const scoped_1 = require("./scoped");
|
|
18
20
|
let _uniqueId = 0;
|
|
19
21
|
class HostDirEntry {
|
|
20
22
|
constructor(parent, path, _host, _tree) {
|
|
@@ -101,24 +103,36 @@ class HostTree {
|
|
|
101
103
|
branchedTree._ancestry = new Set(this._ancestry).add(this._id);
|
|
102
104
|
return branchedTree;
|
|
103
105
|
}
|
|
106
|
+
isAncestorOf(tree) {
|
|
107
|
+
if (tree instanceof HostTree) {
|
|
108
|
+
return tree._ancestry.has(this._id);
|
|
109
|
+
}
|
|
110
|
+
if (tree instanceof delegate_1.DelegateTree) {
|
|
111
|
+
return this.isAncestorOf(tree._other);
|
|
112
|
+
}
|
|
113
|
+
if (tree instanceof scoped_1.ScopedTree) {
|
|
114
|
+
return this.isAncestorOf(tree._base);
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
104
118
|
merge(other, strategy = interface_1.MergeStrategy.Default) {
|
|
105
119
|
if (other === this) {
|
|
106
120
|
// Merging with yourself? Tsk tsk. Nothing to do at least.
|
|
107
121
|
return;
|
|
108
122
|
}
|
|
109
|
-
if (
|
|
123
|
+
if (this.isAncestorOf(other)) {
|
|
110
124
|
// Workaround for merging a branch back into one of its ancestors
|
|
111
125
|
// More complete branch point tracking is required to avoid
|
|
112
126
|
strategy |= interface_1.MergeStrategy.Overwrite;
|
|
113
127
|
}
|
|
114
128
|
const creationConflictAllowed = (strategy & interface_1.MergeStrategy.AllowCreationConflict) == interface_1.MergeStrategy.AllowCreationConflict;
|
|
115
129
|
const overwriteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowOverwriteConflict) == interface_1.MergeStrategy.AllowOverwriteConflict;
|
|
116
|
-
const deleteConflictAllowed = (strategy & interface_1.MergeStrategy.
|
|
130
|
+
const deleteConflictAllowed = (strategy & interface_1.MergeStrategy.AllowDeleteConflict) == interface_1.MergeStrategy.AllowDeleteConflict;
|
|
117
131
|
other.actions.forEach(action => {
|
|
118
132
|
switch (action.kind) {
|
|
119
133
|
case 'c': {
|
|
120
134
|
const { path, content } = action;
|
|
121
|
-
if (
|
|
135
|
+
if (this._willCreate(path) || this._willOverwrite(path) || this.exists(path)) {
|
|
122
136
|
const existingContent = this.read(path);
|
|
123
137
|
if (existingContent && content.equals(existingContent)) {
|
|
124
138
|
// Identical outcome; no action required
|