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

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "10.0.0-prerelease.10",
3
+ "version": "10.0.0-prerelease.11",
4
4
  "description": "Schematics module of the Otter framework",
5
5
  "main": "./src/public_api.js",
6
6
  "typings": "./src/public_api.d.ts",
@@ -25,6 +25,7 @@
25
25
  "@angular-devkit/core": "~17.0.0",
26
26
  "@angular-devkit/schematics": "~17.0.0",
27
27
  "@angular/cli": "~17.0.0",
28
+ "@o3r/telemetry": "^10.0.0-prerelease.11",
28
29
  "@schematics/angular": "~17.0.0",
29
30
  "eslint": "^8.42.0",
30
31
  "rxjs": "^7.8.1",
@@ -37,6 +38,9 @@
37
38
  "@angular-devkit/core": {
38
39
  "optional": true
39
40
  },
41
+ "@o3r/telemetry": {
42
+ "optional": true
43
+ },
40
44
  "eslint": {
41
45
  "optional": true
42
46
  }
@@ -67,8 +71,9 @@
67
71
  "@nx/eslint-plugin": "~17.2.0",
68
72
  "@nx/jest": "~17.2.0",
69
73
  "@nx/js": "~17.2.0",
70
- "@o3r/build-helpers": "^10.0.0-prerelease.10",
71
- "@o3r/eslint-plugin": "^10.0.0-prerelease.10",
74
+ "@o3r/build-helpers": "^10.0.0-prerelease.11",
75
+ "@o3r/eslint-plugin": "^10.0.0-prerelease.11",
76
+ "@o3r/telemetry": "^10.0.0-prerelease.11",
72
77
  "@schematics/angular": "~17.0.3",
73
78
  "@types/jest": "~29.5.2",
74
79
  "@types/node": "^20.0.0",
@@ -2,5 +2,5 @@ import type { Rule } from '@angular-devkit/schematics';
2
2
  /**
3
3
  * Add Otter schematics to an Angular Project
4
4
  */
5
- export declare function ngAdd(): Rule;
5
+ export declare const ngAdd: (opts: unknown) => Rule;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAM/E;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CA0B5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAsC/E;;GAEG;AACH,eAAO,MAAM,KAAK,yBAAiD,CAAC"}
@@ -4,12 +4,13 @@ exports.ngAdd = void 0;
4
4
  const fs = require("node:fs");
5
5
  const path = require("node:path");
6
6
  const rxjs_1 = require("rxjs");
7
+ const schematics_1 = require("@o3r/schematics");
7
8
  /**
8
9
  * Add Otter schematics to an Angular Project
9
10
  */
10
- function ngAdd() {
11
+ function ngAddFn() {
11
12
  const schematicsDependencies = ['@angular-devkit/architect', '@angular-devkit/schematics', '@angular-devkit/core', '@schematics/angular', 'globby'];
12
- return async (tree, context) => {
13
+ return () => async (tree, context) => {
13
14
  // eslint-disable-next-line @typescript-eslint/naming-convention
14
15
  const { AddDevInstall } = await Promise.resolve().then(() => require('@o3r/schematics'));
15
16
  context.logger.info('Running ng add for schematics');
@@ -34,5 +35,8 @@ function ngAdd() {
34
35
  return () => tree;
35
36
  };
36
37
  }
37
- exports.ngAdd = ngAdd;
38
+ /**
39
+ * Add Otter schematics to an Angular Project
40
+ */
41
+ exports.ngAdd = (0, schematics_1.createSchematicWithMetricsIfInstalled)(ngAddFn);
38
42
  //# sourceMappingURL=index.js.map
@@ -20,4 +20,5 @@ export * from './sub-entry';
20
20
  export * from './template-property.helper';
21
21
  export * from './update-imports';
22
22
  export * from './builder';
23
+ export * from './wrapper';
23
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACt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sub-entry"), exports);
23
23
  tslib_1.__exportStar(require("./template-property.helper"), exports);
24
24
  tslib_1.__exportStar(require("./update-imports"), exports);
25
25
  tslib_1.__exportStar(require("./builder"), exports);
26
+ tslib_1.__exportStar(require("./wrapper"), exports);
26
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,oDAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,oDAA0B;AAC1B,oDAA0B"}
@@ -0,0 +1,8 @@
1
+ import type { SchematicWrapper } from '@o3r/telemetry';
2
+ /**
3
+ * Wrapper method of a schematic to retrieve some metrics around the schematic run
4
+ * if @o3r/telemetry is installed
5
+ * @param schematicFn
6
+ */
7
+ export declare const createSchematicWithMetricsIfInstalled: SchematicWrapper;
8
+ //# sourceMappingURL=wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/utility/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,EAAE,gBAOnD,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSchematicWithMetricsIfInstalled = void 0;
4
+ const noopSchematicWrapper = (fn) => fn;
5
+ /**
6
+ * Wrapper method of a schematic to retrieve some metrics around the schematic run
7
+ * if @o3r/telemetry is installed
8
+ * @param schematicFn
9
+ */
10
+ const createSchematicWithMetricsIfInstalled = (schematicFn) => (opts) => async () => {
11
+ let wrapper = noopSchematicWrapper;
12
+ try {
13
+ const { createSchematicWithMetrics } = await Promise.resolve().then(() => require('@o3r/telemetry'));
14
+ wrapper = createSchematicWithMetrics;
15
+ }
16
+ catch { }
17
+ return wrapper(schematicFn)(opts);
18
+ };
19
+ exports.createSchematicWithMetricsIfInstalled = createSchematicWithMetricsIfInstalled;
20
+ //# sourceMappingURL=wrapper.js.map
@@ -0,0 +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,MAAM,GAAE;IACV,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC,CAAC;AAPW,QAAA,qCAAqC,yCAOhD"}