@o3r/schematics 9.3.0-alpha.6 → 9.3.0-alpha.60
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +22 -17
- package/src/cli/environment.d.ts +2 -0
- package/src/cli/environment.d.ts.map +1 -0
- package/src/cli/environment.js +5 -0
- package/src/cli/environment.js.map +1 -0
- package/src/interfaces/angular-workspace.d.ts +1 -0
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
- package/src/rule-factories/check-packages-peers/index.js +4 -4
- package/src/rule-factories/check-packages-peers/index.js.map +1 -1
- package/src/rule-factories/ng-add/index.d.ts +1 -5
- package/src/rule-factories/ng-add/index.d.ts.map +1 -1
- package/src/rule-factories/ng-add/index.js +97 -80
- package/src/rule-factories/ng-add/index.js.map +1 -1
- package/src/utility/component.d.ts.map +1 -1
- package/src/utility/component.js +4 -3
- package/src/utility/component.js.map +1 -1
- package/src/utility/environment.d.ts +27 -0
- package/src/utility/environment.d.ts.map +1 -0
- package/src/utility/environment.js +51 -0
- package/src/utility/environment.js.map +1 -0
- package/src/utility/error.d.ts +7 -0
- package/src/utility/error.d.ts.map +1 -0
- package/src/utility/error.js +17 -0
- package/src/utility/error.js.map +1 -0
- package/src/utility/generation.d.ts +0 -1
- package/src/utility/generation.d.ts.map +1 -1
- package/src/utility/generation.js +5 -4
- package/src/utility/generation.js.map +1 -1
- package/src/utility/index.d.ts +2 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +2 -0
- package/src/utility/index.js.map +1 -1
- package/src/utility/loaders.d.ts +10 -17
- package/src/utility/loaders.d.ts.map +1 -1
- package/src/utility/loaders.js +14 -18
- package/src/utility/loaders.js.map +1 -1
- package/src/utility/modules.d.ts +2 -7
- package/src/utility/modules.d.ts.map +1 -1
- package/src/utility/modules.js +5 -10
- package/src/utility/modules.js.map +1 -1
- package/src/utility/monorepo.d.ts +6 -0
- package/src/utility/monorepo.d.ts.map +1 -1
- package/src/utility/monorepo.js +12 -1
- package/src/utility/monorepo.js.map +1 -1
- package/src/utility/package-manager-runner.d.ts +16 -1
- package/src/utility/package-manager-runner.d.ts.map +1 -1
- package/src/utility/package-manager-runner.js +39 -1
- package/src/utility/package-manager-runner.js.map +1 -1
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getEnvironmentInfoStringify = exports.getEnvironmentInfo = void 0;
|
4
|
+
const fs = require("node:fs");
|
5
|
+
const os = require("node:os");
|
6
|
+
const semver = require("semver");
|
7
|
+
const package_manager_runner_1 = require("./package-manager-runner");
|
8
|
+
/**
|
9
|
+
* Get all environment information
|
10
|
+
* Could be useful for debugging issue
|
11
|
+
*/
|
12
|
+
const getEnvironmentInfo = () => {
|
13
|
+
const nodeVersion = semver.parse(process.version);
|
14
|
+
const osInfo = {
|
15
|
+
architecture: os.arch(),
|
16
|
+
platform: os.platform(),
|
17
|
+
version: os.release()
|
18
|
+
};
|
19
|
+
const nodeInfo = {
|
20
|
+
version: nodeVersion && `${nodeVersion.major}.${nodeVersion.minor}.${nodeVersion.patch}`
|
21
|
+
};
|
22
|
+
const packageManagerInfo = (0, package_manager_runner_1.getPackageManagerInfo)();
|
23
|
+
let otterCorePackageJsonPath;
|
24
|
+
try {
|
25
|
+
otterCorePackageJsonPath = require.resolve('@o3r/core/package.json');
|
26
|
+
}
|
27
|
+
catch { }
|
28
|
+
const otterInfo = {
|
29
|
+
version: otterCorePackageJsonPath ? JSON.parse(fs.readFileSync(otterCorePackageJsonPath, { encoding: 'utf-8' })).version : undefined
|
30
|
+
};
|
31
|
+
return { os: osInfo, node: nodeInfo, packageManager: packageManagerInfo, otter: otterInfo };
|
32
|
+
};
|
33
|
+
exports.getEnvironmentInfo = getEnvironmentInfo;
|
34
|
+
/**
|
35
|
+
* Stringify the result of `getEnvironmentInfo`
|
36
|
+
* @see getEnvironmentInfo
|
37
|
+
*/
|
38
|
+
const getEnvironmentInfoStringify = () => {
|
39
|
+
const { os: osInfo, node: nodeInfo, packageManager: packageManagerInfo, otter: otterInfo } = (0, exports.getEnvironmentInfo)();
|
40
|
+
return `
|
41
|
+
- User Agent Architecture: ${osInfo.architecture}
|
42
|
+
- User Agent Platform: ${osInfo.platform}
|
43
|
+
- User Agent Version: ${osInfo.version}
|
44
|
+
- Node Version: ${nodeInfo.version || 'undefined'}
|
45
|
+
- Package Manager Name: ${packageManagerInfo.name}
|
46
|
+
- Package Manager Version: ${packageManagerInfo.version || 'undefined'}
|
47
|
+
- Otter Version: ${otterInfo.version || 'undefined'}
|
48
|
+
`;
|
49
|
+
};
|
50
|
+
exports.getEnvironmentInfoStringify = getEnvironmentInfoStringify;
|
51
|
+
//# sourceMappingURL=environment.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/utility/environment.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,8BAA8B;AAC9B,iCAAiC;AACjC,qEAAiE;AAEjE;;;GAGG;AACI,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG;QACb,YAAY,EAAE,EAAE,CAAC,IAAI,EAAE;QACvB,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;QACvB,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE;KACtB,CAAC;IACF,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,WAAW,IAAI,GAAG,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;KACzF,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,8CAAqB,GAAE,CAAC;IACnD,IAAI,wBAA4C,CAAC;IACjD,IAAI;QACF,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;KACtE;IAAC,MAAM,GAAE;IACV,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAiB,CAAC,CAAC,CAAC,SAAS;KAC/I,CAAC;IACF,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9F,CAAC,CAAC;AAnBW,QAAA,kBAAkB,sBAmB7B;AAEF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAA,0BAAkB,GAAE,CAAC;IAClH,OAAO;6BACoB,MAAM,CAAC,YAAY;yBACvB,MAAM,CAAC,QAAQ;wBAChB,MAAM,CAAC,OAAO;kBACpB,QAAQ,CAAC,OAAO,IAAI,WAAW;0BACvB,kBAAkB,CAAC,IAAI;6BACpB,kBAAkB,CAAC,OAAO,IAAI,WAAW;mBACnD,SAAS,CAAC,OAAO,IAAI,WAAW;CAClD,CAAC;AACF,CAAC,CAAC;AAXW,QAAA,2BAA2B,+BAWtC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utility/error.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;gBACxB,KAAK,EAAE,GAAG;CAQvB"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.O3rCliError = void 0;
|
4
|
+
const environment_1 = require("./environment");
|
5
|
+
/**
|
6
|
+
* Error to be throw when otter script failed
|
7
|
+
*/
|
8
|
+
class O3rCliError extends Error {
|
9
|
+
constructor(error) {
|
10
|
+
super(error.toString()
|
11
|
+
+ '\n\nYou can file new issues by selecting from our issue templates (https://github.com/AmadeusITGroup/otter/issues/new/choose) and filling out the issue template.'
|
12
|
+
+ '\n\nTo facilitate the reproduction of the issue, do not forget to provide us your environment information:\n'
|
13
|
+
+ (0, environment_1.getEnvironmentInfoStringify)());
|
14
|
+
}
|
15
|
+
}
|
16
|
+
exports.O3rCliError = O3rCliError;
|
17
|
+
//# sourceMappingURL=error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/utility/error.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAE5D;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,KAAU;QACpB,KAAK,CACH,KAAK,CAAC,QAAQ,EAAY;cACxB,mKAAmK;cACnK,8GAA8G;cAC9G,IAAA,yCAA2B,GAAE,CAChC,CAAC;IACJ,CAAC;CACF;AATD,kCASC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../../src/utility/generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../../../src/utility/generation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAKlD,6BAA6B;AAC7B,MAAM,MAAM,iBAAiB,GAC3B,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,iBAAiB,GACjB,6BAA6B,GAC7B,kCAAkC,GAClC,gCAAgC,CAAC;AAEnC,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAQ/C,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,EAAE;KAAG,GAAG,IAAI,iBAAiB,GAAI;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAC;CAe7F,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgCnJ"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getDestinationPath = exports.TYPES_DEFAULT_FOLDER = exports.OTTER_ITEM_TYPES = void 0;
|
4
|
+
const error_1 = require("./error");
|
4
5
|
const loaders_1 = require("./loaders");
|
5
6
|
/** List of Otter items types */
|
6
7
|
exports.OTTER_ITEM_TYPES = [
|
@@ -31,7 +32,6 @@ exports.TYPES_DEFAULT_FOLDER = {
|
|
31
32
|
};
|
32
33
|
/**
|
33
34
|
* Get destination path for a generated item
|
34
|
-
*
|
35
35
|
* @param typeOfItem
|
36
36
|
* @param directory
|
37
37
|
* @param tree
|
@@ -54,14 +54,15 @@ function getDestinationPath(typeOfItem, directory, tree, project) {
|
|
54
54
|
* @param propProject
|
55
55
|
*/
|
56
56
|
const getSchematicsProperty = (generatorName, propTree, propProject) => {
|
57
|
-
const
|
58
|
-
|
57
|
+
const workspace = (0, loaders_1.getWorkspaceConfig)(propTree);
|
58
|
+
const workspaceProject = propProject ? workspace?.projects[propProject] : undefined;
|
59
|
+
return workspaceProject ? getSchematicsPropertyFrom(workspaceProject, generatorName) || getSchematicsPropertyFrom(workspace, generatorName) : null;
|
59
60
|
};
|
60
61
|
const config = getSchematicsProperty(typeOfItem, tree, project);
|
61
62
|
if (config && config.path) {
|
62
63
|
return config.path;
|
63
64
|
}
|
64
|
-
throw new
|
65
|
+
throw new error_1.O3rCliError('No destination directory configured.');
|
65
66
|
}
|
66
67
|
exports.getDestinationPath = getDestinationPath;
|
67
68
|
//# sourceMappingURL=generation.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generation.js","sourceRoot":"","sources":["../../../src/utility/generation.ts"],"names":[],"mappings":";;;AAGA,
|
1
|
+
{"version":3,"file":"generation.js","sourceRoot":"","sources":["../../../src/utility/generation.ts"],"names":[],"mappings":";;;AAGA,mCAAsC;AACtC,uCAA+C;AAY/C,gCAAgC;AACnB,QAAA,gBAAgB,GAAwB;IACnD,qBAAqB;IACrB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,6BAA6B;IAC7B,kCAAkC;IAClC,gCAAgC;CACjC,CAAC;AAEF,sEAAsE;AACzD,QAAA,oBAAoB,GAAkE;IACjG,gEAAgE;IAChE,qBAAqB,EAAE,EAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAC;IACrE,gEAAgE;IAChE,gBAAgB,EAAE,EAAC,GAAG,EAAE,SAAS,EAAC;IAClC,gEAAgE;IAChE,mBAAmB,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,EAAC;IAC/D,gEAAgE;IAChE,iBAAiB,EAAE,EAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAC;IACvD,gEAAgE;IAChE,6BAA6B,EAAE,EAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAC;IAC7E,gEAAgE;IAChE,kCAAkC,EAAE,EAAE,GAAG,EAAE,0BAA0B,EAAE;IACvE,gEAAgE;IAChE,gCAAgC,EAAE,EAAE,GAAG,EAAE,uBAAuB,EAAE;CACnE,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,UAA6B,EAAE,SAAoC,EAAE,IAAU,EAAE,OAAuB;IACzI,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IAED;;;OAGG;I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5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/src/utility/index.js
CHANGED
@@ -20,4 +20,6 @@ tslib_1.__exportStar(require("./monorepo"), exports);
|
|
20
20
|
tslib_1.__exportStar(require("./update-imports"), exports);
|
21
21
|
tslib_1.__exportStar(require("./collection"), exports);
|
22
22
|
tslib_1.__exportStar(require("./logo"), exports);
|
23
|
+
tslib_1.__exportStar(require("./environment"), exports);
|
24
|
+
tslib_1.__exportStar(require("./error"), exports);
|
23
25
|
//# 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,sDAA4B;AAC5B,yDAA+B;AAC/B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,qDAA2B;AAC3B,2DAAiC;AACjC,uDAA6B;AAC7B,iDAAuB"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,sDAA4B;AAC5B,yDAA+B;AAC/B,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,qDAA2B;AAC3B,2DAAiC;AACjC,uDAA6B;AAC7B,iDAAuB;AACvB,wDAA8B;AAC9B,kDAAwB"}
|
package/src/utility/loaders.d.ts
CHANGED
@@ -4,7 +4,6 @@ import type { PackageJson } from 'type-fest';
|
|
4
4
|
import type { WorkspaceProject, WorkspaceSchema } from '../interfaces/index';
|
5
5
|
/**
|
6
6
|
* Load the angular.json file
|
7
|
-
*
|
8
7
|
* @param tree File tree
|
9
8
|
* @param angularJsonFile Angular.json file path
|
10
9
|
* @throws Angular JSON invalid or non exist
|
@@ -13,7 +12,6 @@ import type { WorkspaceProject, WorkspaceSchema } from '../interfaces/index';
|
|
13
12
|
export declare function readAngularJson(tree: Tree, angularJsonFile?: string): WorkspaceSchema;
|
14
13
|
/**
|
15
14
|
* Load the Workspace configuration object
|
16
|
-
*
|
17
15
|
* @param tree File tree
|
18
16
|
* @param workspaceConfigFile Workspace config file path, /angular.json in an Angular project
|
19
17
|
* @returns null if the given config file does not exist
|
@@ -21,7 +19,6 @@ export declare function readAngularJson(tree: Tree, angularJsonFile?: string): W
|
|
21
19
|
export declare function getWorkspaceConfig<T extends WorkspaceSchema = WorkspaceSchema>(tree: Tree, workspaceConfigFile?: string): WorkspaceSchema | null;
|
22
20
|
/**
|
23
21
|
* Update angular.json file
|
24
|
-
*
|
25
22
|
* @param tree File tree
|
26
23
|
* @param workspace Angular workspace
|
27
24
|
* @param angularJsonFile Angular.json file path
|
@@ -29,7 +26,6 @@ export declare function getWorkspaceConfig<T extends WorkspaceSchema = Workspace
|
|
29
26
|
export declare function writeAngularJson(tree: Tree, workspace: WorkspaceSchema, angularJsonFile?: string): import("@angular-devkit/schematics/src/tree/interface").Tree;
|
30
27
|
/**
|
31
28
|
* Load the target's package.json file
|
32
|
-
*
|
33
29
|
* @param tree File tree
|
34
30
|
* @param workspaceProject Angular workspace project
|
35
31
|
* @throws Package JSON invalid or non exist
|
@@ -37,38 +33,42 @@ export declare function writeAngularJson(tree: Tree, workspace: WorkspaceSchema,
|
|
37
33
|
export declare function readPackageJson(tree: Tree, workspaceProject: WorkspaceProject): PackageJson;
|
38
34
|
/**
|
39
35
|
* Get the workspace project
|
40
|
-
*
|
41
36
|
* @param tree File tree
|
42
37
|
* @param projectName Name of the Angular project
|
43
38
|
* @param projectType
|
39
|
+
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
44
40
|
*/
|
45
41
|
export declare function getProjectFromTree(tree: Tree, projectName?: string | null, projectType?: 'application' | 'library'): WorkspaceProject & {
|
46
42
|
name: string;
|
47
43
|
} | undefined;
|
48
44
|
/**
|
49
45
|
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
50
|
-
*
|
51
46
|
* @param tree Files tree
|
52
47
|
* @param projectName Name of the project inside the workspace
|
48
|
+
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
53
49
|
*/
|
54
50
|
export declare function getProjectRootDir(tree: Tree, projectName?: string | null): string | undefined;
|
55
51
|
/**
|
56
52
|
* Return the type of install to run depending on the project type (Peer or default)
|
57
|
-
*
|
53
|
+
* @deprecated please use {@link getProjectNewDependenciesType} instead. Will be removed in v10
|
58
54
|
* @param tree
|
59
55
|
*/
|
60
56
|
export declare function getProjectDepType(tree: Tree): NodeDependencyType.Default | NodeDependencyType.Peer;
|
57
|
+
/**
|
58
|
+
* Return the type of install to run depending on the project type (Peer or default)
|
59
|
+
* @param project
|
60
|
+
* @param tree
|
61
|
+
*/
|
62
|
+
export declare function getProjectNewDependenciesType(project?: WorkspaceProject): NodeDependencyType.Default | NodeDependencyType.Peer;
|
61
63
|
/**
|
62
64
|
* Get the default project name
|
63
|
-
*
|
64
|
-
* @deprecated use {@link getProjectFromTree} function instead, will be removed in Otter V10
|
65
|
+
* @deprecated use {@link getWorkspaceConfig} function instead, will be removed in Otter V10
|
65
66
|
* @param projectType
|
66
67
|
* @param tree File tree
|
67
68
|
*/
|
68
69
|
export declare function getDefaultProjectName(tree: Tree, projectType?: 'application' | 'library'): string | undefined;
|
69
70
|
/**
|
70
71
|
* Get the folder of the templates for a specific sub-schematics
|
71
|
-
*
|
72
72
|
* @param rootPath Root directory of the schematics ran
|
73
73
|
* @param currentPath Directory of the current sub-schematics ran
|
74
74
|
* @param templateFolder Folder containing the templates
|
@@ -76,7 +76,6 @@ export declare function getDefaultProjectName(tree: Tree, projectType?: 'applica
|
|
76
76
|
export declare function getTemplateFolder(rootPath: string, currentPath: string, templateFolder?: string): string;
|
77
77
|
/**
|
78
78
|
* Get the path of all the files in the Tree
|
79
|
-
*
|
80
79
|
* @param basePath Base path from which starting the list
|
81
80
|
* @param tree Schematics file tree
|
82
81
|
* @param excludes Array of globs to be ignored
|
@@ -85,7 +84,6 @@ export declare function getTemplateFolder(rootPath: string, currentPath: string,
|
|
85
84
|
export declare function getAllFilesInTree(tree: Tree, basePath?: string, excludes?: string[], recursive?: boolean): string[];
|
86
85
|
/**
|
87
86
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
88
|
-
*
|
89
87
|
* @deprecated please use {@link getFilesInFolderFromWorkspaceProjectsInTree}, will be removed in v9
|
90
88
|
* @param tree
|
91
89
|
* @param folderInProject
|
@@ -94,7 +92,6 @@ export declare function getAllFilesInTree(tree: Tree, basePath?: string, exclude
|
|
94
92
|
export declare function getFilesInFolderFromWorkspaceProjects(tree: Tree, folderInProject: string, extension: string): string[];
|
95
93
|
/**
|
96
94
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
97
|
-
*
|
98
95
|
* @param tree
|
99
96
|
* @param folderInProject
|
100
97
|
* @param extension
|
@@ -102,28 +99,24 @@ export declare function getFilesInFolderFromWorkspaceProjects(tree: Tree, folder
|
|
102
99
|
export declare function getFilesInFolderFromWorkspaceProjectsInTree(tree: Tree, folderInProject: string, extension: string): string[];
|
103
100
|
/**
|
104
101
|
* Get all files with specific extension from the tree
|
105
|
-
*
|
106
102
|
* @param tree
|
107
103
|
* @param extension
|
108
104
|
*/
|
109
105
|
export declare function getFilesWithExtensionFromTree(tree: Tree, extension: string): string[];
|
110
106
|
/**
|
111
107
|
* Get all files with specific extension from the root of all the projects described in the workspace
|
112
|
-
*
|
113
108
|
* @param tree
|
114
109
|
* @param extension
|
115
110
|
*/
|
116
111
|
export declare function getFilesFromRootOfWorkspaceProjects(tree: Tree, extension: string): string[];
|
117
112
|
/**
|
118
113
|
* Get all files with specific extension from the src folder for all the projects described in the workspace
|
119
|
-
*
|
120
114
|
* @param tree
|
121
115
|
* @param extension
|
122
116
|
*/
|
123
117
|
export declare function getFilesFromWorkspaceProjects(tree: Tree, extension: string): string[];
|
124
118
|
/**
|
125
119
|
* Get all the typescript files from the src folder for all the projects described in the workspace
|
126
|
-
*
|
127
120
|
* @param tree
|
128
121
|
*/
|
129
122
|
export declare function getSourceFilesFromWorkspaceProjects(tree: Tree): string[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":"AAAA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YAE7D"}
|
package/src/utility/loaders.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.getFilesInFolderFromWorkspaceProjects = exports.getAllFilesInTree = exports.getTemplateFolder = exports.getDefaultProjectName = exports.getProjectDepType = exports.getProjectRootDir = exports.getProjectFromTree = exports.readPackageJson = exports.writeAngularJson = exports.getWorkspaceConfig = exports.readAngularJson = void 0;
|
3
|
+
exports.getSourceFilesFromWorkspaceProjects = exports.getFilesFromWorkspaceProjects = exports.getFilesFromRootOfWorkspaceProjects = exports.getFilesWithExtensionFromTree = exports.getFilesInFolderFromWorkspaceProjectsInTree = exports.getFilesInFolderFromWorkspaceProjects = exports.getAllFilesInTree = exports.getTemplateFolder = exports.getDefaultProjectName = exports.getProjectNewDependenciesType = exports.getProjectDepType = exports.getProjectRootDir = exports.getProjectFromTree = exports.readPackageJson = exports.writeAngularJson = exports.getWorkspaceConfig = exports.readAngularJson = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
6
6
|
const globby_1 = require("globby");
|
@@ -8,7 +8,6 @@ const minimatch_1 = require("minimatch");
|
|
8
8
|
const path = require("node:path");
|
9
9
|
/**
|
10
10
|
* Load the angular.json file
|
11
|
-
*
|
12
11
|
* @param tree File tree
|
13
12
|
* @param angularJsonFile Angular.json file path
|
14
13
|
* @throws Angular JSON invalid or non exist
|
@@ -24,7 +23,6 @@ function readAngularJson(tree, angularJsonFile = '/angular.json') {
|
|
24
23
|
exports.readAngularJson = readAngularJson;
|
25
24
|
/**
|
26
25
|
* Load the Workspace configuration object
|
27
|
-
*
|
28
26
|
* @param tree File tree
|
29
27
|
* @param workspaceConfigFile Workspace config file path, /angular.json in an Angular project
|
30
28
|
* @returns null if the given config file does not exist
|
@@ -38,7 +36,6 @@ function getWorkspaceConfig(tree, workspaceConfigFile = '/angular.json') {
|
|
38
36
|
exports.getWorkspaceConfig = getWorkspaceConfig;
|
39
37
|
/**
|
40
38
|
* Update angular.json file
|
41
|
-
*
|
42
39
|
* @param tree File tree
|
43
40
|
* @param workspace Angular workspace
|
44
41
|
* @param angularJsonFile Angular.json file path
|
@@ -50,7 +47,6 @@ function writeAngularJson(tree, workspace, angularJsonFile = '/angular.json') {
|
|
50
47
|
exports.writeAngularJson = writeAngularJson;
|
51
48
|
/**
|
52
49
|
* Load the target's package.json file
|
53
|
-
*
|
54
50
|
* @param tree File tree
|
55
51
|
* @param workspaceProject Angular workspace project
|
56
52
|
* @throws Package JSON invalid or non exist
|
@@ -66,10 +62,10 @@ function readPackageJson(tree, workspaceProject) {
|
|
66
62
|
exports.readPackageJson = readPackageJson;
|
67
63
|
/**
|
68
64
|
* Get the workspace project
|
69
|
-
*
|
70
65
|
* @param tree File tree
|
71
66
|
* @param projectName Name of the Angular project
|
72
67
|
* @param projectType
|
68
|
+
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
73
69
|
*/
|
74
70
|
function getProjectFromTree(tree, projectName, projectType) {
|
75
71
|
const workspace = getWorkspaceConfig(tree);
|
@@ -95,9 +91,9 @@ function getProjectFromTree(tree, projectName, projectType) {
|
|
95
91
|
exports.getProjectFromTree = getProjectFromTree;
|
96
92
|
/**
|
97
93
|
* Returns the root directory of a project with the given name ( a relative path from the project root)
|
98
|
-
*
|
99
94
|
* @param tree Files tree
|
100
95
|
* @param projectName Name of the project inside the workspace
|
96
|
+
* @deprecated please use {@link getWorkspaceConfig} instead. Will be removed in v10
|
101
97
|
*/
|
102
98
|
function getProjectRootDir(tree, projectName) {
|
103
99
|
return getProjectFromTree(tree, projectName)?.root;
|
@@ -105,7 +101,7 @@ function getProjectRootDir(tree, projectName) {
|
|
105
101
|
exports.getProjectRootDir = getProjectRootDir;
|
106
102
|
/**
|
107
103
|
* Return the type of install to run depending on the project type (Peer or default)
|
108
|
-
*
|
104
|
+
* @deprecated please use {@link getProjectNewDependenciesType} instead. Will be removed in v10
|
109
105
|
* @param tree
|
110
106
|
*/
|
111
107
|
function getProjectDepType(tree) {
|
@@ -114,10 +110,18 @@ function getProjectDepType(tree) {
|
|
114
110
|
return projectType === 'application' ? dependencies_1.NodeDependencyType.Default : dependencies_1.NodeDependencyType.Peer;
|
115
111
|
}
|
116
112
|
exports.getProjectDepType = getProjectDepType;
|
113
|
+
/**
|
114
|
+
* Return the type of install to run depending on the project type (Peer or default)
|
115
|
+
* @param project
|
116
|
+
* @param tree
|
117
|
+
*/
|
118
|
+
function getProjectNewDependenciesType(project) {
|
119
|
+
return project?.projectType === 'library' ? dependencies_1.NodeDependencyType.Peer : dependencies_1.NodeDependencyType.Default;
|
120
|
+
}
|
121
|
+
exports.getProjectNewDependenciesType = getProjectNewDependenciesType;
|
117
122
|
/**
|
118
123
|
* Get the default project name
|
119
|
-
*
|
120
|
-
* @deprecated use {@link getProjectFromTree} function instead, will be removed in Otter V10
|
124
|
+
* @deprecated use {@link getWorkspaceConfig} function instead, will be removed in Otter V10
|
121
125
|
* @param projectType
|
122
126
|
* @param tree File tree
|
123
127
|
*/
|
@@ -127,7 +131,6 @@ function getDefaultProjectName(tree, projectType) {
|
|
127
131
|
exports.getDefaultProjectName = getDefaultProjectName;
|
128
132
|
/**
|
129
133
|
* Get the folder of the templates for a specific sub-schematics
|
130
|
-
*
|
131
134
|
* @param rootPath Root directory of the schematics ran
|
132
135
|
* @param currentPath Directory of the current sub-schematics ran
|
133
136
|
* @param templateFolder Folder containing the templates
|
@@ -139,7 +142,6 @@ function getTemplateFolder(rootPath, currentPath, templateFolder = 'templates')
|
|
139
142
|
exports.getTemplateFolder = getTemplateFolder;
|
140
143
|
/**
|
141
144
|
* Get the path of all the files in the Tree
|
142
|
-
*
|
143
145
|
* @param basePath Base path from which starting the list
|
144
146
|
* @param tree Schematics file tree
|
145
147
|
* @param excludes Array of globs to be ignored
|
@@ -157,7 +159,6 @@ function getAllFilesInTree(tree, basePath = '/', excludes = [], recursive = true
|
|
157
159
|
exports.getAllFilesInTree = getAllFilesInTree;
|
158
160
|
/**
|
159
161
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
160
|
-
*
|
161
162
|
* @deprecated please use {@link getFilesInFolderFromWorkspaceProjectsInTree}, will be removed in v9
|
162
163
|
* @param tree
|
163
164
|
* @param folderInProject
|
@@ -175,7 +176,6 @@ function getFilesInFolderFromWorkspaceProjects(tree, folderInProject, extension)
|
|
175
176
|
exports.getFilesInFolderFromWorkspaceProjects = getFilesInFolderFromWorkspaceProjects;
|
176
177
|
/**
|
177
178
|
* Get all files with specific extension from the specified folder for all the projects described in the workspace
|
178
|
-
*
|
179
179
|
* @param tree
|
180
180
|
* @param folderInProject
|
181
181
|
* @param extension
|
@@ -191,7 +191,6 @@ function getFilesInFolderFromWorkspaceProjectsInTree(tree, folderInProject, exte
|
|
191
191
|
exports.getFilesInFolderFromWorkspaceProjectsInTree = getFilesInFolderFromWorkspaceProjectsInTree;
|
192
192
|
/**
|
193
193
|
* Get all files with specific extension from the tree
|
194
|
-
*
|
195
194
|
* @param tree
|
196
195
|
* @param extension
|
197
196
|
*/
|
@@ -204,7 +203,6 @@ function getFilesWithExtensionFromTree(tree, extension) {
|
|
204
203
|
exports.getFilesWithExtensionFromTree = getFilesWithExtensionFromTree;
|
205
204
|
/**
|
206
205
|
* Get all files with specific extension from the root of all the projects described in the workspace
|
207
|
-
*
|
208
206
|
* @param tree
|
209
207
|
* @param extension
|
210
208
|
*/
|
@@ -214,7 +212,6 @@ function getFilesFromRootOfWorkspaceProjects(tree, extension) {
|
|
214
212
|
exports.getFilesFromRootOfWorkspaceProjects = getFilesFromRootOfWorkspaceProjects;
|
215
213
|
/**
|
216
214
|
* Get all files with specific extension from the src folder for all the projects described in the workspace
|
217
|
-
*
|
218
215
|
* @param tree
|
219
216
|
* @param extension
|
220
217
|
*/
|
@@ -224,7 +221,6 @@ function getFilesFromWorkspaceProjects(tree, extension) {
|
|
224
221
|
exports.getFilesFromWorkspaceProjects = getFilesFromWorkspaceProjects;
|
225
222
|
/**
|
226
223
|
* Get all the typescript files from the src folder for all the projects described in the workspace
|
227
|
-
*
|
228
224
|
* @param tree
|
229
225
|
*/
|
230
226
|
function getSourceFilesFromWorkspaceProjects(tree) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AACvE,2EAA8E;AAC9E,mCAA4C;AAC5C,yCAAsC;AACtC,kCAAkC;AAIlC
|
1
|
+
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../src/utility/loaders.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AACvE,2EAA8E;AAC9E,mCAA4C;AAC5C,yCAAsC;AACtC,kCAAkC;AAIlC;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,IAAU,EAAE,eAAe,GAAG,eAAe;IAC3E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QACjC,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,CAAC,CAAC;KACjF;IACD,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACvD,OAAO,eAAsB,CAAC;AAChC,CAAC;AAND,0CAMC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAA8C,IAAU,EAAE,mBAAmB,GAAG,eAAe;IAC/H,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAiB,CAAC;AAC5D,CAAC;AALD,gDAKC;AAED;;;;;GAKG;AACH,SAAgB,gBAA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,CAAC,EAAE,QAAQ,CAAC,CAAC;SACvG,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AAPD,kGAOC;AAGD;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,IAAU,EAAE,SAAiB;IACzE,MAAM,QAAQ,GAAG,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;IACxD,OAAO,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC;SAC1C,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AALD,sEAKC;AAED;;;;GAIG;AACH,SAAgB,mCAAmC,CAAC,IAAU,EAAE,SAAiB;IAC/E,OAAO,2CAA2C,CAAC,IAAI,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AAC1E,CAAC;AAFD,kFAEC;AAED;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,IAAU,EAAE,SAAiB;IACzE,OAAO,2CAA2C,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC7E,CAAC;AAFD,sEAEC;AAGD;;;GAGG;AACH,SAAgB,mCAAmC,CAAC,IAAU;IAC5D,OAAO,6BAA6B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAFD,kFAEC"}
|
package/src/utility/modules.d.ts
CHANGED
@@ -2,7 +2,6 @@ import { SchematicContext, Tree, UpdateRecorder } from '@angular-devkit/schemati
|
|
2
2
|
import * as ts from 'typescript';
|
3
3
|
/**
|
4
4
|
* Get the path to the app.module.ts
|
5
|
-
*
|
6
5
|
* @param tree File tree
|
7
6
|
* @param context Context of the rule
|
8
7
|
* @param projectName The name of the project where to search for an app module file
|
@@ -13,12 +12,12 @@ export declare function getAppModuleFilePath(tree: Tree, context: SchematicConte
|
|
13
12
|
*
|
14
13
|
* @param tree File tree
|
15
14
|
* @param context Context of the rule
|
15
|
+
* @param projectName
|
16
16
|
*/
|
17
|
-
export declare function getMainFilePath(tree: Tree, context: SchematicContext): string | undefined;
|
17
|
+
export declare function getMainFilePath(tree: Tree, context: SchematicContext, projectName?: string): string | undefined;
|
18
18
|
/**
|
19
19
|
* Returns true if the project is an application and contains a TS file that imports the angular RouterModule in
|
20
20
|
* one of its modules.
|
21
|
-
*
|
22
21
|
* @param tree
|
23
22
|
* @param options @see RuleFactory.options
|
24
23
|
* @param options.projectName
|
@@ -28,7 +27,6 @@ export declare function isApplicationThatUsesRouterModule(tree: Tree, options: {
|
|
28
27
|
}): boolean | "" | undefined;
|
29
28
|
/**
|
30
29
|
* Add import to the main module
|
31
|
-
*
|
32
30
|
* @param name
|
33
31
|
* @param file
|
34
32
|
* @param sourceFile
|
@@ -43,7 +41,6 @@ export declare function isApplicationThatUsesRouterModule(tree: Tree, options: {
|
|
43
41
|
export declare function addImportToModuleFile(name: string, file: string, sourceFile: ts.SourceFile, sourceFileContent: string, context: SchematicContext, recorder: UpdateRecorder, moduleFilePath: string, moduleIndex: number, moduleFunction?: string, override?: boolean): UpdateRecorder;
|
44
42
|
/**
|
45
43
|
* Insert import on top of the main module file
|
46
|
-
*
|
47
44
|
* @param name
|
48
45
|
* @param file
|
49
46
|
* @param sourceFile
|
@@ -54,7 +51,6 @@ export declare function addImportToModuleFile(name: string, file: string, source
|
|
54
51
|
export declare function insertImportToModuleFile(name: string, file: string, sourceFile: ts.SourceFile, recorder: UpdateRecorder, moduleFilePath: string, isDefault?: boolean): UpdateRecorder;
|
55
52
|
/**
|
56
53
|
* Add providers to the main module
|
57
|
-
*
|
58
54
|
* @param name
|
59
55
|
* @param file
|
60
56
|
* @param sourceFile
|
@@ -68,7 +64,6 @@ export declare function insertImportToModuleFile(name: string, file: string, sou
|
|
68
64
|
export declare function addProviderToModuleFile(name: string, file: string, sourceFile: ts.SourceFile, sourceFileContent: string, context: SchematicContext, recorder: UpdateRecorder, moduleFilePath: string, moduleIndex: number, customProvider?: string): UpdateRecorder;
|
69
65
|
/**
|
70
66
|
* Add custom code before the module definition
|
71
|
-
*
|
72
67
|
* @param line
|
73
68
|
* @param file
|
74
69
|
* @param recorder
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAuB,IAAI,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAejC
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../src/utility/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAuB,IAAI,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAejC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,sBA0DtG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,sBAU1F;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,4BAgB1G;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EACrI,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,UAAQ,kBAoB3H;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,kBAMpK;AAGD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EACrI,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,kBAY3G;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAK3G"}
|
package/src/utility/modules.js
CHANGED
@@ -12,13 +12,12 @@ const ast_1 = require("./ast");
|
|
12
12
|
const loaders_1 = require("./loaders");
|
13
13
|
/**
|
14
14
|
* Get the path to the app.module.ts
|
15
|
-
*
|
16
15
|
* @param tree File tree
|
17
16
|
* @param context Context of the rule
|
18
17
|
* @param projectName The name of the project where to search for an app module file
|
19
18
|
*/
|
20
19
|
function getAppModuleFilePath(tree, context, projectName) {
|
21
|
-
const workspaceProject = (0, loaders_1.
|
20
|
+
const workspaceProject = projectName ? (0, loaders_1.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
|
22
21
|
// exit if not an application
|
23
22
|
if (!workspaceProject) {
|
24
23
|
context.logger.debug('Aborted. App module file path will be searched only in application project.');
|
@@ -69,9 +68,10 @@ exports.getAppModuleFilePath = getAppModuleFilePath;
|
|
69
68
|
*
|
70
69
|
* @param tree File tree
|
71
70
|
* @param context Context of the rule
|
71
|
+
* @param projectName
|
72
72
|
*/
|
73
|
-
function getMainFilePath(tree, context) {
|
74
|
-
const workspaceProject = (0, loaders_1.
|
73
|
+
function getMainFilePath(tree, context, projectName) {
|
74
|
+
const workspaceProject = projectName ? (0, loaders_1.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
|
75
75
|
// exit if not an application
|
76
76
|
if (!workspaceProject) {
|
77
77
|
context.logger.debug('Register localization on main module only in application project');
|
@@ -84,13 +84,12 @@ exports.getMainFilePath = getMainFilePath;
|
|
84
84
|
/**
|
85
85
|
* Returns true if the project is an application and contains a TS file that imports the angular RouterModule in
|
86
86
|
* one of its modules.
|
87
|
-
*
|
88
87
|
* @param tree
|
89
88
|
* @param options @see RuleFactory.options
|
90
89
|
* @param options.projectName
|
91
90
|
*/
|
92
91
|
function isApplicationThatUsesRouterModule(tree, options) {
|
93
|
-
const workspaceProject = (0, loaders_1.
|
92
|
+
const workspaceProject = options.projectName ? (0, loaders_1.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
94
93
|
const cwd = process.cwd().replace(/[\\/]+/g, '/');
|
95
94
|
const root = (workspaceProject?.root && cwd.endsWith(workspaceProject.root)) ? workspaceProject.root.replace(/[^\\/]+/g, '..') : '.';
|
96
95
|
return workspaceProject?.sourceRoot &&
|
@@ -110,7 +109,6 @@ function isApplicationThatUsesRouterModule(tree, options) {
|
|
110
109
|
exports.isApplicationThatUsesRouterModule = isApplicationThatUsesRouterModule;
|
111
110
|
/**
|
112
111
|
* Add import to the main module
|
113
|
-
*
|
114
112
|
* @param name
|
115
113
|
* @param file
|
116
114
|
* @param sourceFile
|
@@ -149,7 +147,6 @@ function addImportToModuleFile(name, file, sourceFile, sourceFileContent, contex
|
|
149
147
|
exports.addImportToModuleFile = addImportToModuleFile;
|
150
148
|
/**
|
151
149
|
* Insert import on top of the main module file
|
152
|
-
*
|
153
150
|
* @param name
|
154
151
|
* @param file
|
155
152
|
* @param sourceFile
|
@@ -167,7 +164,6 @@ function insertImportToModuleFile(name, file, sourceFile, recorder, moduleFilePa
|
|
167
164
|
exports.insertImportToModuleFile = insertImportToModuleFile;
|
168
165
|
/**
|
169
166
|
* Add providers to the main module
|
170
|
-
*
|
171
167
|
* @param name
|
172
168
|
* @param file
|
173
169
|
* @param sourceFile
|
@@ -194,7 +190,6 @@ function addProviderToModuleFile(name, file, sourceFile, sourceFileContent, cont
|
|
194
190
|
exports.addProviderToModuleFile = addProviderToModuleFile;
|
195
191
|
/**
|
196
192
|
* Add custom code before the module definition
|
197
|
-
*
|
198
193
|
* @param line
|
199
194
|
* @param file
|
200
195
|
* @param recorder
|