@angular-devkit/schematics 12.0.0-rc.0 → 12.0.0
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/README.md +81 -61
- package/collection-schema.json +2 -7
- package/package.json +3 -3
- package/src/_golden-api.d.ts +1 -1
- package/src/_golden-api.js +1 -1
- package/src/engine/engine.d.ts +2 -2
- package/src/engine/engine.js +35 -22
- package/src/engine/index.d.ts +1 -1
- package/src/engine/index.js +7 -7
- package/src/engine/interface.d.ts +2 -2
- package/src/engine/interface.js +7 -0
- package/src/engine/schematic.d.ts +1 -1
- package/src/engine/schematic.js +13 -8
- package/src/exception/exception.d.ts +1 -1
- package/src/exception/exception.js +15 -7
- package/src/formats/format-validator.d.ts +1 -1
- package/src/formats/format-validator.js +4 -6
- package/src/formats/html-selector.d.ts +1 -1
- package/src/formats/html-selector.js +19 -12
- package/src/formats/index.d.ts +1 -1
- package/src/formats/index.js +3 -6
- package/src/formats/path.d.ts +1 -1
- package/src/formats/path.js +1 -1
- package/src/index.d.ts +3 -3
- package/src/index.js +20 -14
- package/src/rules/base.d.ts +7 -0
- package/src/rules/base.js +10 -10
- package/src/rules/call.d.ts +1 -1
- package/src/rules/call.js +7 -7
- package/src/rules/move.d.ts +7 -0
- package/src/rules/move.js +5 -5
- package/src/rules/random.d.ts +1 -1
- package/src/rules/random.js +17 -5
- package/src/rules/rename.d.ts +7 -0
- package/src/rules/rename.js +4 -4
- package/src/rules/schematic.d.ts +7 -0
- package/src/rules/schematic.js +5 -5
- package/src/rules/template.d.ts +1 -1
- package/src/rules/template.js +15 -9
- package/src/rules/url.d.ts +7 -0
- package/src/rules/url.js +3 -3
- package/src/sink/dryrun.d.ts +2 -2
- package/src/sink/dryrun.js +8 -8
- package/src/sink/host.d.ts +2 -2
- package/src/sink/host.js +8 -1
- package/src/sink/sink.d.ts +2 -2
- package/src/sink/sink.js +41 -29
- package/src/tree/action.d.ts +2 -2
- package/src/tree/action.js +24 -13
- package/src/tree/delegate.d.ts +2 -2
- package/src/tree/delegate.js +46 -13
- package/src/tree/empty.d.ts +1 -1
- package/src/tree/empty.js +6 -4
- package/src/tree/entry.d.ts +2 -2
- package/src/tree/entry.js +19 -4
- package/src/tree/host-tree.d.ts +2 -2
- package/src/tree/host-tree.js +18 -20
- package/src/tree/interface.d.ts +2 -2
- package/src/tree/interface.js +12 -3
- package/src/tree/null.d.ts +2 -2
- package/src/tree/null.js +22 -12
- package/src/tree/recorder.d.ts +7 -0
- package/src/tree/recorder.js +9 -7
- package/src/tree/scoped.d.ts +2 -2
- package/src/tree/scoped.js +31 -14
- package/src/tree/static.d.ts +7 -0
- package/src/tree/static.js +3 -3
- package/src/utility/linked-list.d.ts +1 -1
- package/src/utility/linked-list.js +4 -2
- package/src/utility/update-buffer.d.ts +2 -2
- package/src/utility/update-buffer.js +11 -11
- package/src/workflow/base.d.ts +1 -1
- package/src/workflow/base.js +16 -12
- package/src/workflow/index.d.ts +1 -1
- package/src/workflow/index.js +7 -7
- package/src/workflow/interface.d.ts +1 -1
- package/src/workflow/interface.js +7 -0
- package/tasks/index.d.ts +1 -1
- package/tasks/index.js +3 -3
- package/tasks/node/index.d.ts +1 -1
- package/tasks/node/index.js +11 -4
- package/tasks/package-manager/executor.d.ts +1 -1
- package/tasks/package-manager/executor.js +9 -7
- package/tasks/package-manager/install-task.d.ts +1 -1
- package/tasks/package-manager/install-task.js +7 -0
- package/tasks/package-manager/link-task.d.ts +1 -1
- package/tasks/package-manager/link-task.js +7 -0
- package/tasks/package-manager/options.d.ts +2 -1
- package/tasks/package-manager/options.js +3 -3
- package/tasks/repo-init/executor.d.ts +7 -0
- package/tasks/repo-init/executor.js +6 -11
- package/tasks/repo-init/init-task.d.ts +1 -1
- package/tasks/repo-init/init-task.js +7 -0
- package/tasks/repo-init/options.d.ts +1 -1
- package/tasks/repo-init/options.js +3 -3
- package/tasks/run-schematic/executor.d.ts +1 -1
- package/tasks/run-schematic/executor.js +7 -0
- package/tasks/run-schematic/options.d.ts +1 -1
- package/tasks/run-schematic/options.js +3 -3
- package/tasks/run-schematic/task.d.ts +1 -1
- package/tasks/run-schematic/task.js +7 -0
- package/tasks/tslint-fix/executor.d.ts +7 -0
- package/tasks/tslint-fix/executor.js +23 -19
- package/tasks/tslint-fix/options.d.ts +1 -1
- package/tasks/tslint-fix/options.js +7 -0
- package/tasks/tslint-fix/task.d.ts +1 -1
- package/tasks/tslint-fix/task.js +7 -0
- package/tasks/tslint-fix/test/custom-rule.d.ts +1 -1
- package/tasks/tslint-fix/test/custom-rule.js +8 -1
- package/tasks/tslint-fix/test/rules/customRuleRule.js +5 -5
- package/tasks/tslint-fix/test/run-task.d.ts +1 -1
- package/tasks/tslint-fix/test/run-task.js +8 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +7 -7
- package/testing/schematic-test-runner.d.ts +1 -1
- package/testing/schematic-test-runner.js +21 -13
- package/tools/description.d.ts +1 -1
- package/tools/description.js +7 -0
- package/tools/export-ref.d.ts +7 -0
- package/tools/export-ref.js +12 -6
- package/tools/fallback-engine-host.d.ts +2 -3
- package/tools/fallback-engine-host.js +9 -12
- package/tools/file-system-engine-host-base.d.ts +2 -2
- package/tools/file-system-engine-host-base.js +23 -16
- package/tools/file-system-engine-host.d.ts +7 -0
- package/tools/file-system-engine-host.js +4 -4
- package/tools/file-system-utility.d.ts +1 -1
- package/tools/file-system-utility.js +6 -6
- package/tools/index.d.ts +1 -1
- package/tools/index.js +7 -7
- package/tools/node-module-engine-host.d.ts +1 -1
- package/tools/node-module-engine-host.js +5 -4
- package/tools/node-modules-test-engine-host.d.ts +1 -1
- package/tools/node-modules-test-engine-host.js +13 -2
- package/tools/schema-option-transform.d.ts +1 -1
- package/tools/schema-option-transform.js +4 -6
- package/tools/workflow/node-workflow.d.ts +2 -1
- package/tools/workflow/node-workflow.js +5 -4
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchematicTestRunner = exports.UnitTestTree = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SchematicTestRunner = exports.UnitTestTree = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
@@ -18,7 +18,7 @@ const tools_1 = require("../tools");
|
|
|
18
18
|
class UnitTestTree extends src_1.DelegateTree {
|
|
19
19
|
get files() {
|
|
20
20
|
const result = [];
|
|
21
|
-
this.visit(path => result.push(path));
|
|
21
|
+
this.visit((path) => result.push(path));
|
|
22
22
|
return result;
|
|
23
23
|
}
|
|
24
24
|
readContent(path) {
|
|
@@ -46,26 +46,34 @@ class SchematicTestRunner {
|
|
|
46
46
|
this._engineHost.registerTaskExecutor(node_1.BuiltinTaskExecutor.TslintFix);
|
|
47
47
|
this._collection = this._engine.createCollection(this._collectionName);
|
|
48
48
|
}
|
|
49
|
-
get engine() {
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
get engine() {
|
|
50
|
+
return this._engine;
|
|
51
|
+
}
|
|
52
|
+
get logger() {
|
|
53
|
+
return this._logger;
|
|
54
|
+
}
|
|
55
|
+
get tasks() {
|
|
56
|
+
return [...this._engineHost.tasks];
|
|
57
|
+
}
|
|
52
58
|
registerCollection(collectionName, collectionPath) {
|
|
53
59
|
this._engineHost.registerCollection(collectionName, collectionPath);
|
|
54
60
|
}
|
|
55
61
|
runSchematicAsync(schematicName, opts, tree) {
|
|
56
62
|
const schematic = this._collection.createSchematic(schematicName, true);
|
|
57
|
-
const host = rxjs_1.of(tree || new src_1.HostTree);
|
|
63
|
+
const host = rxjs_1.of(tree || new src_1.HostTree());
|
|
58
64
|
this._engineHost.clearTasks();
|
|
59
|
-
return schematic
|
|
60
|
-
.
|
|
65
|
+
return schematic
|
|
66
|
+
.call(opts || {}, host, { logger: this._logger })
|
|
67
|
+
.pipe(operators_1.map((tree) => new UnitTestTree(tree)));
|
|
61
68
|
}
|
|
62
69
|
runExternalSchematicAsync(collectionName, schematicName, opts, tree) {
|
|
63
70
|
const externalCollection = this._engine.createCollection(collectionName);
|
|
64
71
|
const schematic = externalCollection.createSchematic(schematicName, true);
|
|
65
|
-
const host = rxjs_1.of(tree || new src_1.HostTree);
|
|
72
|
+
const host = rxjs_1.of(tree || new src_1.HostTree());
|
|
66
73
|
this._engineHost.clearTasks();
|
|
67
|
-
return schematic
|
|
68
|
-
.
|
|
74
|
+
return schematic
|
|
75
|
+
.call(opts || {}, host, { logger: this._logger })
|
|
76
|
+
.pipe(operators_1.map((tree) => new UnitTestTree(tree)));
|
|
69
77
|
}
|
|
70
78
|
callRule(rule, tree, parentContext) {
|
|
71
79
|
const context = this._engine.createContext({}, parentContext);
|
package/tools/description.d.ts
CHANGED
package/tools/description.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/tools/export-ref.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
export declare class ExportStringRef<T> {
|
|
2
9
|
private _ref?;
|
|
3
10
|
private _module;
|
package/tools/export-ref.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExportStringRef = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExportStringRef = void 0;
|
|
11
11
|
const path_1 = require("path");
|
|
12
12
|
class ExportStringRef {
|
|
13
13
|
constructor(ref, parentPath = process.cwd(), inner = true) {
|
|
@@ -22,8 +22,14 @@ class ExportStringRef {
|
|
|
22
22
|
this._ref = require(this._module);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
get ref() {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
get ref() {
|
|
26
|
+
return this._ref;
|
|
27
|
+
}
|
|
28
|
+
get module() {
|
|
29
|
+
return this._module;
|
|
30
|
+
}
|
|
31
|
+
get path() {
|
|
32
|
+
return this._path;
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
exports.ExportStringRef = ExportStringRef;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
10
10
|
import { Url } from 'url';
|
|
11
11
|
import { CollectionDescription, EngineHost, RuleFactory, SchematicDescription, Source, TaskExecutor, TypedSchematicContext } from '../src';
|
|
@@ -23,7 +23,6 @@ export declare type FallbackContext = TypedSchematicContext<FallbackCollectionDe
|
|
|
23
23
|
*/
|
|
24
24
|
export declare class FallbackEngineHost implements EngineHost<{}, {}> {
|
|
25
25
|
private _hosts;
|
|
26
|
-
constructor();
|
|
27
26
|
addHost<CollectionT extends object, SchematicT extends object>(host: EngineHost<CollectionT, SchematicT>): void;
|
|
28
27
|
createCollectionDescription(name: string, requester?: CollectionDescription<{}>): CollectionDescription<FallbackCollectionDescription>;
|
|
29
28
|
createSchematicDescription(name: string, collection: CollectionDescription<FallbackCollectionDescription>): SchematicDescription<FallbackCollectionDescription, FallbackSchematicDescription> | null;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FallbackEngineHost = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FallbackEngineHost = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const operators_1 = require("rxjs/operators");
|
|
13
13
|
const src_1 = require("../src");
|
|
@@ -28,8 +28,7 @@ class FallbackEngineHost {
|
|
|
28
28
|
const description = host.createCollectionDescription(name, requester);
|
|
29
29
|
return { name, host, description };
|
|
30
30
|
}
|
|
31
|
-
catch (_) {
|
|
32
|
-
}
|
|
31
|
+
catch (_) { }
|
|
33
32
|
}
|
|
34
33
|
throw new src_1.UnknownCollectionException(name);
|
|
35
34
|
}
|
|
@@ -47,23 +46,21 @@ class FallbackEngineHost {
|
|
|
47
46
|
return context.schematic.collection.description.host.createSourceFromUrl(url, context);
|
|
48
47
|
}
|
|
49
48
|
transformOptions(schematic, options, context) {
|
|
50
|
-
//
|
|
51
|
-
return
|
|
52
|
-
.pipe(...this._hosts
|
|
53
|
-
.map(host => operators_1.mergeMap((opt) => host.transformOptions(schematic, opt, context)))));
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
return rxjs_1.of(options).pipe(...this._hosts.map((host) => operators_1.mergeMap((opt) => host.transformOptions(schematic, opt, context))));
|
|
54
51
|
}
|
|
55
52
|
transformContext(context) {
|
|
56
53
|
let result = context;
|
|
57
|
-
this._hosts.forEach(host => {
|
|
54
|
+
this._hosts.forEach((host) => {
|
|
58
55
|
result = (host.transformContext(result) || result);
|
|
59
56
|
});
|
|
60
57
|
return result;
|
|
61
58
|
}
|
|
62
59
|
listSchematicNames(collection) {
|
|
63
60
|
const allNames = new Set();
|
|
64
|
-
this._hosts.forEach(host => {
|
|
61
|
+
this._hosts.forEach((host) => {
|
|
65
62
|
try {
|
|
66
|
-
host.listSchematicNames(collection.description).forEach(name => allNames.add(name));
|
|
63
|
+
host.listSchematicNames(collection.description).forEach((name) => allNames.add(name));
|
|
67
64
|
}
|
|
68
65
|
catch (_) { }
|
|
69
66
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import { BaseException, InvalidJsonCharacterException, UnexpectedEndOfInputException } from '@angular-devkit/core';
|
|
10
10
|
import { Observable } from 'rxjs';
|
|
11
11
|
import { Url } from 'url';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileSystemEngineHostBase = exports.SchematicNameCollisionException = exports.SchematicMissingDescriptionException = exports.SchematicMissingFieldsException = exports.CollectionMissingFieldsException = exports.CollectionMissingSchematicsMapException = exports.FactoryCannotBeResolvedException = exports.SchematicMissingFactoryException = exports.InvalidCollectionJsonException = exports.CollectionCannotBeResolvedException = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FileSystemEngineHostBase = exports.SchematicNameCollisionException = exports.SchematicMissingDescriptionException = exports.SchematicMissingFieldsException = exports.CollectionMissingFieldsException = exports.CollectionMissingSchematicsMapException = exports.FactoryCannotBeResolvedException = exports.SchematicMissingFactoryException = exports.InvalidCollectionJsonException = exports.CollectionCannotBeResolvedException = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const node_1 = require("@angular-devkit/core/node");
|
|
13
13
|
const fs_1 = require("fs");
|
|
@@ -44,25 +44,33 @@ class FactoryCannotBeResolvedException extends core_1.BaseException {
|
|
|
44
44
|
}
|
|
45
45
|
exports.FactoryCannotBeResolvedException = FactoryCannotBeResolvedException;
|
|
46
46
|
class CollectionMissingSchematicsMapException extends core_1.BaseException {
|
|
47
|
-
constructor(name) {
|
|
47
|
+
constructor(name) {
|
|
48
|
+
super(`Collection "${name}" does not have a schematics map.`);
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
51
|
exports.CollectionMissingSchematicsMapException = CollectionMissingSchematicsMapException;
|
|
50
52
|
class CollectionMissingFieldsException extends core_1.BaseException {
|
|
51
|
-
constructor(name) {
|
|
53
|
+
constructor(name) {
|
|
54
|
+
super(`Collection "${name}" is missing fields.`);
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
exports.CollectionMissingFieldsException = CollectionMissingFieldsException;
|
|
54
58
|
class SchematicMissingFieldsException extends core_1.BaseException {
|
|
55
|
-
constructor(name) {
|
|
59
|
+
constructor(name) {
|
|
60
|
+
super(`Schematic "${name}" is missing fields.`);
|
|
61
|
+
}
|
|
56
62
|
}
|
|
57
63
|
exports.SchematicMissingFieldsException = SchematicMissingFieldsException;
|
|
58
64
|
class SchematicMissingDescriptionException extends core_1.BaseException {
|
|
59
|
-
constructor(name) {
|
|
65
|
+
constructor(name) {
|
|
66
|
+
super(`Schematics "${name}" does not have a description.`);
|
|
67
|
+
}
|
|
60
68
|
}
|
|
61
69
|
exports.SchematicMissingDescriptionException = SchematicMissingDescriptionException;
|
|
62
70
|
class SchematicNameCollisionException extends core_1.BaseException {
|
|
63
71
|
constructor(name) {
|
|
64
|
-
super(`Schematics/alias ${JSON.stringify(name)} collides with another alias or schematic`
|
|
65
|
-
|
|
72
|
+
super(`Schematics/alias ${JSON.stringify(name)} collides with another alias or schematic` +
|
|
73
|
+
' name.');
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
exports.SchematicNameCollisionException = SchematicNameCollisionException;
|
|
@@ -72,7 +80,7 @@ exports.SchematicNameCollisionException = SchematicNameCollisionException;
|
|
|
72
80
|
*/
|
|
73
81
|
class FileSystemEngineHostBase {
|
|
74
82
|
constructor() {
|
|
75
|
-
//
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
84
|
this._transforms = [];
|
|
77
85
|
this._contextTransforms = [];
|
|
78
86
|
this._taskFactories = new Map();
|
|
@@ -156,8 +164,7 @@ class FileSystemEngineHostBase {
|
|
|
156
164
|
if (partialDesc.extends) {
|
|
157
165
|
const index = partialDesc.extends.indexOf(':');
|
|
158
166
|
const collectionName = index !== -1 ? partialDesc.extends.substr(0, index) : null;
|
|
159
|
-
const schematicName = index === -1 ?
|
|
160
|
-
partialDesc.extends : partialDesc.extends.substr(index + 1);
|
|
167
|
+
const schematicName = index === -1 ? partialDesc.extends : partialDesc.extends.substr(index + 1);
|
|
161
168
|
if (collectionName !== null) {
|
|
162
169
|
const extendCollection = this.createCollectionDescription(collectionName);
|
|
163
170
|
return this.createSchematicDescription(schematicName, extendCollection);
|
|
@@ -189,8 +196,7 @@ class FileSystemEngineHostBase {
|
|
|
189
196
|
// This is needed because on Bazel under Windows the data files (such as the collection or
|
|
190
197
|
// url files) are not in the same place as the compiled JS.
|
|
191
198
|
const maybePath = path_1.join(collectionPath, partialDesc.factory);
|
|
192
|
-
const path = fs_1.existsSync(maybePath) && fs_1.statSync(maybePath).isDirectory()
|
|
193
|
-
? maybePath : path_1.dirname(maybePath);
|
|
199
|
+
const path = fs_1.existsSync(maybePath) && fs_1.statSync(maybePath).isDirectory() ? maybePath : path_1.dirname(maybePath);
|
|
194
200
|
return this._transformSchematicDescription(name, collection, {
|
|
195
201
|
...partialDesc,
|
|
196
202
|
schema,
|
|
@@ -224,14 +230,15 @@ class FileSystemEngineHostBase {
|
|
|
224
230
|
let transformedOptions = options;
|
|
225
231
|
for (const transformer of this._transforms) {
|
|
226
232
|
const transformerResult = transformer(schematic, transformedOptions, context);
|
|
227
|
-
transformedOptions = await (rxjs_1.isObservable(transformerResult)
|
|
233
|
+
transformedOptions = await (rxjs_1.isObservable(transformerResult)
|
|
234
|
+
? transformerResult.toPromise()
|
|
235
|
+
: transformerResult);
|
|
228
236
|
}
|
|
229
237
|
return transformedOptions;
|
|
230
238
|
};
|
|
231
239
|
return rxjs_1.from(transform());
|
|
232
240
|
}
|
|
233
241
|
transformContext(context) {
|
|
234
|
-
// tslint:disable-next-line:no-any https://github.com/ReactiveX/rxjs/issues/3989
|
|
235
242
|
return this._contextTransforms.reduce((acc, curr) => curr(acc), context);
|
|
236
243
|
}
|
|
237
244
|
getSchematicRuleFactory(schematic, _collection) {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Observable } from 'rxjs';
|
|
2
9
|
import { RuleFactory, TaskExecutor } from '../src';
|
|
3
10
|
import { FileSystemCollectionDesc, FileSystemSchematicDesc } from './description';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileSystemEngineHost = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FileSystemEngineHost = void 0;
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const rxjs_1 = require("rxjs");
|
|
@@ -83,7 +83,7 @@ class FileSystemEngineHost extends file_system_engine_host_base_1.FileSystemEngi
|
|
|
83
83
|
if (!super.hasTaskExecutor(name)) {
|
|
84
84
|
try {
|
|
85
85
|
const path = require.resolve(path_1.join(this._root, name));
|
|
86
|
-
return rxjs_1.from(Promise.resolve().then(() => require(path)).then(mod => mod.default())).pipe(operators_1.catchError(() => rxjs_1.throwError(new src_1.UnregisteredTaskException(name))));
|
|
86
|
+
return rxjs_1.from(Promise.resolve().then(() => require(path)).then((mod) => mod.default())).pipe(operators_1.catchError(() => rxjs_1.throwError(new src_1.UnregisteredTaskException(name))));
|
|
87
87
|
}
|
|
88
88
|
catch { }
|
|
89
89
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readJsonFile = exports.readFile = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.readJsonFile = exports.readFile = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
/**
|
|
@@ -19,7 +19,7 @@ function readFile(fileName) {
|
|
|
19
19
|
}
|
|
20
20
|
const buffer = fs_1.readFileSync(fileName);
|
|
21
21
|
let len = buffer.length;
|
|
22
|
-
if (len >= 2 && buffer[0] ===
|
|
22
|
+
if (len >= 2 && buffer[0] === 0xfe && buffer[1] === 0xff) {
|
|
23
23
|
// Big endian UTF-16 byte order mark detected. Since big endian is not supported by node.js,
|
|
24
24
|
// flip all byte pairs and treat as little endian.
|
|
25
25
|
len &= ~1;
|
|
@@ -30,11 +30,11 @@ function readFile(fileName) {
|
|
|
30
30
|
}
|
|
31
31
|
return buffer.toString('utf16le', 2);
|
|
32
32
|
}
|
|
33
|
-
if (len >= 2 && buffer[0] ===
|
|
33
|
+
if (len >= 2 && buffer[0] === 0xff && buffer[1] === 0xfe) {
|
|
34
34
|
// Little endian UTF-16 byte order mark detected
|
|
35
35
|
return buffer.toString('utf16le', 2);
|
|
36
36
|
}
|
|
37
|
-
if (len >= 3 && buffer[0] ===
|
|
37
|
+
if (len >= 3 && buffer[0] === 0xef && buffer[1] === 0xbb && buffer[2] === 0xbf) {
|
|
38
38
|
// UTF-8 byte order mark detected
|
|
39
39
|
return buffer.toString('utf8', 3);
|
|
40
40
|
}
|
package/tools/index.d.ts
CHANGED
package/tools/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
10
|
if (k2 === undefined) k2 = k;
|
|
4
11
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -11,13 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
20
|
exports.validateOptionsWithSchema = exports.NodeModulesTestEngineHost = exports.NodePackageDoesNotSupportSchematics = exports.NodeModulesEngineHost = exports.FileSystemEngineHost = void 0;
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
17
|
-
*
|
|
18
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
19
|
-
* found in the LICENSE file at https://angular.io/license
|
|
20
|
-
*/
|
|
21
21
|
__exportStar(require("./description"), exports);
|
|
22
22
|
__exportStar(require("./export-ref"), exports);
|
|
23
23
|
__exportStar(require("./file-system-engine-host-base"), exports);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeModulesEngineHost = exports.NodePackageDoesNotSupportSchematics = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NodeModulesEngineHost = exports.NodePackageDoesNotSupportSchematics = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const export_ref_1 = require("./export-ref");
|
|
@@ -83,7 +83,8 @@ class NodeModulesEngineHost extends file_system_engine_host_base_1.FileSystemEng
|
|
|
83
83
|
return collectionPath;
|
|
84
84
|
}
|
|
85
85
|
catch (e) {
|
|
86
|
-
if (e instanceof core_1.InvalidJsonCharacterException ||
|
|
86
|
+
if (e instanceof core_1.InvalidJsonCharacterException ||
|
|
87
|
+
e instanceof core_1.UnexpectedEndOfInputException) {
|
|
87
88
|
throw new file_system_engine_host_base_1.InvalidCollectionJsonException(name, collectionPath, e);
|
|
88
89
|
}
|
|
89
90
|
else {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.NodeModulesTestEngineHost = void 0;
|
|
4
11
|
const node_module_engine_host_1 = require("./node-module-engine-host");
|
|
@@ -12,8 +19,12 @@ class NodeModulesTestEngineHost extends node_module_engine_host_1.NodeModulesEng
|
|
|
12
19
|
this._collections = new Map();
|
|
13
20
|
this._tasks = [];
|
|
14
21
|
}
|
|
15
|
-
get tasks() {
|
|
16
|
-
|
|
22
|
+
get tasks() {
|
|
23
|
+
return this._tasks;
|
|
24
|
+
}
|
|
25
|
+
clearTasks() {
|
|
26
|
+
this._tasks = [];
|
|
27
|
+
}
|
|
17
28
|
registerCollection(name, path) {
|
|
18
29
|
this._collections.set(name, path);
|
|
19
30
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOptionsWithSchema = exports.InvalidInputOptions = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.validateOptionsWithSchema = exports.InvalidInputOptions = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const rxjs_1 = require("rxjs");
|
|
13
13
|
const operators_1 = require("rxjs/operators");
|
|
@@ -25,9 +25,7 @@ function validateOptionsWithSchema(registry) {
|
|
|
25
25
|
const withPrompts = context ? context.interactive : true;
|
|
26
26
|
if (schematic.schema && schematic.schemaJson) {
|
|
27
27
|
// Make a deep copy of options.
|
|
28
|
-
return registry
|
|
29
|
-
.compile(schematic.schemaJson)
|
|
30
|
-
.pipe(operators_1.mergeMap(validator => validator(options, { withPrompts })), operators_1.first(), operators_1.map(result => {
|
|
28
|
+
return registry.compile(schematic.schemaJson).pipe(operators_1.mergeMap((validator) => validator(options, { withPrompts })), operators_1.first(), operators_1.map((result) => {
|
|
31
29
|
if (!result.success) {
|
|
32
30
|
throw new InvalidInputOptions(options, result.errors || []);
|
|
33
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -14,6 +14,7 @@ export interface NodeWorkflowOptions {
|
|
|
14
14
|
force?: boolean;
|
|
15
15
|
dryRun?: boolean;
|
|
16
16
|
packageManager?: string;
|
|
17
|
+
packageManagerForce?: boolean;
|
|
17
18
|
packageRegistry?: string;
|
|
18
19
|
registry?: schema.CoreSchemaRegistry;
|
|
19
20
|
resolvePaths?: string[];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeWorkflow = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.NodeWorkflow = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const node_1 = require("@angular-devkit/core/node");
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
14
|
const node_2 = require("../../tasks/node");
|
|
15
15
|
const node_module_engine_host_1 = require("../node-module-engine-host");
|
|
16
16
|
const schema_option_transform_1 = require("../schema-option-transform");
|
|
@@ -41,6 +41,7 @@ class NodeWorkflow extends schematics_1.workflow.BaseWorkflow {
|
|
|
41
41
|
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.NodePackage, {
|
|
42
42
|
allowPackageManagerOverride: true,
|
|
43
43
|
packageManager: options.packageManager,
|
|
44
|
+
force: options.packageManagerForce,
|
|
44
45
|
rootDirectory: root && core_1.getSystemPath(root),
|
|
45
46
|
registry: options.packageRegistry,
|
|
46
47
|
});
|