@o3r/schematics 10.0.0-next.9 → 10.0.0-prerelease.2

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.
Files changed (193) hide show
  1. package/README.md +1 -1
  2. package/package.json +51 -41
  3. package/schematics/ng-add/index.d.ts.map +1 -1
  4. package/schematics/ng-add/index.js +3 -2
  5. package/schematics/ng-add/schema.json +2 -2
  6. package/src/cli/environment.d.ts +2 -0
  7. package/src/cli/environment.d.ts.map +1 -0
  8. package/src/cli/environment.js +5 -0
  9. package/src/cli/environment.js.map +1 -0
  10. package/src/interfaces/angular-workspace.d.ts +11 -29
  11. package/src/interfaces/angular-workspace.d.ts.map +1 -1
  12. package/src/modules/index.d.ts +1 -0
  13. package/src/modules/index.d.ts.map +1 -1
  14. package/src/modules/index.js +1 -0
  15. package/src/modules/index.js.map +1 -1
  16. package/src/modules/modules.constants.d.ts +6 -2
  17. package/src/modules/modules.constants.d.ts.map +1 -1
  18. package/src/modules/modules.constants.js +5 -3
  19. package/src/modules/modules.constants.js.map +1 -1
  20. package/src/modules/modules.display.rule.d.ts +26 -0
  21. package/src/modules/modules.display.rule.d.ts.map +1 -0
  22. package/src/modules/modules.display.rule.js +45 -0
  23. package/src/modules/modules.display.rule.js.map +1 -0
  24. package/src/modules/modules.helpers.d.ts +2 -9
  25. package/src/modules/modules.helpers.d.ts.map +1 -1
  26. package/src/modules/modules.helpers.js +1 -6
  27. package/src/modules/modules.helpers.js.map +1 -1
  28. package/src/rule-factories/add-imports/index.d.ts +0 -1
  29. package/src/rule-factories/add-imports/index.d.ts.map +1 -1
  30. package/src/rule-factories/add-imports/index.js +0 -1
  31. package/src/rule-factories/add-imports/index.js.map +1 -1
  32. package/src/rule-factories/check-packages-peers/index.d.ts +0 -1
  33. package/src/rule-factories/check-packages-peers/index.d.ts.map +1 -1
  34. package/src/rule-factories/check-packages-peers/index.js +4 -7
  35. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  36. package/src/rule-factories/dev-tools/devtools-registration.d.ts +25 -0
  37. package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -0
  38. package/src/rule-factories/dev-tools/devtools-registration.js +89 -0
  39. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -0
  40. package/src/rule-factories/dev-tools/index.d.ts +2 -0
  41. package/src/rule-factories/dev-tools/index.d.ts.map +1 -0
  42. package/src/rule-factories/dev-tools/index.js +5 -0
  43. package/src/rule-factories/dev-tools/index.js.map +1 -0
  44. package/src/rule-factories/eslint-fix/index.d.ts +1 -18
  45. package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
  46. package/src/rule-factories/eslint-fix/index.js +17 -26
  47. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  48. package/src/rule-factories/get-test-frameworks/index.d.ts +0 -1
  49. package/src/rule-factories/get-test-frameworks/index.d.ts.map +1 -1
  50. package/src/rule-factories/get-test-frameworks/index.js +0 -1
  51. package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
  52. package/src/rule-factories/index.d.ts +1 -0
  53. package/src/rule-factories/index.d.ts.map +1 -1
  54. package/src/rule-factories/index.js +1 -0
  55. package/src/rule-factories/index.js.map +1 -1
  56. package/src/rule-factories/ng-add/index.d.ts +2 -5
  57. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  58. package/src/rule-factories/ng-add/index.js +107 -83
  59. package/src/rule-factories/ng-add/index.js.map +1 -1
  60. package/src/rule-factories/remove-packages/index.d.ts +0 -1
  61. package/src/rule-factories/remove-packages/index.d.ts.map +1 -1
  62. package/src/rule-factories/remove-packages/index.js +0 -1
  63. package/src/rule-factories/remove-packages/index.js.map +1 -1
  64. package/src/rule-factories/update-imports/list-of-vars.d.ts +1 -2
  65. package/src/rule-factories/update-imports/list-of-vars.d.ts.map +1 -1
  66. package/src/rule-factories/update-imports/list-of-vars.js.map +1 -1
  67. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts +0 -1
  68. package/src/rule-factories/update-imports/update-imports-with-scope.d.ts.map +1 -1
  69. package/src/rule-factories/update-imports/update-imports-with-scope.js +0 -1
  70. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
  71. package/src/rule-factories/update-imports/update-ts-imports.d.ts +0 -1
  72. package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -1
  73. package/src/rule-factories/update-imports/update-ts-imports.js +0 -1
  74. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
  75. package/src/rule-factories/update-imports/v7-to-v8-map-object.js +1 -1
  76. package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +1 -1
  77. package/src/rule-factories/vscode-extensions/index.d.ts +0 -1
  78. package/src/rule-factories/vscode-extensions/index.d.ts.map +1 -1
  79. package/src/rule-factories/vscode-extensions/index.js +0 -1
  80. package/src/rule-factories/vscode-extensions/index.js.map +1 -1
  81. package/src/rules/install.d.ts +0 -1
  82. package/src/rules/install.d.ts.map +1 -1
  83. package/src/rules/install.js +0 -1
  84. package/src/rules/install.js.map +1 -1
  85. package/src/tasks/eslint/index.d.ts +17 -1
  86. package/src/tasks/eslint/index.d.ts.map +1 -1
  87. package/src/tasks/eslint/index.js +15 -6
  88. package/src/tasks/eslint/index.js.map +1 -1
  89. package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
  90. package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
  91. package/src/tasks/package-manager/add-dev-dependency.js +3 -1
  92. package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
  93. package/src/tasks/package-manager/interfaces.d.ts +9 -0
  94. package/src/tasks/package-manager/interfaces.d.ts.map +1 -1
  95. package/src/tasks/package-manager/npm-install.d.ts +2 -1
  96. package/src/tasks/package-manager/npm-install.d.ts.map +1 -1
  97. package/src/tasks/package-manager/npm-install.js +3 -1
  98. package/src/tasks/package-manager/npm-install.js.map +1 -1
  99. package/src/utility/ast.d.ts +4 -20
  100. package/src/utility/ast.d.ts.map +1 -1
  101. package/src/utility/ast.js +0 -18
  102. package/src/utility/ast.js.map +1 -1
  103. package/src/utility/builder.d.ts +11 -0
  104. package/src/utility/builder.d.ts.map +1 -0
  105. package/src/utility/builder.js +21 -0
  106. package/src/utility/builder.js.map +1 -0
  107. package/src/utility/collection.d.ts +2 -5
  108. package/src/utility/collection.d.ts.map +1 -1
  109. package/src/utility/collection.js +11 -9
  110. package/src/utility/collection.js.map +1 -1
  111. package/src/utility/component.d.ts +0 -6
  112. package/src/utility/component.d.ts.map +1 -1
  113. package/src/utility/component.js +4 -9
  114. package/src/utility/component.js.map +1 -1
  115. package/src/utility/dependencies.d.ts +0 -2
  116. package/src/utility/dependencies.d.ts.map +1 -1
  117. package/src/utility/dependencies.js +0 -2
  118. package/src/utility/dependencies.js.map +1 -1
  119. package/src/utility/environment.d.ts +27 -0
  120. package/src/utility/environment.d.ts.map +1 -0
  121. package/src/utility/environment.js +51 -0
  122. package/src/utility/environment.js.map +1 -0
  123. package/src/utility/error.d.ts +7 -0
  124. package/src/utility/error.d.ts.map +1 -0
  125. package/src/utility/error.js +17 -0
  126. package/src/utility/error.js.map +1 -0
  127. package/src/utility/file-info.d.ts +11 -1
  128. package/src/utility/file-info.d.ts.map +1 -1
  129. package/src/utility/file-info.js +46 -4
  130. package/src/utility/file-info.js.map +1 -1
  131. package/src/utility/generation.d.ts +0 -1
  132. package/src/utility/generation.d.ts.map +1 -1
  133. package/src/utility/generation.js +7 -11
  134. package/src/utility/generation.js.map +1 -1
  135. package/src/utility/gitignore.d.ts +0 -1
  136. package/src/utility/gitignore.d.ts.map +1 -1
  137. package/src/utility/gitignore.js +0 -1
  138. package/src/utility/gitignore.js.map +1 -1
  139. package/src/utility/index.d.ts +10 -7
  140. package/src/utility/index.d.ts.map +1 -1
  141. package/src/utility/index.js +10 -7
  142. package/src/utility/index.js.map +1 -1
  143. package/src/utility/loaders.d.ts +12 -50
  144. package/src/utility/loaders.d.ts.map +1 -1
  145. package/src/utility/loaders.js +34 -97
  146. package/src/utility/loaders.js.map +1 -1
  147. package/src/utility/logo.d.ts +0 -1
  148. package/src/utility/logo.d.ts.map +1 -1
  149. package/src/utility/logo.js +0 -1
  150. package/src/utility/logo.js.map +1 -1
  151. package/src/utility/matching-peers.d.ts +18 -6
  152. package/src/utility/matching-peers.d.ts.map +1 -1
  153. package/src/utility/matching-peers.js +33 -10
  154. package/src/utility/matching-peers.js.map +1 -1
  155. package/src/utility/modules.d.ts +4 -9
  156. package/src/utility/modules.d.ts.map +1 -1
  157. package/src/utility/modules.js +17 -22
  158. package/src/utility/modules.js.map +1 -1
  159. package/src/utility/monorepo.d.ts +0 -5
  160. package/src/utility/monorepo.d.ts.map +1 -1
  161. package/src/utility/monorepo.js +0 -5
  162. package/src/utility/monorepo.js.map +1 -1
  163. package/src/utility/package-manager-runner.d.ts +24 -7
  164. package/src/utility/package-manager-runner.d.ts.map +1 -1
  165. package/src/utility/package-manager-runner.js +70 -10
  166. package/src/utility/package-manager-runner.js.map +1 -1
  167. package/src/utility/package-version.d.ts +0 -2
  168. package/src/utility/package-version.d.ts.map +1 -1
  169. package/src/utility/package-version.js +0 -2
  170. package/src/utility/package-version.js.map +1 -1
  171. package/src/utility/question.d.ts +0 -1
  172. package/src/utility/question.d.ts.map +1 -1
  173. package/src/utility/question.js +0 -1
  174. package/src/utility/question.js.map +1 -1
  175. package/src/utility/routes.d.ts +0 -3
  176. package/src/utility/routes.d.ts.map +1 -1
  177. package/src/utility/routes.js +0 -5
  178. package/src/utility/routes.js.map +1 -1
  179. package/src/utility/sub-entry.d.ts +0 -2
  180. package/src/utility/sub-entry.d.ts.map +1 -1
  181. package/src/utility/sub-entry.js +0 -2
  182. package/src/utility/sub-entry.js.map +1 -1
  183. package/src/utility/template-property.helper.d.ts +0 -15
  184. package/src/utility/template-property.helper.d.ts.map +1 -1
  185. package/src/utility/template-property.helper.js +0 -16
  186. package/src/utility/template-property.helper.js.map +1 -1
  187. package/src/utility/update-imports.d.ts +0 -1
  188. package/src/utility/update-imports.d.ts.map +1 -1
  189. package/src/utility/update-imports.js +0 -1
  190. package/src/utility/update-imports.js.map +1 -1
  191. package/schematics/ng-add/index.js.map +0 -1
  192. package/schematics/ng-add/schema.js.map +0 -1
  193. package/schematics/package.json +0 -3
@@ -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"}
@@ -2,7 +2,6 @@ import { SchematicContext } from '@angular-devkit/schematics';
2
2
  import type { WorkspaceSchema, WorkspaceSchematics } from '../interfaces';
3
3
  /**
4
4
  * Register the collection schematic to the workspace
5
- *
6
5
  * @param workspace Workspace to add the collection to
7
6
  * @param collection Collection to add to the workspace schematic collection
8
7
  * @returns the updated workspace
@@ -11,20 +10,18 @@ export declare function registerCollectionSchematics(workspace: WorkspaceSchema,
11
10
  /**
12
11
  * Get default options for a schematic
13
12
  * This will look inside angular.json file for schematics with keys containing wildcards like `*:ng-add` or `@o3r/core:*`
14
- *
15
13
  * @param workspace
16
14
  * @param collection
17
15
  * @param schematicName
18
16
  * @param options
19
17
  * @param options.projectName
20
18
  */
21
- export declare function getDefaultOptionsForSchematic(workspace: WorkspaceSchema | null, collection: string, schematicName: string, options: {
19
+ export declare function getDefaultOptionsForSchematic<T extends WorkspaceSchematics['*:*'] = WorkspaceSchematics['*:*']>(workspace: WorkspaceSchema | null, collection: string, schematicName: string, options?: {
22
20
  projectName?: string | undefined;
23
- }): Record<string, string>;
21
+ }): T;
24
22
  /**
25
23
  * Retrieves the schematics options of a given schematics name
26
24
  * If the schematics name is not found, then the generic options (*:*) will be returned. If the latter is not present the function returns undefined
27
- *
28
25
  * @param config
29
26
  * @param context
30
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAO5G;AAED;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,0BAcxK;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAUxK"}
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAO5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC1C,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,CAAC,CAmBrM;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAUxK"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSchematicOptions = exports.getDefaultOptionsForSchematic = exports.registerCollectionSchematics = void 0;
4
4
  /**
5
5
  * Register the collection schematic to the workspace
6
- *
7
6
  * @param workspace Workspace to add the collection to
8
7
  * @param collection Collection to add to the workspace schematic collection
9
8
  * @returns the updated workspace
@@ -20,7 +19,6 @@ exports.registerCollectionSchematics = registerCollectionSchematics;
20
19
  /**
21
20
  * Get default options for a schematic
22
21
  * This will look inside angular.json file for schematics with keys containing wildcards like `*:ng-add` or `@o3r/core:*`
23
- *
24
22
  * @param workspace
25
23
  * @param collection
26
24
  * @param schematicName
@@ -33,19 +31,23 @@ function getDefaultOptionsForSchematic(workspace, collection, schematicName, opt
33
31
  }
34
32
  const schematicsDefaultParams = [
35
33
  workspace.schematics,
36
- ...options.projectName ? [workspace.projects[options.projectName]?.schematics] : []
34
+ ...options?.projectName ? [workspace.projects[options.projectName]?.schematics] : []
37
35
  ];
38
- return schematicsDefaultParams.flatMap((schematics) => schematics ?
39
- Object.entries(schematics)
40
- .filter(([key, _]) => key === `*:${schematicName}` || key === `${collection}:*`)
41
- .map(([_, value]) => value) :
42
- []).reduce((out, defaultParams) => ({ ...out, ...defaultParams }), {});
36
+ return schematicsDefaultParams.reduce((acc, schematics) => {
37
+ if (!schematics) {
38
+ return acc;
39
+ }
40
+ return Object.entries(schematics)
41
+ .filter(([key, _]) => key === `*:${schematicName}` || key === `${collection}:*` || key === `${collection}:${schematicName}`)
42
+ .sort(([a], [b]) => (a.match(/\*/g)?.length || 0) - (b.match(/\*/g)?.length || 0))
43
+ .map(([_, value]) => value)
44
+ .reduce((config, value) => ({ ...config, ...value }), acc);
45
+ }, {});
43
46
  }
44
47
  exports.getDefaultOptionsForSchematic = getDefaultOptionsForSchematic;
45
48
  /**
46
49
  * Retrieves the schematics options of a given schematics name
47
50
  * If the schematics name is not found, then the generic options (*:*) will be returned. If the latter is not present the function returns undefined
48
- *
49
51
  * @param config
50
52
  * @param context
51
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/utility/collection.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,SAA0B,EAAE,UAAkB;IACzF,SAAS,CAAC,GAAG,KAAK,EAAE,CAAC;IACrB,SAAS,CAAC,GAAG,CAAC,o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C,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;AACvF,CAAC;AAVD,kDAUC"}
@@ -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,E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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"}
@@ -4,9 +4,9 @@ exports.addImportsIntoComponentDecoratorTransformerFactory = exports.getO3rCompo
4
4
  const prompt_1 = require("@angular/cli/src/utilities/prompt");
5
5
  const ts = require("typescript");
6
6
  const ast_1 = require("./ast");
7
+ const error_1 = require("./error");
7
8
  /**
8
9
  * Returns true if `node` is the decorator of an Angular component
9
- *
10
10
  * @param node
11
11
  */
12
12
  const isNgClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
@@ -14,7 +14,6 @@ const isNgClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
14
14
  exports.isNgClassDecorator = isNgClassDecorator;
15
15
  /**
16
16
  * Returns true if `node` is the decorator of an Otter component
17
- *
18
17
  * @param node
19
18
  */
20
19
  const isO3rClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
@@ -22,14 +21,12 @@ const isO3rClassDecorator = (node) => (0, ast_1.isDecoratorWithArg)(node)
22
21
  exports.isO3rClassDecorator = isO3rClassDecorator;
23
22
  /**
24
23
  * Returns true if `classDeclaration` is an Otter component
25
- *
26
24
  * @param classDeclaration
27
25
  */
28
26
  const isNgClassComponent = (classDeclaration) => (ts.getDecorators(classDeclaration) || []).some(exports.isNgClassDecorator);
29
27
  exports.isNgClassComponent = isNgClassComponent;
30
28
  /**
31
29
  * Returns true if `classDeclaration` is an Otter component
32
- *
33
30
  * @param classDeclaration
34
31
  */
35
32
  const isO3rClassComponent = (classDeclaration) => (0, exports.isNgClassComponent)(classDeclaration)
@@ -49,7 +46,6 @@ class NoOtterComponent extends Error {
49
46
  exports.NoOtterComponent = NoOtterComponent;
50
47
  /**
51
48
  * Returns Otter component information
52
- *
53
49
  * @param tree
54
50
  * @param componentPath
55
51
  */
@@ -57,21 +53,21 @@ const getO3rComponentInfoOrThrowIfNotFound = (tree, componentPath) => {
57
53
  const sourceFile = ts.createSourceFile(componentPath, tree.readText(componentPath), ts.ScriptTarget.ES2020, true);
58
54
  const ngComponentDeclaration = sourceFile.statements.find((s) => ts.isClassDeclaration(s) && (0, exports.isNgClassComponent)(s));
59
55
  if (!ngComponentDeclaration) {
60
- throw new Error(`No Angular component found in ${componentPath}.`);
56
+ throw new error_1.O3rCliError(`No Angular component found in ${componentPath}.`);
61
57
  }
62
58
  if (!(0, exports.isO3rClassComponent)(ngComponentDeclaration)) {
63
59
  throw new NoOtterComponent(componentPath);
64
60
  }
65
61
  const name = ngComponentDeclaration.name?.escapedText.toString().replace(/Component$/, '');
66
62
  if (!name) {
67
- throw new Error(`The class' name is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
63
+ throw new error_1.O3rCliError(`The class' name is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
68
64
  }
69
65
  const selectorExpression = (0, ast_1.getPropertyFromDecoratorFirstArgument)(ts.getDecorators(ngComponentDeclaration)?.find(exports.isNgClassDecorator), 'selector');
70
66
  const selector = selectorExpression && ts.isStringLiteral(selectorExpression)
71
67
  ? selectorExpression.text
72
68
  : selectorExpression?.getText();
73
69
  if (!selector) {
74
- throw new Error(`The component's selector is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
70
+ throw new error_1.O3rCliError(`The component's selector is not specified. Please provide one for the Otter component defined in ${componentPath}.`);
75
71
  }
76
72
  const standaloneExpression = (0, ast_1.getPropertyFromDecoratorFirstArgument)(ts.getDecorators(ngComponentDeclaration)?.find(exports.isNgClassDecorator), 'standalone');
77
73
  const standalone = standaloneExpression?.kind === ts.SyntaxKind.TrueKeyword;
@@ -89,7 +85,6 @@ const getO3rComponentInfoOrThrowIfNotFound = (tree, componentPath) => {
89
85
  exports.getO3rComponentInfoOrThrowIfNotFound = getO3rComponentInfoOrThrowIfNotFound;
90
86
  /**
91
87
  * Transformer factory to add imports into the angular component decorator
92
- *
93
88
  * @param imports
94
89
  */
95
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;AAEpG;;;;GAIG;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,WAAW,CAAC;AAF1D,QAAA,kBAAkB,sBAEwC;AAEvE;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAa,EAA4B,EAAE,CAC7E,IAAA,wBAAkB,EAAC,IAAI,CAAC;OACrB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,cAAc,CAAC;AAF7D,QAAA,mBAAmB,uBAE0C;AAE1E;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,gBAAqC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,0BAAkB,CAAC,CAAC;AAApI,QAAA,kBAAkB,sBAAkH;AAEjJ;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,gBAAqC,EAAE,EAAE,CAC3E,IAAA,0BAAkB,EAAC,gBAAgB,CAAC;OACjC,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,2BAAmB,CAAC,CAAC;AAF7D,QAAA,mBAAmB,uBAE0C;AAEnE,MAAM,iCAAiC,GAAG,GAAG,EAAE,CAAC,IAAA,wBAAe,EAAC,0EAA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,UAAU,CAAC,UAAU,EAC1B,IAAI,CAAC,UAAU,CAAC,aAAa,EAC7B;gBACE,OAAO,CAAC,6BAA6B,CAAC;oBACpC,GAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,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;;;;;;GAMG;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;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,cAAc,EAAE,CAE3I"}
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;;;;;;GAMG;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;;;;;;GAMG;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
+ {"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"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Get all environment information
3
+ * Could be useful for debugging issue
4
+ */
5
+ export declare const getEnvironmentInfo: () => {
6
+ os: {
7
+ architecture: string;
8
+ platform: NodeJS.Platform;
9
+ version: string;
10
+ };
11
+ node: {
12
+ version: string | null;
13
+ };
14
+ packageManager: {
15
+ name: import("./package-manager-runner").SupportedPackageManagers;
16
+ version: string | undefined;
17
+ };
18
+ otter: {
19
+ version: string | undefined;
20
+ };
21
+ };
22
+ /**
23
+ * Stringify the result of `getEnvironmentInfo`
24
+ * @see getEnvironmentInfo
25
+ */
26
+ export declare const getEnvironmentInfoStringify: () => string;
27
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/utility/environment.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAmB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,cAWvC,CAAC"}
@@ -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,7 @@
1
+ /**
2
+ * Error to be throw when otter script failed
3
+ */
4
+ export declare class O3rCliError extends Error {
5
+ constructor(error: any);
6
+ }
7
+ //# sourceMappingURL=error.d.ts.map
@@ -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,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,EAAC,gBAAgB,EAAE,IAAI,EAAC,MAAM,4BAA4B,C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AC,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"}
@@ -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,qEAA2E;AAC3E,iCAAiC;AACjC,uCAA+C;AAmB/C;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB,EAAE,WAAgC;IACjG,MAAM,QAAQ,GAAa;QACzB,cAAc,EAAE,SAAS;QACzB,UAAU,EAAE,SAAS;QACrB,iBAAiB,EAAE,SAAS;QAC5B,aAAa,EAAE,SAAS;KACzB,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACxE,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,QAAQ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AAC;KACjB;IAED,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,cAAc,EACd,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,EAAE,EACrC,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IACF,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,EAAE,CAAC;IAE/D,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACvE,QAAQ,CAAC,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;IAC3D,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAC/C,QAAQ,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC;IAEjD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAnCD,kCAmCC"}
@@ -12,7 +12,6 @@ export declare const TYPES_DEFAULT_FOLDER: {
12
12
  };
13
13
  /**
14
14
  * Get destination path for a generated item
15
- *
16
15
  * @param typeOfItem
17
16
  * @param directory
18
17
  * @param tree
@@ -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;AAIlD,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;;;;;;;GAOG;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,CA+BnJ"}
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,CAuBnJ"}
@@ -1,7 +1,9 @@
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");
6
+ const collection_1 = require("./collection");
5
7
  /** List of Otter items types */
6
8
  exports.OTTER_ITEM_TYPES = [
7
9
  '@o3r/core:component',
@@ -31,7 +33,6 @@ exports.TYPES_DEFAULT_FOLDER = {
31
33
  };
32
34
  /**
33
35
  * Get destination path for a generated item
34
- *
35
36
  * @param typeOfItem
36
37
  * @param directory
37
38
  * @param tree
@@ -41,27 +42,22 @@ function getDestinationPath(typeOfItem, directory, tree, project) {
41
42
  if (directory) {
42
43
  return directory;
43
44
  }
44
- /**
45
- * @param workspace
46
- * @param generatorName
47
- */
48
- const getSchematicsPropertyFrom = (workspace, generatorName) => {
49
- return workspace.schematics?.[generatorName] || null;
50
- };
51
45
  /**
52
46
  * @param generatorName
53
47
  * @param propTree
54
48
  * @param propProject
55
49
  */
56
50
  const getSchematicsProperty = (generatorName, propTree, propProject) => {
57
- const workspaceProject = (0, loaders_1.getProjectFromTree)(propTree, propProject);
58
- return workspaceProject ? getSchematicsPropertyFrom(workspaceProject, generatorName) || getSchematicsPropertyFrom((0, loaders_1.readAngularJson)(propTree), generatorName) : null;
51
+ const workspace = (0, loaders_1.getWorkspaceConfig)(propTree);
52
+ const [collection, schematicName] = generatorName.split(':');
53
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
54
+ return workspace && (0, collection_1.getDefaultOptionsForSchematic)(workspace, collection, schematicName, { projectName: propProject || undefined }) || null;
59
55
  };
60
56
  const config = getSchematicsProperty(typeOfItem, tree, project);
61
57
  if (config && config.path) {
62
58
  return config.path;
63
59
  }
64
- throw new Error('No destination directory configured.');
60
+ throw new error_1.O3rCliError('No destination directory configured.');
65
61
  }
66
62
  exports.getDestinationPath = getDestinationPath;
67
63
  //# sourceMappingURL=generation.js.map