@o3r/schematics 9.7.0-alpha.0 → 10.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +35 -36
- package/src/interfaces/angular-workspace.d.ts +0 -20
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/modules/modules.display.rule.d.ts +0 -9
- package/src/modules/modules.display.rule.d.ts.map +1 -1
- package/src/modules/modules.display.rule.js +1 -18
- package/src/modules/modules.display.rule.js.map +1 -1
- package/src/modules/modules.helpers.d.ts +2 -2
- package/src/modules/modules.helpers.d.ts.map +1 -1
- package/src/modules/modules.helpers.js.map +1 -1
- package/src/rule-factories/add-imports/index.d.ts +0 -1
- package/src/rule-factories/add-imports/index.d.ts.map +1 -1
- package/src/rule-factories/add-imports/index.js +0 -1
- package/src/rule-factories/add-imports/index.js.map +1 -1
- package/src/rule-factories/check-packages-peers/index.d.ts +0 -1
- package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
- package/src/rule-factories/check-packages-peers/index.js +0 -3
- package/src/rule-factories/check-packages-peers/index.js.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.js +1 -2
- package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
- package/src/rule-factories/eslint-fix/index.d.ts +0 -1
- package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.js +1 -3
- package/src/rule-factories/eslint-fix/index.js.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts +0 -1
- package/src/rule-factories/get-test-frameworks/index.d.ts.map +1 -1
- package/src/rule-factories/get-test-frameworks/index.js +0 -1
- package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
- package/src/rule-factories/remove-packages/index.d.ts +0 -1
- package/src/rule-factories/remove-packages/index.d.ts.map +1 -1
- package/src/rule-factories/remove-packages/index.js +0 -1
- package/src/rule-factories/remove-packages/index.js.map +1 -1
- package/src/rule-factories/update-imports/list-of-vars.d.ts +1 -2
- package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -1
- package/src/rule-factories/update-imports/list-of-vars.js.map +1 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +0 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.js +0 -1
- package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
- package/src/rule-factories/update-imports/update-ts-imports.d.ts +0 -1
- package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -1
- package/src/rule-factories/update-imports/update-ts-imports.js +0 -1
- package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js +1 -1
- package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -1
- package/src/rule-factories/vscode-extensions/index.d.ts +0 -1
- package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -1
- package/src/rule-factories/vscode-extensions/index.js +0 -1
- package/src/rule-factories/vscode-extensions/index.js.map +1 -1
- package/src/rules/install.d.ts +0 -1
- package/src/rules/install.d.ts.map +1 -1
- package/src/rules/install.js +0 -1
- package/src/rules/install.js.map +1 -1
- package/src/tasks/eslint/index.d.ts +0 -9
- package/src/tasks/eslint/index.d.ts.map +1 -1
- package/src/tasks/eslint/index.js +3 -4
- package/src/tasks/eslint/index.js.map +1 -1
- package/src/utility/ast.d.ts +4 -20
- package/src/utility/ast.d.ts.map +1 -1
- package/src/utility/ast.js +0 -18
- package/src/utility/ast.js.map +1 -1
- package/src/utility/builder.d.ts +11 -0
- package/src/utility/builder.d.ts.map +1 -0
- package/src/utility/builder.js +21 -0
- package/src/utility/builder.js.map +1 -0
- package/src/utility/component.d.ts +0 -6
- package/src/utility/component.d.ts.map +1 -1
- package/src/utility/component.js +0 -6
- package/src/utility/component.js.map +1 -1
- package/src/utility/dependencies.d.ts +0 -2
- package/src/utility/dependencies.d.ts.map +1 -1
- package/src/utility/dependencies.js +0 -2
- package/src/utility/dependencies.js.map +1 -1
- package/src/utility/file-info.d.ts +11 -1
- package/src/utility/file-info.d.ts.map +1 -1
- package/src/utility/file-info.js +46 -4
- package/src/utility/file-info.js.map +1 -1
- package/src/utility/gitignore.d.ts +0 -1
- package/src/utility/gitignore.d.ts.map +1 -1
- package/src/utility/gitignore.js +0 -1
- package/src/utility/gitignore.js.map +1 -1
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +1 -0
- package/src/utility/index.js.map +1 -1
- package/src/utility/loaders.d.ts +4 -44
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +10 -93
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/logo.d.ts +0 -1
- package/src/utility/logo.d.ts.map +1 -1
- package/src/utility/logo.js +0 -1
- package/src/utility/logo.js.map +1 -1
- package/src/utility/matching-peers.d.ts +11 -3
- package/src/utility/matching-peers.d.ts.map +1 -1
- package/src/utility/matching-peers.js +26 -5
- package/src/utility/matching-peers.js.map +1 -1
- package/src/utility/modules.d.ts +2 -2
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +12 -12
- package/src/utility/modules.js.map +1 -1
- package/src/utility/monorepo.d.ts +0 -5
- package/src/utility/monorepo.d.ts.map +1 -1
- package/src/utility/monorepo.js +0 -5
- package/src/utility/monorepo.js.map +1 -1
- package/src/utility/package-manager-runner.d.ts +2 -2
- package/src/utility/package-manager-runner.d.ts.map +1 -1
- package/src/utility/package-version.d.ts +0 -2
- package/src/utility/package-version.d.ts.map +1 -1
- package/src/utility/package-version.js +0 -2
- package/src/utility/package-version.js.map +1 -1
- package/src/utility/question.d.ts +0 -1
- package/src/utility/question.d.ts.map +1 -1
- package/src/utility/question.js +0 -1
- package/src/utility/question.js.map +1 -1
- package/src/utility/routes.d.ts +0 -3
- package/src/utility/routes.d.ts.map +1 -1
- package/src/utility/routes.js +0 -5
- package/src/utility/routes.js.map +1 -1
- package/src/utility/sub-entry.d.ts +0 -2
- package/src/utility/sub-entry.d.ts.map +1 -1
- package/src/utility/sub-entry.js +0 -2
- package/src/utility/sub-entry.js.map +1 -1
- package/src/utility/template-property.helper.d.ts +0 -15
- package/src/utility/template-property.helper.d.ts.map +1 -1
- package/src/utility/template-property.helper.js +0 -16
- package/src/utility/template-property.helper.js.map +1 -1
- package/src/utility/update-imports.d.ts +0 -1
- package/src/utility/update-imports.d.ts.map +1 -1
- package/src/utility/update-imports.js +0 -1
- package/src/utility/update-imports.js.map +1 -1
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { SchematicOptionObject, WorkspaceProject } from '../interfaces';
|
2
|
+
/**
|
3
|
+
* Register the builder to the workspace
|
4
|
+
* @param workspaceProject Workspace project to add the builder to
|
5
|
+
* @param taskName Name of the task to defined
|
6
|
+
* @param taskParameters Parameter of the task to defined
|
7
|
+
* @param force Override task if already defined
|
8
|
+
* @returns the updated workspace
|
9
|
+
*/
|
10
|
+
export declare function registerBuilder(workspaceProject: WorkspaceProject, taskName: string, taskParameters: SchematicOptionObject, force?: boolean): WorkspaceProject;
|
11
|
+
//# sourceMappingURL=builder.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/utility/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,KAAK,UAAQ,GAAG,gBAAgB,CAO5J"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerBuilder = void 0;
|
4
|
+
/**
|
5
|
+
* Register the builder to the workspace
|
6
|
+
* @param workspaceProject Workspace project to add the builder to
|
7
|
+
* @param taskName Name of the task to defined
|
8
|
+
* @param taskParameters Parameter of the task to defined
|
9
|
+
* @param force Override task if already defined
|
10
|
+
* @returns the updated workspace
|
11
|
+
*/
|
12
|
+
function registerBuilder(workspaceProject, taskName, taskParameters, force = false) {
|
13
|
+
workspaceProject.architect ||= {};
|
14
|
+
if (workspaceProject.architect[taskName] && !force) {
|
15
|
+
throw new Error(`The builder task ${taskName} already exist`);
|
16
|
+
}
|
17
|
+
workspaceProject.architect[taskName] = taskParameters;
|
18
|
+
return workspaceProject;
|
19
|
+
}
|
20
|
+
exports.registerBuilder = registerBuilder;
|
21
|
+
//# sourceMappingURL=builder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../src/utility/builder.ts"],"names":[],"mappings":";;;AAEA;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,gBAAkC,EAAE,QAAgB,EAAE,cAAqC,EAAE,KAAK,GAAG,KAAK;IACxI,gBAAgB,CAAC,SAAS,KAAK,EAAE,CAAC;IAClC,IAAI,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;QAClD,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,gBAAgB,CAAC,CAAC;KAC/D;IACD,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;IACtD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAPD,0CAOC"}
|
@@ -3,25 +3,21 @@ import * as ts from 'typescript';
|
|
3
3
|
import { DecoratorWithArg } from './ast';
|
4
4
|
/**
|
5
5
|
* Returns true if `node` is the decorator of an Angular component
|
6
|
-
*
|
7
6
|
* @param node
|
8
7
|
*/
|
9
8
|
export declare const isNgClassDecorator: (node: ts.Node) => node is DecoratorWithArg;
|
10
9
|
/**
|
11
10
|
* Returns true if `node` is the decorator of an Otter component
|
12
|
-
*
|
13
11
|
* @param node
|
14
12
|
*/
|
15
13
|
export declare const isO3rClassDecorator: (node: ts.Node) => node is DecoratorWithArg;
|
16
14
|
/**
|
17
15
|
* Returns true if `classDeclaration` is an Otter component
|
18
|
-
*
|
19
16
|
* @param classDeclaration
|
20
17
|
*/
|
21
18
|
export declare const isNgClassComponent: (classDeclaration: ts.ClassDeclaration) => boolean;
|
22
19
|
/**
|
23
20
|
* Returns true if `classDeclaration` is an Otter component
|
24
|
-
*
|
25
21
|
* @param classDeclaration
|
26
22
|
*/
|
27
23
|
export declare const isO3rClassComponent: (classDeclaration: ts.ClassDeclaration) => boolean;
|
@@ -31,7 +27,6 @@ export declare class NoOtterComponent extends Error {
|
|
31
27
|
}
|
32
28
|
/**
|
33
29
|
* Returns Otter component information
|
34
|
-
*
|
35
30
|
* @param tree
|
36
31
|
* @param componentPath
|
37
32
|
*/
|
@@ -43,7 +38,6 @@ export declare const getO3rComponentInfoOrThrowIfNotFound: (tree: Tree, componen
|
|
43
38
|
};
|
44
39
|
/**
|
45
40
|
* Transformer factory to add imports into the angular component decorator
|
46
|
-
*
|
47
41
|
* @param imports
|
48
42
|
*/
|
49
43
|
export declare const addImportsIntoComponentDecoratorTransformerFactory: (imports: string[]) => ts.TransformerFactory<ts.Node>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAA6D,MAAM,OAAO,CAAC;AAGpG
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAA6D,MAAM,OAAO,CAAC;AAGpG;;;GAGG;AACH,eAAO,MAAM,kBAAkB,SAAU,OAAO,6BAEsB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,SAAU,OAAO,6BAEwB,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAAsB,GAAG,gBAAgB,YAAwE,CAAC;AAEjJ;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qBAAsB,GAAG,gBAAgB,YAEA,CAAC;AAE1E,eAAO,MAAM,iCAAiC,wBAA0G,CAAC;AAEzJ,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,aAAa,EAAE,MAAM;CAOlC;AAED;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,SAAU,IAAI,iBAAiB,MAAM;;;;;CA4DrF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kDAAkD,YACpD,MAAM,EAAE,KAChB,GAAG,kBAAkB,CAAC,OAAO,CA4B/B,CAAC"}
|
package/src/utility/component.js
CHANGED
@@ -7,7 +7,6 @@ const ast_1 = require("./ast");
|
|
7
7
|
const error_1 = require("./error");
|
8
8
|
/**
|
9
9
|
* Returns true if `node` is the decorator of an Angular component
|
10
|
-
*
|
11
10
|
* @param node
|
12
11
|
*/
|
13
12
|
const isNgClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
|
@@ -15,7 +14,6 @@ const isNgClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
|
|
15
14
|
exports.isNgClassDecorator = isNgClassDecorator;
|
16
15
|
/**
|
17
16
|
* Returns true if `node` is the decorator of an Otter component
|
18
|
-
*
|
19
17
|
* @param node
|
20
18
|
*/
|
21
19
|
const isO3rClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
|
@@ -23,14 +21,12 @@ const isO3rClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
|
|
23
21
|
exports.isO3rClassDecorator = isO3rClassDecorator;
|
24
22
|
/**
|
25
23
|
* Returns true if `classDeclaration` is an Otter component
|
26
|
-
*
|
27
24
|
* @param classDeclaration
|
28
25
|
*/
|
29
26
|
const isNgClassComponent = (classDeclaration) => (ts.getDecorators(classDeclaration) || []).some(exports.isNgClassDecorator);
|
30
27
|
exports.isNgClassComponent = isNgClassComponent;
|
31
28
|
/**
|
32
29
|
* Returns true if `classDeclaration` is an Otter component
|
33
|
-
*
|
34
30
|
* @param classDeclaration
|
35
31
|
*/
|
36
32
|
const isO3rClassComponent = (classDeclaration) => (0, exports.isNgClassComponent)(classDeclaration)
|
@@ -50,7 +46,6 @@ class NoOtterComponent extends Error {
|
|
50
46
|
exports.NoOtterComponent = NoOtterComponent;
|
51
47
|
/**
|
52
48
|
* Returns Otter component information
|
53
|
-
*
|
54
49
|
* @param tree
|
55
50
|
* @param componentPath
|
56
51
|
*/
|
@@ -90,7 +85,6 @@ const getO3rComponentInfoOrThrowIfNotFound = (tree, componentPath) => {
|
|
90
85
|
exports.getO3rComponentInfoOrThrowIfNotFound = getO3rComponentInfoOrThrowIfNotFound;
|
91
86
|
/**
|
92
87
|
* Transformer factory to add imports into the angular component decorator
|
93
|
-
*
|
94
88
|
* @param imports
|
95
89
|
*/
|
96
90
|
const addImportsIntoComponentDecoratorTransformerFactory = (imports) => (ctx) => (rootNode) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":";;;AACA,8DAAoE;AACpE,iCAAiC;AACjC,+BAAoG;AACpG,mCAAsC;AAEtC
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/utility/component.ts"],"names":[],"mappings":";;;AACA,8DAAoE;AACpE,iCAAiC;AACjC,+BAAoG;AACpG,mCAAsC;AAEtC;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAA4B,EAAE,CAC5E,IAAA,wBAAkB,EAAC,IAAI,CAAC;OACrB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,W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AC,CAAC,CAAgC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,SAAS,CAAC;oBAC/H,OAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,4BAA4B,CAC9E,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,EACrF,IAAI,CACL,CAAC;iBACH,EAAE,IAAI,CAAC;aACT,CACF,CACF,CAAC;SACH;QACD,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC;IACF,OAAO,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AA9BW,QAAA,kDAAkD,sDA8B7D"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { NodeDependency, NodeDependencyType } from '@schematics/angular/utility/dependencies';
|
2
2
|
/**
|
3
3
|
* Method to extract the provided package version range from a package.json file
|
4
|
-
*
|
5
4
|
* @param packageNames list of package we want to retrieve the version
|
6
5
|
* @param packageJsonPath Path to the package.json to refer to
|
7
6
|
* @returns The version range value retrieved from the provided package.json file
|
@@ -9,7 +8,6 @@ import { NodeDependency, NodeDependencyType } from '@schematics/angular/utility/
|
|
9
8
|
export declare function getExternalDependenciesVersionRange<T extends string>(packageNames: T[], packageJsonPath: string): Record<T, string>;
|
10
9
|
/**
|
11
10
|
* Method used to build the list of node dependencies to be installed
|
12
|
-
*
|
13
11
|
* @param dependenciesVersions map of dependency and its associated required version
|
14
12
|
* @param type node type of the dependency
|
15
13
|
* @returns the list of node dependencies to be installed
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/utility/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,0CAA0C,CAAC;AAE5F
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/utility/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,0CAA0C,CAAC;AAE5F;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,CAAC,SAAS,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAMnI;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,cAAc,EAAE,CAE3I"}
|
@@ -4,7 +4,6 @@ exports.getNodeDependencyList = exports.getExternalDependenciesVersionRange = vo
|
|
4
4
|
const fs = require("node:fs");
|
5
5
|
/**
|
6
6
|
* Method to extract the provided package version range from a package.json file
|
7
|
-
*
|
8
7
|
* @param packageNames list of package we want to retrieve the version
|
9
8
|
* @param packageJsonPath Path to the package.json to refer to
|
10
9
|
* @returns The version range value retrieved from the provided package.json file
|
@@ -19,7 +18,6 @@ function getExternalDependenciesVersionRange(packageNames, packageJsonPath) {
|
|
19
18
|
exports.getExternalDependenciesVersionRange = getExternalDependenciesVersionRange;
|
20
19
|
/**
|
21
20
|
* Method used to build the list of node dependencies to be installed
|
22
|
-
*
|
23
21
|
* @param dependenciesVersions map of dependency and its associated required version
|
24
22
|
* @param type node type of the dependency
|
25
23
|
* @returns the list of node dependencies to be installed
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/utility/dependencies.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAG9B
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/utility/dependencies.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAG9B;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAmB,YAAiB,EAAE,eAAuB;IAC9G,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,GAA+B,EAAE,WAAW,EAAE,EAAE;QAC1E,GAAG,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,IAAI,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,WAAW,CAAC,CAAC;QACjI,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAsB,CAAC;AAC9B,CAAC;AAND,kFAMC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAmB,oBAAuC,EAAE,IAAwB;IACvH,OAAO,MAAM,CAAC,OAAO,CAAS,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;AACzH,CAAC;AAFD,sDAEC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { SchematicContext, Tree } from '@angular-devkit/schematics';
|
2
2
|
import * as ts from 'typescript';
|
3
|
+
import type { SourceFile } from 'typescript';
|
3
4
|
/**
|
4
5
|
* File information in schematics context
|
5
6
|
*/
|
@@ -12,10 +13,19 @@ export interface FileInfo {
|
|
12
13
|
ngModulesMetadata: ts.Node[] | undefined;
|
13
14
|
/** File content as string */
|
14
15
|
appModuleFile: string | undefined;
|
16
|
+
/** Starting index of the module decorator in the file content */
|
17
|
+
moduleIndex: number;
|
18
|
+
/** In case of standalone, we are referencing a component instead of a module */
|
19
|
+
isStandalone: boolean;
|
15
20
|
}
|
21
|
+
/**
|
22
|
+
* Get the module index of the decorator in a file (supports both standalone and module)
|
23
|
+
* @param sourceFile
|
24
|
+
* @param sourceContent
|
25
|
+
*/
|
26
|
+
export declare function getModuleIndex(sourceFile: SourceFile, sourceContent: string): Pick<FileInfo, 'ngModulesMetadata' | 'moduleIndex' | 'isStandalone'>;
|
16
27
|
/**
|
17
28
|
* Get file information in schematics context
|
18
|
-
*
|
19
29
|
* @param tree
|
20
30
|
* @param context
|
21
31
|
* @param projectName
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,4CAA4C;IAC5C,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC;IAEtC,8CAA8C;IAC9C,iBAAiB,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;IAEzC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IAEpB,gFAAgF;IAChF,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,mBAAmB,GAAG,aAAa,GAAG,cAAc,CAAC,CA8BlJ;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,YAmClG"}
|
package/src/utility/file-info.js
CHANGED
@@ -1,12 +1,49 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getFileInfo = void 0;
|
3
|
+
exports.getFileInfo = exports.getModuleIndex = void 0;
|
4
4
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
5
5
|
const ts = require("typescript");
|
6
6
|
const modules_1 = require("./modules");
|
7
|
+
/**
|
8
|
+
* Get the module index of the decorator in a file (supports both standalone and module)
|
9
|
+
* @param sourceFile
|
10
|
+
* @param sourceContent
|
11
|
+
*/
|
12
|
+
function getModuleIndex(sourceFile, sourceContent) {
|
13
|
+
const decorators = [
|
14
|
+
{ name: 'NgModule', isStandalone: false },
|
15
|
+
{ name: 'Component', isStandalone: true }
|
16
|
+
];
|
17
|
+
for (const decorator of decorators) {
|
18
|
+
const moduleMetadata = (0, ast_utils_1.getDecoratorMetadata)(sourceFile, decorator.name, '@angular/core');
|
19
|
+
if (moduleMetadata[0]) {
|
20
|
+
return {
|
21
|
+
ngModulesMetadata: moduleMetadata,
|
22
|
+
moduleIndex: moduleMetadata[0].pos - (decorator.name.length + 1),
|
23
|
+
isStandalone: decorator.isStandalone
|
24
|
+
};
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
const index = sourceContent.indexOf(`@${decorator.name}`);
|
28
|
+
if (index >= 0) {
|
29
|
+
return {
|
30
|
+
ngModulesMetadata: undefined,
|
31
|
+
moduleIndex: index,
|
32
|
+
isStandalone: decorator.isStandalone
|
33
|
+
};
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
// No decorators found, put the index just before the first export (which will work for the appConfig in standalone)
|
38
|
+
return {
|
39
|
+
ngModulesMetadata: undefined,
|
40
|
+
moduleIndex: sourceContent.indexOf('export '),
|
41
|
+
isStandalone: true
|
42
|
+
};
|
43
|
+
}
|
44
|
+
exports.getModuleIndex = getModuleIndex;
|
7
45
|
/**
|
8
46
|
* Get file information in schematics context
|
9
|
-
*
|
10
47
|
* @param tree
|
11
48
|
* @param context
|
12
49
|
* @param projectName
|
@@ -16,7 +53,9 @@ function getFileInfo(tree, context, projectName) {
|
|
16
53
|
moduleFilePath: undefined,
|
17
54
|
sourceFile: undefined,
|
18
55
|
ngModulesMetadata: undefined,
|
19
|
-
appModuleFile: undefined
|
56
|
+
appModuleFile: undefined,
|
57
|
+
moduleIndex: -1,
|
58
|
+
isStandalone: false
|
20
59
|
};
|
21
60
|
const moduleFilePath = (0, modules_1.getAppModuleFilePath)(tree, context, projectName);
|
22
61
|
if (!moduleFilePath) {
|
@@ -29,8 +68,11 @@ function getFileInfo(tree, context, projectName) {
|
|
29
68
|
}
|
30
69
|
const sourceFile = ts.createSourceFile(moduleFilePath, tree.read(moduleFilePath).toString(), ts.ScriptTarget.ES2015, true);
|
31
70
|
fileInfo.sourceFile = sourceFile;
|
32
|
-
fileInfo.ngModulesMetadata = (0, ast_utils_1.getDecoratorMetadata)(sourceFile, 'NgModule', '@angular/core');
|
33
71
|
fileInfo.appModuleFile = tree.read(moduleFilePath).toString();
|
72
|
+
const moduleIndex = getModuleIndex(sourceFile, fileInfo.appModuleFile);
|
73
|
+
fileInfo.ngModulesMetadata = moduleIndex.ngModulesMetadata;
|
74
|
+
fileInfo.moduleIndex = moduleIndex.moduleIndex;
|
75
|
+
fileInfo.isStandalone = moduleIndex.isStandalone;
|
34
76
|
return fileInfo;
|
35
77
|
}
|
36
78
|
exports.getFileInfo = getFileInfo;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-info.js","sourceRoot":"","sources":["../../../src/utility/file-info.ts"],"names":[],"mappings":";;;AACA,
|
1
|
+
{"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":["../../../src/utility/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,gEAoBrG"}
|
package/src/utility/gitignore.js
CHANGED
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ignorePatterns = void 0;
|
4
4
|
/**
|
5
5
|
* Add patterns to .gitignore file
|
6
|
-
*
|
7
6
|
* @param tree Schematics files tree
|
8
7
|
* @param patternsToAdd List of patterns with description to add to gitignore files
|
9
8
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":";;;AAEA
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../../src/utility/gitignore.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAU,EAAE,aAA2D;IACpG,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;QAE9B,IAAI,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAE,CAAC,QAAQ,EAAE,CAAC;QACzD,IAAI,KAAK,GAAG,KAAK,CAAC;QAElB,aAAa;aACV,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,EAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE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AAc,kBAAkB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
package/src/utility/index.js
CHANGED
@@ -22,4 +22,5 @@ tslib_1.__exportStar(require("./routes"), exports);
|
|
22
22
|
tslib_1.__exportStar(require("./sub-entry"), exports);
|
23
23
|
tslib_1.__exportStar(require("./template-property.helper"), exports);
|
24
24
|
tslib_1.__exportStar(require("./update-imports"), exports);
|
25
|
+
tslib_1.__exportStar(require("./builder"), exports);
|
25
26
|
//# sourceMappingURL=index.js.map
|
package/src/utility/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,oDAA0B"}
|
package/src/utility/loaders.d.ts
CHANGED
@@ -11,14 +11,6 @@ import type { WorkspaceProject, WorkspaceSchema } from '../interfaces/index';
|
|
11
11
|
* @param ignoreDirectories optional parameter to ignore folders
|
12
12
|
*/
|
13
13
|
export declare function findFilesInTree(directory: DirEntry, fileMatchesCriteria: (file: string) => boolean, ignoreDirectories?: string[]): FileEntry[];
|
14
|
-
/**
|
15
|
-
* Load the angular.json file
|
16
|
-
* @param tree File tree
|
17
|
-
* @param angularJsonFile Angular.json file path
|
18
|
-
* @throws Angular JSON invalid or non exist
|
19
|
-
* @deprecate use {@link getWorkspaceConfig} function instead, will be removed in Otter v10
|
20
|
-
*/
|
21
|
-
export declare function readAngularJson(tree: Tree, angularJsonFile?: string): WorkspaceSchema;
|
22
14
|
/**
|
23
15
|
* Load the Workspace configuration object
|
24
16
|
* @param tree File tree
|
@@ -40,42 +32,12 @@ export declare function writeAngularJson(tree: Tree, workspace: WorkspaceSchema,
|
|
40
32
|
* @throws Package JSON invalid or non exist
|
41
33
|
*/
|
42
34
|
export declare function readPackageJson(tree: Tree, workspaceProject: WorkspaceProject): PackageJson;
|
43
|
-
/**
|
44
|
-
* Get the workspace project
|
45
|
-
* @param tree File tree
|
46
|
-
* @param projectName Name of the Angular project
|
47
|
-
* @param projectType
|
48
|
-
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
49
|
-
*/
|
50
|
-
export declare function getProjectFromTree(tree: Tree, projectName?: string | null, projectType?: 'application' | 'library'): WorkspaceProject & {
|
51
|
-
name: string;
|
52
|
-
} | undefined;
|
53
|
-
/**
|
54
|
-
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
55
|
-
* @param tree Files tree
|
56
|
-
* @param projectName Name of the project inside the workspace
|
57
|
-
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
58
|
-
*/
|
59
|
-
export declare function getProjectRootDir(tree: Tree, projectName?: string | null): string | undefined;
|
60
|
-
/**
|
61
|
-
* Return the type of install to run depending on the project type (Peer or default)
|
62
|
-
* @deprecated please use {@link getProjectNewDependenciesType} instead. Will be removed in v10
|
63
|
-
* @param tree
|
64
|
-
*/
|
65
|
-
export declare function getProjectDepType(tree: Tree): NodeDependencyType.Default | NodeDependencyType.Peer;
|
66
35
|
/**
|
67
36
|
* Return the type of install to run depending on the project type (Peer or default)
|
68
37
|
* @param project
|
69
38
|
* @param tree
|
70
39
|
*/
|
71
40
|
export declare function getProjectNewDependenciesType(project?: WorkspaceProject): NodeDependencyType.Default | NodeDependencyType.Peer;
|
72
|
-
/**
|
73
|
-
* Get the default project name
|
74
|
-
* @deprecated use {@link getWorkspaceConfig} function instead, will be removed in Otter V10
|
75
|
-
* @param projectType
|
76
|
-
* @param tree File tree
|
77
|
-
*/
|
78
|
-
export declare function getDefaultProjectName(tree: Tree, projectType?: 'application' | 'library'): string | undefined;
|
79
41
|
/**
|
80
42
|
* Get the folder of the templates for a specific sub-schematics
|
81
43
|
* @param rootPath Root directory of the schematics ran
|
@@ -92,13 +54,11 @@ export declare function getTemplateFolder(rootPath: string, currentPath: string,
|
|
92
54
|
*/
|
93
55
|
export declare function getAllFilesInTree(tree: Tree, basePath?: string, excludes?: string[], recursive?: boolean): string[];
|
94
56
|
/**
|
95
|
-
* Get
|
96
|
-
* @
|
97
|
-
* @param tree
|
98
|
-
* @param folderInProject
|
99
|
-
* @param extension
|
57
|
+
* Get the path of all the files in the Tree
|
58
|
+
* @param tree Schematics file tree
|
59
|
+
* @param patterns Array of globs to be search in the tree
|
100
60
|
*/
|
101
|
-
export declare function
|
61
|
+
export declare function globInTree(tree: Tree, patterns: string[]): string[];
|
102
62
|
/**
|
103
63
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
104
64
|
* @param tree
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAuB,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAuB,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAG9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAiB7E;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EAAE,iBAAiB,GAAE,MAAM,EAAsC,eAInK;AAED;;;;;GAKG;AACH,wBAAgB,k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AAE,IAAI,YAE7D"}
|
package/src/utility/loaders.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.
|
3
|
+
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.globInTree = exports.getAllFilesInTree = exports.getTemplateFolder = exports.getProjectNewDependenciesType = exports.readPackageJson = exports.writeAngularJson = exports.getWorkspaceConfig = exports.findFilesInTree = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
6
|
-
const globby_1 = require("globby");
|
7
6
|
const minimatch_1 = require("minimatch");
|
8
7
|
const path = require("node:path");
|
9
8
|
function findFilesInTreeRec(memory, directory, fileMatchesCriteria, ignoreDirectories) {
|
@@ -30,21 +29,6 @@ function findFilesInTree(directory, fileMatchesCriteria, ignoreDirectories = ['n
|
|
30
29
|
return Array.from(memory);
|
31
30
|
}
|
32
31
|
exports.findFilesInTree = findFilesInTree;
|
33
|
-
/**
|
34
|
-
* Load the angular.json file
|
35
|
-
* @param tree File tree
|
36
|
-
* @param angularJsonFile Angular.json file path
|
37
|
-
* @throws Angular JSON invalid or non exist
|
38
|
-
* @deprecate use {@link getWorkspaceConfig} function instead, will be removed in Otter v10
|
39
|
-
*/
|
40
|
-
function readAngularJson(tree, angularJsonFile = '/angular.json') {
|
41
|
-
if (!tree.exists(angularJsonFile)) {
|
42
|
-
throw new schematics_1.SchematicsException('Could not find Angular workspace configuration');
|
43
|
-
}
|
44
|
-
const workspaceConfig = tree.readJson(angularJsonFile);
|
45
|
-
return workspaceConfig;
|
46
|
-
}
|
47
|
-
exports.readAngularJson = readAngularJson;
|
48
32
|
/**
|
49
33
|
* Load the Workspace configuration object
|
50
34
|
* @param tree File tree
|
@@ -84,56 +68,6 @@ function readPackageJson(tree, workspaceProject) {
|
|
84
68
|
return workspaceConfig;
|
85
69
|
}
|
86
70
|
exports.readPackageJson = readPackageJson;
|
87
|
-
/**
|
88
|
-
* Get the workspace project
|
89
|
-
* @param tree File tree
|
90
|
-
* @param projectName Name of the Angular project
|
91
|
-
* @param projectType
|
92
|
-
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
93
|
-
*/
|
94
|
-
function getProjectFromTree(tree, projectName, projectType) {
|
95
|
-
const workspace = getWorkspaceConfig(tree);
|
96
|
-
if (!workspace) {
|
97
|
-
return undefined;
|
98
|
-
}
|
99
|
-
const projectGuessedName = projectName || Object.keys(workspace.projects)[0];
|
100
|
-
// eslint-disable-next-line max-len
|
101
|
-
let workspaceProject = projectGuessedName && workspace.projects[projectGuessedName] && (!projectType || workspace.projects[projectGuessedName]?.projectType === projectType) ?
|
102
|
-
{
|
103
|
-
...workspace.projects[projectGuessedName],
|
104
|
-
name: projectGuessedName
|
105
|
-
} :
|
106
|
-
undefined;
|
107
|
-
// if not found we fallback to the more relevant first one
|
108
|
-
if (!workspaceProject) {
|
109
|
-
workspaceProject = Object.entries(workspace.projects)
|
110
|
-
.filter(([, project]) => !projectType || project.projectType === projectType)
|
111
|
-
.map(([name, project]) => ({ ...project, name }))[0];
|
112
|
-
}
|
113
|
-
return workspaceProject;
|
114
|
-
}
|
115
|
-
exports.getProjectFromTree = getProjectFromTree;
|
116
|
-
/**
|
117
|
-
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
118
|
-
* @param tree Files tree
|
119
|
-
* @param projectName Name of the project inside the workspace
|
120
|
-
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
121
|
-
*/
|
122
|
-
function getProjectRootDir(tree, projectName) {
|
123
|
-
return getProjectFromTree(tree, projectName)?.root;
|
124
|
-
}
|
125
|
-
exports.getProjectRootDir = getProjectRootDir;
|
126
|
-
/**
|
127
|
-
* Return the type of install to run depending on the project type (Peer or default)
|
128
|
-
* @deprecated please use {@link getProjectNewDependenciesType} instead. Will be removed in v10
|
129
|
-
* @param tree
|
130
|
-
*/
|
131
|
-
function getProjectDepType(tree) {
|
132
|
-
const workspaceProject = tree.exists('angular.json') ? getProjectFromTree(tree) : undefined;
|
133
|
-
const projectType = workspaceProject?.projectType || 'application';
|
134
|
-
return projectType === 'application' ? dependencies_1.NodeDependencyType.Default : dependencies_1.NodeDependencyType.Peer;
|
135
|
-
}
|
136
|
-
exports.getProjectDepType = getProjectDepType;
|
137
71
|
/**
|
138
72
|
* Return the type of install to run depending on the project type (Peer or default)
|
139
73
|
* @param project
|
@@ -143,16 +77,6 @@ function getProjectNewDependenciesType(project) {
|
|
143
77
|
return project?.projectType === 'library' ? dependencies_1.NodeDependencyType.Peer : dependencies_1.NodeDependencyType.Default;
|
144
78
|
}
|
145
79
|
exports.getProjectNewDependenciesType = getProjectNewDependenciesType;
|
146
|
-
/**
|
147
|
-
* Get the default project name
|
148
|
-
* @deprecated use {@link getWorkspaceConfig} function instead, will be removed in Otter V10
|
149
|
-
* @param projectType
|
150
|
-
* @param tree File tree
|
151
|
-
*/
|
152
|
-
function getDefaultProjectName(tree, projectType) {
|
153
|
-
return getProjectFromTree(tree, null, projectType)?.name;
|
154
|
-
}
|
155
|
-
exports.getDefaultProjectName = getDefaultProjectName;
|
156
80
|
/**
|
157
81
|
* Get the folder of the templates for a specific sub-schematics
|
158
82
|
* @param rootPath Root directory of the schematics ran
|
@@ -182,22 +106,15 @@ function getAllFilesInTree(tree, basePath = '/', excludes = [], recursive = true
|
|
182
106
|
}
|
183
107
|
exports.getAllFilesInTree = getAllFilesInTree;
|
184
108
|
/**
|
185
|
-
* Get
|
186
|
-
* @
|
187
|
-
* @param tree
|
188
|
-
* @param folderInProject
|
189
|
-
* @param extension
|
109
|
+
* Get the path of all the files in the Tree
|
110
|
+
* @param tree Schematics file tree
|
111
|
+
* @param patterns Array of globs to be search in the tree
|
190
112
|
*/
|
191
|
-
function
|
192
|
-
const
|
193
|
-
|
194
|
-
.map((project) => path.join(project.root, folderInProject, '**', `*.${extension}`).replace(/\\/g, '/'));
|
195
|
-
return projectSources.reduce((acc, projectSource) => {
|
196
|
-
acc.push(...(0, globby_1.sync)(projectSource, { ignore: ['**/node_modules/**'] }));
|
197
|
-
return acc;
|
198
|
-
}, []);
|
113
|
+
function globInTree(tree, patterns) {
|
114
|
+
const files = getAllFilesInTree(tree);
|
115
|
+
return files.filter((basePath) => patterns.some((p) => (0, minimatch_1.minimatch)(basePath, p, { dot: true })));
|
199
116
|
}
|
200
|
-
exports.
|
117
|
+
exports.globInTree = globInTree;
|
201
118
|
/**
|
202
119
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
203
120
|
* @param tree
|
@@ -205,10 +122,10 @@ exports.getFilesInFolderFromWorkspaceProjects = getFilesInFolderFromWorkspacePro
|
|
205
122
|
* @param extension
|
206
123
|
*/
|
207
124
|
function getFilesInFolderFromWorkspaceProjectsInTree(tree, folderInProject, extension) {
|
208
|
-
const workspace =
|
125
|
+
const workspace = getWorkspaceConfig(tree);
|
209
126
|
const extensionMatcher = new RegExp(`\\.${extension.replace(/^\./, '')}$`);
|
210
127
|
const excludes = ['**/node_modules/**', '**/.cache/**'];
|
211
|
-
return Object.values(workspace
|
128
|
+
return Object.values(workspace?.projects || {})
|
212
129
|
.flatMap((project) => getAllFilesInTree(tree, path.posix.join(project.root, folderInProject), excludes))
|
213
130
|
.filter((filePath) => extensionMatcher.test(filePath));
|
214
131
|
}
|