@o3r/schematics 10.0.0-prerelease.11 → 10.0.0-prerelease.111

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. package/README.md +2 -1
  2. package/{src/cli → cli}/environment.d.ts.map +1 -1
  3. package/{src/cli → cli}/environment.js +1 -1
  4. package/cli/package.json +3 -0
  5. package/package.json +44 -36
  6. package/schematics/ng-add/index.d.ts +2 -1
  7. package/schematics/ng-add/index.d.ts.map +1 -1
  8. package/schematics/ng-add/index.js +30 -27
  9. package/schematics/ng-add/schema.d.ts +1 -1
  10. package/schematics/ng-add/schema.d.ts.map +1 -1
  11. package/src/interfaces/angular-workspace.d.ts.map +1 -1
  12. package/src/interfaces/index.d.ts +1 -0
  13. package/src/interfaces/index.d.ts.map +1 -1
  14. package/src/interfaces/index.js +1 -0
  15. package/src/interfaces/index.js.map +1 -1
  16. package/src/{rule-factories/interfaces.d.ts → interfaces/rule-factories.d.ts} +2 -2
  17. package/src/interfaces/rule-factories.d.ts.map +1 -0
  18. package/src/{rule-factories/interfaces.js → interfaces/rule-factories.js} +1 -1
  19. package/src/interfaces/rule-factories.js.map +1 -0
  20. package/src/modules/modules.display.rule.d.ts.map +1 -1
  21. package/src/modules/modules.display.rule.js +3 -4
  22. package/src/modules/modules.display.rule.js.map +1 -1
  23. package/src/modules/modules.helpers.d.ts +1 -1
  24. package/src/modules/modules.helpers.d.ts.map +1 -1
  25. package/src/modules/modules.helpers.js +2 -2
  26. package/src/modules/modules.helpers.js.map +1 -1
  27. package/src/public_api.d.ts +6 -1
  28. package/src/public_api.d.ts.map +1 -1
  29. package/src/public_api.js +6 -1
  30. package/src/public_api.js.map +1 -1
  31. package/src/rule-factories/add-imports/index.js.map +1 -1
  32. package/src/rule-factories/dev-tools/devtools-registration.js +7 -7
  33. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
  34. package/src/rule-factories/eslint-fix/index.d.ts +1 -1
  35. package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
  36. package/src/rule-factories/eslint-fix/index.js +5 -3
  37. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  38. package/src/rule-factories/get-test-frameworks/index.js +2 -2
  39. package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
  40. package/src/rule-factories/index.d.ts +1 -1
  41. package/src/rule-factories/index.d.ts.map +1 -1
  42. package/src/rule-factories/index.js +1 -1
  43. package/src/rule-factories/index.js.map +1 -1
  44. package/src/rule-factories/ng-add/dependencies.d.ts +78 -0
  45. package/src/rule-factories/ng-add/dependencies.d.ts.map +1 -0
  46. package/src/rule-factories/ng-add/dependencies.js +156 -0
  47. package/src/rule-factories/ng-add/dependencies.js.map +1 -0
  48. package/src/rule-factories/ng-add/index.d.ts +3 -36
  49. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  50. package/src/rule-factories/ng-add/index.js +4 -218
  51. package/src/rule-factories/ng-add/index.js.map +1 -1
  52. package/src/rule-factories/ng-add/ng-add.helpers.d.ts +22 -0
  53. package/src/rule-factories/ng-add/ng-add.helpers.d.ts.map +1 -0
  54. package/src/rule-factories/ng-add/ng-add.helpers.js +162 -0
  55. package/src/rule-factories/ng-add/ng-add.helpers.js.map +1 -0
  56. package/src/rule-factories/ng-add/schematics-register.d.ts +17 -0
  57. package/src/rule-factories/ng-add/schematics-register.d.ts.map +1 -0
  58. package/src/rule-factories/ng-add/schematics-register.js +64 -0
  59. package/src/rule-factories/ng-add/schematics-register.js.map +1 -0
  60. package/src/rule-factories/update-imports/index.d.ts +0 -1
  61. package/src/rule-factories/update-imports/index.d.ts.map +1 -1
  62. package/src/rule-factories/update-imports/index.js +0 -1
  63. package/src/rule-factories/update-imports/index.js.map +1 -1
  64. package/src/rule-factories/update-imports/list-of-vars.d.ts +4 -5
  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 +1 -1
  68. package/src/rule-factories/update-imports/update-imports-with-scope.js +3 -3
  69. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
  70. package/src/rule-factories/update-imports/update-ts-imports.d.ts +1 -1
  71. package/src/rule-factories/update-imports/update-ts-imports.d.ts.map +1 -1
  72. package/src/rule-factories/update-imports/update-ts-imports.js +7 -6
  73. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
  74. package/src/rules/install.d.ts +8 -4
  75. package/src/rules/install.d.ts.map +1 -1
  76. package/src/rules/install.js +10 -8
  77. package/src/rules/install.js.map +1 -1
  78. package/src/tasks/ng-add/index.d.ts +1 -0
  79. package/src/tasks/ng-add/index.d.ts.map +1 -1
  80. package/src/tasks/ng-add/index.js +1 -0
  81. package/src/tasks/ng-add/index.js.map +1 -1
  82. package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
  83. package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
  84. package/src/tasks/package-manager/add-dev-dependency.js +4 -3
  85. package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
  86. package/src/tasks/package-manager/interfaces.d.ts +1 -1
  87. package/src/tasks/package-manager/interfaces.d.ts.map +1 -1
  88. package/src/tasks/package-manager/npm-install.js +3 -3
  89. package/src/tasks/package-manager/npm-install.js.map +1 -1
  90. package/src/utility/collection.d.ts.map +1 -1
  91. package/src/utility/collection.js +1 -1
  92. package/src/utility/collection.js.map +1 -1
  93. package/src/utility/component.d.ts +1 -1
  94. package/src/utility/component.d.ts.map +1 -1
  95. package/src/utility/dependencies.d.ts.map +1 -1
  96. package/src/utility/dependencies.js +1 -1
  97. package/src/utility/dependencies.js.map +1 -1
  98. package/src/utility/environment.d.ts +1 -0
  99. package/src/utility/environment.d.ts.map +1 -1
  100. package/src/utility/file-info.d.ts +1 -2
  101. package/src/utility/file-info.d.ts.map +1 -1
  102. package/src/utility/file-info.js.map +1 -1
  103. package/src/utility/generation.d.ts +1 -1
  104. package/src/utility/generation.d.ts.map +1 -1
  105. package/src/utility/gitignore.d.ts +1 -1
  106. package/src/utility/gitignore.d.ts.map +1 -1
  107. package/src/utility/index.d.ts +1 -0
  108. package/src/utility/index.d.ts.map +1 -1
  109. package/src/utility/index.js +1 -0
  110. package/src/utility/index.js.map +1 -1
  111. package/src/utility/loaders.d.ts +6 -1
  112. package/src/utility/loaders.d.ts.map +1 -1
  113. package/src/utility/loaders.js +10 -2
  114. package/src/utility/loaders.js.map +1 -1
  115. package/src/utility/matching-peers.d.ts.map +1 -1
  116. package/src/utility/matching-peers.js +1 -1
  117. package/src/utility/matching-peers.js.map +1 -1
  118. package/src/utility/monorepo.d.ts +1 -1
  119. package/src/utility/monorepo.d.ts.map +1 -1
  120. package/src/utility/package-manager-runner.d.ts +1 -1
  121. package/src/utility/package-manager-runner.d.ts.map +1 -1
  122. package/src/utility/routes.d.ts +1 -1
  123. package/src/utility/routes.d.ts.map +1 -1
  124. package/src/utility/sub-entry.d.ts +1 -1
  125. package/src/utility/sub-entry.d.ts.map +1 -1
  126. package/src/utility/template-property.helper.js.map +1 -1
  127. package/src/utility/update-imports.d.ts.map +1 -1
  128. package/src/utility/update-imports.js +17 -7
  129. package/src/utility/update-imports.js.map +1 -1
  130. package/src/utility/update-pipes.d.ts +15 -0
  131. package/src/utility/update-pipes.d.ts.map +1 -0
  132. package/src/utility/update-pipes.js +82 -0
  133. package/src/utility/update-pipes.js.map +1 -0
  134. package/src/utility/wrapper.d.ts.map +1 -1
  135. package/src/utility/wrapper.js +49 -3
  136. package/src/utility/wrapper.js.map +1 -1
  137. package/src/cli/environment.js.map +0 -1
  138. package/src/index.d.ts +0 -7
  139. package/src/index.d.ts.map +0 -1
  140. package/src/index.js +0 -10
  141. package/src/index.js.map +0 -1
  142. package/src/rule-factories/interfaces.d.ts.map +0 -1
  143. package/src/rule-factories/interfaces.js.map +0 -1
  144. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts +0 -8
  145. package/src/rule-factories/update-imports/v7-to-v8-map-object.d.ts.map +0 -1
  146. package/src/rule-factories/update-imports/v7-to-v8-map-object.js +0 -2049
  147. package/src/rule-factories/update-imports/v7-to-v8-map-object.js.map +0 -1
  148. /package/{src/cli → cli}/environment.d.ts +0 -0
@@ -1,19 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSchematicWithMetricsIfInstalled = void 0;
4
+ const prompt_1 = require("@angular/cli/src/utilities/prompt");
5
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
6
+ const node_fs_1 = require("node:fs");
7
+ const path = require("node:path");
8
+ const rxjs_1 = require("rxjs");
9
+ const index_1 = require("../tasks/index");
4
10
  const noopSchematicWrapper = (fn) => fn;
5
11
  /**
6
12
  * Wrapper method of a schematic to retrieve some metrics around the schematic run
7
13
  * if @o3r/telemetry is installed
8
14
  * @param schematicFn
9
15
  */
10
- const createSchematicWithMetricsIfInstalled = (schematicFn) => (opts) => async () => {
16
+ const createSchematicWithMetricsIfInstalled = (schematicFn) => (opts) => async (tree, context) => {
11
17
  let wrapper = noopSchematicWrapper;
18
+ const packageJsonPath = 'package.json';
19
+ const packageJson = tree.exists(packageJsonPath) ? tree.readJson(packageJsonPath) : {};
12
20
  try {
13
21
  const { createSchematicWithMetrics } = await Promise.resolve().then(() => require('@o3r/telemetry'));
14
- wrapper = createSchematicWithMetrics;
22
+ if (packageJson.config?.o3rMetrics) {
23
+ wrapper = createSchematicWithMetrics;
24
+ }
25
+ }
26
+ catch (e) {
27
+ // Do not throw if `@o3r/telemetry is not installed
28
+ if (packageJson.config?.o3rMetrics) {
29
+ context.logger.warn('`config.o3rMetrics` is set to true in your package.json, please install the telemetry package with `ng add @o3r/telemetry` to enable the collection of metrics.');
30
+ }
31
+ else if (context.interactive && packageJson.config?.o3rMetrics !== false) {
32
+ context.logger.debug('`@o3r/telemetry` is not available.\nAsking to add the dependency\n' + e.toString());
33
+ const isReplyPositive = await (0, prompt_1.askConfirmation)(`
34
+ Would you like to share anonymous data about the usage of Otter builders and schematics with the Otter Team at Amadeus ?
35
+ It will help us to improve our tools.
36
+ For more details and instructions on how to change these settings, see https://github.com/AmadeusITGroup/otter/blob/main/docs/telemetry/README.md.
37
+ `, false);
38
+ if (isReplyPositive) {
39
+ const version = JSON.parse((0, node_fs_1.readFileSync)(path.join(__dirname, '..', '..', 'package.json'), 'utf-8')).version;
40
+ context.addTask(new index_1.NodePackageNgAddTask('@o3r/telemetry', {
41
+ dependencyType: dependencies_1.NodeDependencyType.Dev,
42
+ version
43
+ }));
44
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
45
+ try {
46
+ const { createSchematicWithMetrics } = await Promise.resolve().then(() => require('@o3r/telemetry'));
47
+ wrapper = createSchematicWithMetrics;
48
+ }
49
+ catch {
50
+ // If pnp context package installed in the same process will not be available
51
+ }
52
+ }
53
+ else {
54
+ context.logger.info('You can activate it at any time by running `ng add @o3r/telemetry`.');
55
+ packageJson.config ||= {};
56
+ packageJson.config.o3rMetrics = false;
57
+ if (tree.exists(packageJsonPath)) {
58
+ tree.overwrite(packageJsonPath, JSON.stringify(packageJson, null, 2));
59
+ }
60
+ }
61
+ }
15
62
  }
16
- catch { }
17
63
  return wrapper(schematicFn)(opts);
18
64
  };
19
65
  exports.createSchematicWithMetricsIfInstalled = createSchematicWithMetricsIfInstalled;
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/utility/wrapper.ts"],"names":[],"mappings":";;;AAEA,MAAM,oBAAoB,GAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AAE1D;;;;GAIG;AACI,MAAM,qCAAqC,GAAqB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IAC3G,IAAI,OAAO,GAAqB,oBAAoB,CAAC;IACrD,IAAI;QACF,MAAM,EAAE,0BAA0B,EAAE,GAAG,2CAAa,gBAAgB,EAAC,CAAC;QACtE,OAAO,GAAG,0BAA0B,CAAC;KACtC;IAAC,MAA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4CAA+D;AAE/D,OAAO,CAAC,IAAI,CAAC,4BAA4B,IAAA,mCAA2B,GAAE,EAAE,CAAC,CAAC"}
package/src/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './interfaces/index';
2
- export * from './rule-factories/index';
3
- export * from './rules/index';
4
- export * from './tasks/index';
5
- export * from './utility/index';
6
- export * from './modules/index';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
package/src/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./interfaces/index"), exports);
5
- tslib_1.__exportStar(require("./rule-factories/index"), exports);
6
- tslib_1.__exportStar(require("./rules/index"), exports);
7
- tslib_1.__exportStar(require("./tasks/index"), exports);
8
- tslib_1.__exportStar(require("./utility/index"), exports);
9
- tslib_1.__exportStar(require("./modules/index"), exports);
10
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,iEAAuC;AACvC,wDAA8B;AAC9B,wDAA8B;AAC9B,0DAAgC;AAChC,0DAAgC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/rule-factories/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/rule-factories/interfaces.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import type { ImportsMapping } from '../../utility';
2
- /** Packages that were renamed */
3
- export declare const renamedPackagesV7toV8: {
4
- [key: string]: string;
5
- };
6
- /** Map containing the import changes in otter packages for the exported elements */
7
- export declare const mapImportV7toV8: ImportsMapping;
8
- //# sourceMappingURL=v7-to-v8-map-object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"v7-to-v8-map-object.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/update-imports/v7-to-v8-map-object.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,iCAAiC;AACjC,eAAO,MAAM,qBAAqB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAa1D,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,eAAe,EAAE,cA6+D7B,CAAC"}