@o3r/schematics 10.0.0-prerelease.98 → 10.0.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. package/README.md +2 -1
  2. package/cli/environment.js.map +1 -0
  3. package/package.json +7 -7
  4. package/schematics/ng-add/index.d.ts.map +1 -1
  5. package/schematics/ng-add/index.js +28 -27
  6. package/schematics/ng-add/index.js.map +1 -0
  7. package/schematics/ng-add/schema.js.map +1 -0
  8. package/schematics/package.json +3 -0
  9. package/src/modules/modules.display.rule.js.map +1 -1
  10. package/src/modules/modules.helpers.js.map +1 -1
  11. package/src/rule-factories/add-imports/index.js.map +1 -1
  12. package/src/rule-factories/check-packages-peers/index.js.map +1 -1
  13. package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
  14. package/src/rule-factories/eslint-fix/index.js.map +1 -1
  15. package/src/rule-factories/get-test-frameworks/index.js.map +1 -1
  16. package/src/rule-factories/ng-add/dependencies.d.ts +78 -0
  17. package/src/rule-factories/ng-add/dependencies.d.ts.map +1 -0
  18. package/src/rule-factories/ng-add/dependencies.js +156 -0
  19. package/src/rule-factories/ng-add/dependencies.js.map +1 -0
  20. package/src/rule-factories/ng-add/index.d.ts +3 -36
  21. package/src/rule-factories/ng-add/index.d.ts.map +1 -1
  22. package/src/rule-factories/ng-add/index.js +4 -218
  23. package/src/rule-factories/ng-add/index.js.map +1 -1
  24. package/src/rule-factories/ng-add/ng-add.helpers.d.ts +22 -0
  25. package/src/rule-factories/ng-add/ng-add.helpers.d.ts.map +1 -0
  26. package/src/rule-factories/ng-add/ng-add.helpers.js +162 -0
  27. package/src/rule-factories/ng-add/ng-add.helpers.js.map +1 -0
  28. package/src/rule-factories/ng-add/schematics-register.d.ts +17 -0
  29. package/src/rule-factories/ng-add/schematics-register.d.ts.map +1 -0
  30. package/src/rule-factories/ng-add/schematics-register.js +64 -0
  31. package/src/rule-factories/ng-add/schematics-register.js.map +1 -0
  32. package/src/rule-factories/remove-packages/index.js.map +1 -1
  33. package/src/rule-factories/update-imports/update-imports-with-scope.js.map +1 -1
  34. package/src/rule-factories/update-imports/update-ts-imports.js.map +1 -1
  35. package/src/rule-factories/vscode-extensions/index.js.map +1 -1
  36. package/src/rules/install.d.ts +8 -4
  37. package/src/rules/install.d.ts.map +1 -1
  38. package/src/rules/install.js +10 -8
  39. package/src/rules/install.js.map +1 -1
  40. package/src/tasks/ng-add/index.d.ts +1 -0
  41. package/src/tasks/ng-add/index.d.ts.map +1 -1
  42. package/src/tasks/ng-add/index.js +1 -0
  43. package/src/tasks/ng-add/index.js.map +1 -1
  44. package/src/tasks/package-manager/add-dev-dependency.d.ts +1 -0
  45. package/src/tasks/package-manager/add-dev-dependency.d.ts.map +1 -1
  46. package/src/tasks/package-manager/add-dev-dependency.js +1 -0
  47. package/src/tasks/package-manager/add-dev-dependency.js.map +1 -1
  48. package/src/utility/ast.js.map +1 -1
  49. package/src/utility/builder.js.map +1 -1
  50. package/src/utility/collection.d.ts.map +1 -1
  51. package/src/utility/collection.js +1 -1
  52. package/src/utility/collection.js.map +1 -1
  53. package/src/utility/component.js.map +1 -1
  54. package/src/utility/dependencies.js +1 -1
  55. package/src/utility/dependencies.js.map +1 -1
  56. package/src/utility/environment.js.map +1 -1
  57. package/src/utility/file-info.js.map +1 -1
  58. package/src/utility/generation.js.map +1 -1
  59. package/src/utility/gitignore.js.map +1 -1
  60. package/src/utility/loaders.d.ts +6 -1
  61. package/src/utility/loaders.d.ts.map +1 -1
  62. package/src/utility/loaders.js +10 -2
  63. package/src/utility/loaders.js.map +1 -1
  64. package/src/utility/matching-peers.d.ts.map +1 -1
  65. package/src/utility/matching-peers.js +1 -1
  66. package/src/utility/matching-peers.js.map +1 -1
  67. package/src/utility/modules.js.map +1 -1
  68. package/src/utility/monorepo.js.map +1 -1
  69. package/src/utility/package-manager-runner.js.map +1 -1
  70. package/src/utility/package-version.js.map +1 -1
  71. package/src/utility/routes.js.map +1 -1
  72. package/src/utility/sub-entry.js.map +1 -1
  73. package/src/utility/template-property.helper.js.map +1 -1
  74. package/src/utility/update-imports.js.map +1 -1
  75. package/src/utility/update-pipes.js.map +1 -1
  76. package/src/utility/wrapper.d.ts.map +1 -1
  77. package/src/utility/wrapper.js +48 -3
  78. package/src/utility/wrapper.js.map +1 -1
@@ -1,21 +1,66 @@
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 (_, context) => {
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
+ }
15
25
  }
16
26
  catch (e) {
17
27
  // Do not throw if `@o3r/telemetry is not installed
18
- context.logger.debug('`@o3r/telemetry` is not available\n' + e.toString());
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 ((process.env.NX_CLI_SET !== 'true' || process.env.NX_INTERACTIVE === 'true')
32
+ && context.interactive
33
+ && packageJson.config?.o3rMetrics !== false) {
34
+ context.logger.debug('`@o3r/telemetry` is not available.\nAsking to add the dependency\n' + e.toString());
35
+ const isReplyPositive = await (0, prompt_1.askConfirmation)(`
36
+ Would you like to share anonymous data about the usage of Otter builders and schematics with the Otter Team at Amadeus ?
37
+ It will help us to improve our tools.
38
+ For more details and instructions on how to change these settings, see https://github.com/AmadeusITGroup/otter/blob/main/docs/telemetry/README.md.
39
+ `, false);
40
+ if (isReplyPositive) {
41
+ const version = JSON.parse((0, node_fs_1.readFileSync)(path.join(__dirname, '..', '..', 'package.json'), 'utf-8')).version;
42
+ context.addTask(new index_1.NodePackageNgAddTask('@o3r/telemetry', {
43
+ dependencyType: dependencies_1.NodeDependencyType.Dev,
44
+ version
45
+ }));
46
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
47
+ try {
48
+ const { createSchematicWithMetrics } = await Promise.resolve().then(() => require('@o3r/telemetry'));
49
+ wrapper = createSchematicWithMetrics;
50
+ }
51
+ catch {
52
+ // If pnp context package installed in the same process will not be available
53
+ }
54
+ }
55
+ else {
56
+ context.logger.info('You can activate it at any time by running `ng add @o3r/telemetry`.');
57
+ packageJson.config ||= {};
58
+ packageJson.config.o3rMetrics = false;
59
+ if (tree.exists(packageJsonPath)) {
60
+ tree.overwrite(packageJsonPath, JSON.stringify(packageJson, null, 2));
61
+ }
62
+ }
63
+ }
19
64
  }
20
65
  return wrapper(schematicFn)(opts);
21
66
  };
@@ -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,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;IACrH,IAAI,OAAO,GAAqB,oBAAoB,CA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