@rxap/pipes 22.0.0-dev.0 → 22.0.0-dev.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 (107) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +5 -3
  3. package/compodoc/architecture.html +222 -0
  4. package/compodoc/changelog.html +74 -5
  5. package/compodoc/dependencies.html +92 -19
  6. package/compodoc/index.html +50 -8
  7. package/compodoc/js/architecture-graph.js +288 -0
  8. package/compodoc/js/libs/bootstrap-native.js +4 -2
  9. package/compodoc/js/libs/jszip.min.js +13 -0
  10. package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
  11. package/compodoc/js/libs/tablesort.min.js +3 -3
  12. package/compodoc/js/libs/tablesort.number.min.js +3 -3
  13. package/compodoc/js/libs/vis-network.min.js +78 -0
  14. package/compodoc/js/menu-wc.js +26 -13
  15. package/compodoc/js/menu.js +10 -11
  16. package/compodoc/js/routes/routes_index.js +1 -0
  17. package/compodoc/js/routes.js +142 -34
  18. package/compodoc/js/search/search-lunr.js +6 -8
  19. package/compodoc/js/search/search.js +118 -66
  20. package/compodoc/js/search/search_index.js +2 -2
  21. package/compodoc/js/tabs.js +98 -15
  22. package/compodoc/js/tree.js +44 -7
  23. package/compodoc/license.html +48 -6
  24. package/compodoc/llms.txt +110 -0
  25. package/compodoc/miscellaneous/functions.html +129 -6
  26. package/compodoc/miscellaneous/variables.html +51 -4
  27. package/compodoc/modules.html +44 -3
  28. package/compodoc/overview.html +55 -4
  29. package/compodoc/pipes/DeleteIdentifierPipe.html +89 -12
  30. package/compodoc/pipes/EscapeQuotationMarkPipe.html +89 -11
  31. package/compodoc/pipes/GetFromObjectPipe.html +86 -10
  32. package/compodoc/pipes/JoinPipe.html +86 -10
  33. package/compodoc/pipes/LimitPipe.html +88 -11
  34. package/compodoc/pipes/ReplacePipe.html +87 -10
  35. package/compodoc/pipes/RxapCurrencyPipe.html +87 -10
  36. package/compodoc/pipes/SlicePipe.html +88 -11
  37. package/compodoc/pipes/ToDisplayPipe.html +87 -10
  38. package/compodoc/pipes/TruncatePipe.html +86 -10
  39. package/compodoc/properties.html +45 -4
  40. package/compodoc/routes.html +227 -0
  41. package/compodoc/styles/compodoc.css +365 -44
  42. package/compodoc/styles/dark.css +16 -0
  43. package/compodoc/template-playground/default-templates.json +192 -0
  44. package/compodoc/template-playground/hbs-render.service.ts +217 -0
  45. package/compodoc/template-playground/main.ts +9 -0
  46. package/compodoc/template-playground/template-editor.service.ts +173 -0
  47. package/compodoc/template-playground/template-playground.component.ts +614 -0
  48. package/compodoc/template-playground/template-playground.module.ts +29 -0
  49. package/compodoc/template-playground/zip-export.service.ts +86 -0
  50. package/compodoc/template-playground-app/app.js +1389 -0
  51. package/compodoc/template-playground-app/index.html +462 -0
  52. package/compodoc/todo.html +45 -136
  53. package/docs/documentation.json +224 -124
  54. package/docs/html/assets/highlight.css +1 -1
  55. package/docs/html/assets/icons.js +1 -1
  56. package/docs/html/assets/icons.svg +1 -1
  57. package/docs/html/assets/main.js +5 -5
  58. package/docs/html/assets/search.js +1 -1
  59. package/docs/html/assets/style.css +265 -228
  60. package/docs/html/classes/DeleteIdentifierPipe.html +87 -3
  61. package/docs/html/classes/EscapeQuotationMarkPipe.html +84 -3
  62. package/docs/html/classes/GetFromObjectPipe.html +84 -3
  63. package/docs/html/classes/JoinPipe.html +84 -3
  64. package/docs/html/classes/LimitPipe.html +88 -3
  65. package/docs/html/classes/ReplacePipe.html +85 -3
  66. package/docs/html/classes/RxapCurrencyPipe.html +97 -8
  67. package/docs/html/classes/SlicePipe.html +89 -3
  68. package/docs/html/classes/ToDisplayPipe.html +84 -3
  69. package/docs/html/classes/TruncatePipe.html +85 -3
  70. package/docs/html/hierarchy.html +29 -0
  71. package/docs/html/index.html +44 -7
  72. package/docs/html/modules.html +36 -1
  73. package/docs/markdown/README.md +6 -4
  74. package/docs/markdown/classes/DeleteIdentifierPipe.md +12 -10
  75. package/docs/markdown/classes/EscapeQuotationMarkPipe.md +8 -8
  76. package/docs/markdown/classes/GetFromObjectPipe.md +6 -6
  77. package/docs/markdown/classes/JoinPipe.md +7 -7
  78. package/docs/markdown/classes/LimitPipe.md +9 -7
  79. package/docs/markdown/classes/ReplacePipe.md +6 -6
  80. package/docs/markdown/classes/RxapCurrencyPipe.md +10 -10
  81. package/docs/markdown/classes/SlicePipe.md +10 -8
  82. package/docs/markdown/classes/ToDisplayPipe.md +8 -8
  83. package/docs/markdown/classes/TruncatePipe.md +8 -8
  84. package/docs/markdown/globals.md +2 -2
  85. package/docs/wiki/Class.DeleteIdentifierPipe.md +11 -9
  86. package/docs/wiki/Class.EscapeQuotationMarkPipe.md +7 -7
  87. package/docs/wiki/Class.GetFromObjectPipe.md +5 -5
  88. package/docs/wiki/Class.JoinPipe.md +6 -6
  89. package/docs/wiki/Class.LimitPipe.md +8 -6
  90. package/docs/wiki/Class.ReplacePipe.md +5 -5
  91. package/docs/wiki/Class.RxapCurrencyPipe.md +9 -9
  92. package/docs/wiki/Class.SlicePipe.md +9 -7
  93. package/docs/wiki/Class.ToDisplayPipe.md +7 -7
  94. package/docs/wiki/Class.TruncatePipe.md +7 -7
  95. package/docs/wiki/Home.md +5 -3
  96. package/docs/wiki/globals.md +1 -1
  97. package/generators.json +16 -0
  98. package/package.json +10 -12
  99. package/src/generators/init/generator.js +120 -0
  100. package/src/generators/init/index.js +6 -0
  101. package/src/generators/init/schema.json +8 -0
  102. package/src/generators/package.json +3 -0
  103. package/compodoc/js/libs/vis.min.js +0 -47
  104. package/compodoc/js/menu-wc_es5.js +0 -40
  105. package/compodoc/modules/CurrencyPipeModule/dependencies.svg +0 -66
  106. package/compodoc/modules/CurrencyPipeModule.html +0 -390
  107. package/theme.css +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Class: RxapCurrencyPipe
4
4
 
5
- Defined in: [currency.pipe.ts:8](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/currency.pipe.ts#L8)
5
+ Defined in: [currency.pipe.ts:8](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/currency.pipe.ts#L8)
6
6
 
7
7
  ## Implements
8
8
 
@@ -10,21 +10,21 @@ Defined in: [currency.pipe.ts:8](https://gitlab.com/rxap/packages/-/blob/c814569
10
10
 
11
11
  ## Constructors
12
12
 
13
- ### new RxapCurrencyPipe()
13
+ ### Constructor
14
14
 
15
- > **new RxapCurrencyPipe**(): [`RxapCurrencyPipe`](../wiki/Class.RxapCurrencyPipe)
15
+ > **new RxapCurrencyPipe**(): `RxapCurrencyPipe`
16
16
 
17
17
  #### Returns
18
18
 
19
- [`RxapCurrencyPipe`](../wiki/Class.RxapCurrencyPipe)
19
+ `RxapCurrencyPipe`
20
20
 
21
21
  ## Methods
22
22
 
23
23
  ### transform()
24
24
 
25
- > **transform**(`value`, `currencyCode`?, `display`?, `digitsInfo`?, `locale`?): `null` \| `string`
25
+ > **transform**(`value`, `currencyCode?`, `display?`, `digitsInfo?`, `locale?`): `string` \| `null`
26
26
 
27
- Defined in: [currency.pipe.ts:45](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/currency.pipe.ts#L45)
27
+ Defined in: [currency.pipe.ts:45](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/currency.pipe.ts#L45)
28
28
 
29
29
  #### Parameters
30
30
 
@@ -44,6 +44,8 @@ configured using the `DEFAULT_CURRENCY_CODE` injection token.
44
44
 
45
45
  ##### display?
46
46
 
47
+ `string` \| `boolean`
48
+
47
49
  The format for the currency indicator. One of the following:
48
50
  - `code`: Show the code (such as `USD`).
49
51
  - `symbol`(default): Show the symbol (such as `$`).
@@ -55,8 +57,6 @@ locale has no narrow symbol, uses the standard symbol for the locale.
55
57
  For example, an empty string will suppress the currency & symbol.
56
58
  - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
57
59
 
58
- `string` | `boolean`
59
-
60
60
  ##### digitsInfo?
61
61
 
62
62
  `string`
@@ -84,7 +84,7 @@ See [Setting your app locale](../wiki/guide/i18n#setting-up-the-locale-of-your-a
84
84
 
85
85
  #### Returns
86
86
 
87
- `null` \| `string`
87
+ `string` \| `null`
88
88
 
89
89
  #### Implementation of
90
90
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Class: SlicePipe
4
4
 
5
- Defined in: [slice.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/slice.pipe.ts#L10)
5
+ Defined in: [slice.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/slice.pipe.ts#L10)
6
6
 
7
7
  ## Implements
8
8
 
@@ -10,25 +10,27 @@ Defined in: [slice.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/c8145693a
10
10
 
11
11
  ## Constructors
12
12
 
13
- ### new SlicePipe()
13
+ ### Constructor
14
14
 
15
- > **new SlicePipe**(): [`SlicePipe`](../wiki/Class.SlicePipe)
15
+ > **new SlicePipe**(): `SlicePipe`
16
16
 
17
17
  #### Returns
18
18
 
19
- [`SlicePipe`](../wiki/Class.SlicePipe)
19
+ `SlicePipe`
20
20
 
21
21
  ## Methods
22
22
 
23
23
  ### transform()
24
24
 
25
- > **transform**\<`T`\>(`value`, `start`, `end`?): `T`[]
25
+ > **transform**\<`T`\>(`value`, `start`, `end?`): `T`[]
26
26
 
27
- Defined in: [slice.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/slice.pipe.ts#L12)
27
+ Defined in: [slice.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/slice.pipe.ts#L12)
28
28
 
29
29
  #### Type Parameters
30
30
 
31
- • **T**
31
+ ##### T
32
+
33
+ `T`
32
34
 
33
35
  #### Parameters
34
36
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Class: ToDisplayPipe
4
4
 
5
- Defined in: [to-display.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/to-display.pipe.ts#L12)
5
+ Defined in: [to-display.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/to-display.pipe.ts#L12)
6
6
 
7
7
  ## Implements
8
8
 
@@ -10,21 +10,21 @@ Defined in: [to-display.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/c814
10
10
 
11
11
  ## Constructors
12
12
 
13
- ### new ToDisplayPipe()
13
+ ### Constructor
14
14
 
15
- > **new ToDisplayPipe**(): [`ToDisplayPipe`](../wiki/Class.ToDisplayPipe)
15
+ > **new ToDisplayPipe**(): `ToDisplayPipe`
16
16
 
17
17
  #### Returns
18
18
 
19
- [`ToDisplayPipe`](../wiki/Class.ToDisplayPipe)
19
+ `ToDisplayPipe`
20
20
 
21
21
  ## Methods
22
22
 
23
23
  ### transform()
24
24
 
25
- > **transform**(`value`, `toDisplay`): `string`
25
+ > **transform**(`value`, `toDisplay?`): `string`
26
26
 
27
- Defined in: [to-display.pipe.ts:16](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/to-display.pipe.ts#L16)
27
+ Defined in: [to-display.pipe.ts:16](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/to-display.pipe.ts#L16)
28
28
 
29
29
  #### Parameters
30
30
 
@@ -32,7 +32,7 @@ Defined in: [to-display.pipe.ts:16](https://gitlab.com/rxap/packages/-/blob/c814
32
32
 
33
33
  `any`
34
34
 
35
- ##### toDisplay
35
+ ##### toDisplay?
36
36
 
37
37
  `ToDisplayFunction` = `...`
38
38
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Class: TruncatePipe
4
4
 
5
- Defined in: [truncate.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/truncate.pipe.ts#L10)
5
+ Defined in: [truncate.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/truncate.pipe.ts#L10)
6
6
 
7
7
  ## Implements
8
8
 
@@ -10,27 +10,27 @@ Defined in: [truncate.pipe.ts:10](https://gitlab.com/rxap/packages/-/blob/c81456
10
10
 
11
11
  ## Constructors
12
12
 
13
- ### new TruncatePipe()
13
+ ### Constructor
14
14
 
15
- > **new TruncatePipe**(): [`TruncatePipe`](../wiki/Class.TruncatePipe)
15
+ > **new TruncatePipe**(): `TruncatePipe`
16
16
 
17
17
  #### Returns
18
18
 
19
- [`TruncatePipe`](../wiki/Class.TruncatePipe)
19
+ `TruncatePipe`
20
20
 
21
21
  ## Methods
22
22
 
23
23
  ### transform()
24
24
 
25
- > **transform**(`value`?, `length`?, `ellipsis`?): `string`
25
+ > **transform**(`value?`, `length?`, `ellipsis?`): `string`
26
26
 
27
- Defined in: [truncate.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/c8145693a1e685c856c9997ae6c17bbf32838e79/packages/angular/pipes/src/lib/truncate.pipe.ts#L12)
27
+ Defined in: [truncate.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/pipes/src/lib/truncate.pipe.ts#L12)
28
28
 
29
29
  #### Parameters
30
30
 
31
31
  ##### value?
32
32
 
33
- `null` | `string`
33
+ `string` \| `null`
34
34
 
35
35
  ##### length?
36
36
 
package/docs/wiki/Home.md CHANGED
@@ -15,15 +15,17 @@ Provides a set of Angular pipes for common data transformations, including curre
15
15
 
16
16
  **Add the package to your workspace:**
17
17
  ```bash
18
- yarn add @rxap/pipes
18
+ npm install @rxap/pipes
19
19
  ```
20
+ With pnpm or yarn use `pnpm add` or `yarn add` instead of `npm install`.
21
+
20
22
  **Install peer dependencies:**
21
23
  ```bash
22
- yarn add @angular/common @angular/core @angular/platform-browser @rxap/utilities
24
+ npm install @angular/common @angular/core @angular/platform-browser @rxap/utilities
23
25
  ```
24
26
  **Execute the init generator:**
25
27
  ```bash
26
- yarn nx g @rxap/pipes:init
28
+ nx g @rxap/pipes:init
27
29
  ```
28
30
  # Generators
29
31
 
@@ -1,4 +1,4 @@
1
- # @rxap/pipes v22.0.0-dev.0
1
+ # @rxap/pipes v22.0.0-dev.2
2
2
 
3
3
  ## Classes
4
4
 
@@ -0,0 +1,16 @@
1
+ {
2
+ "generators": {
3
+ "init": {
4
+ "factory": "./src/generators/init/generator",
5
+ "schema": "./src/generators/init/schema.json",
6
+ "description": "Initialize the package in the workspace"
7
+ }
8
+ },
9
+ "schematics": {
10
+ "init": {
11
+ "factory": "./src/generators/init/index",
12
+ "schema": "./src/generators/init/schema.json",
13
+ "description": "Initialize the package in the workspace"
14
+ }
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
- "version": "22.0.0-dev.0",
2
+ "version": "22.0.0-dev.2",
3
3
  "name": "@rxap/pipes",
4
4
  "description": "Provides a set of Angular pipes for common data transformations, including currency formatting, string manipulation, and object property access. These pipes offer standalone functionality for easy integration into Angular templates. The package includes pipes for escaping quotation marks, joining arrays, limiting array length, replacing substrings, slicing arrays, truncating strings, and deleting identifier properties from objects.\n",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "dependencies": {
7
7
  "@nx/devkit": "24.0.6",
8
- "tslib": "2.6.2"
8
+ "tslib": "2.9.1"
9
9
  },
10
10
  "peerDependencies": {
11
- "@angular/common": "^22.3.0",
12
- "@angular/core": "^22.3.0",
13
- "@angular/platform-browser": "^22.3.0",
14
- "@rxap/utilities": "^16.5.2"
11
+ "@angular/common": "^22.0.0",
12
+ "@angular/core": "^22.0.0",
13
+ "@angular/platform-browser": "^22.0.0",
14
+ "@rxap/utilities": "^16.5.3-dev.1"
15
15
  },
16
16
  "author": {
17
17
  "name": "Merzough Münker",
@@ -52,13 +52,12 @@
52
52
  },
53
53
  {
54
54
  "package": "@rxap/utilities",
55
- "version": "16.5.2"
55
+ "version": "16.5.3-dev.1"
56
56
  }
57
57
  ]
58
58
  },
59
59
  "publishConfig": {
60
- "access": "public",
61
- "directory": "../../../dist/packages/angular/pipes"
60
+ "access": "public"
62
61
  },
63
62
  "repository": {
64
63
  "type": "git",
@@ -80,8 +79,7 @@
80
79
  "./santization": {
81
80
  "types": "./types/rxap-pipes-santization.d.ts",
82
81
  "default": "./fesm2022/rxap-pipes-santization.mjs"
83
- },
84
- "./theme": "./theme.css"
82
+ }
85
83
  },
86
84
  "type": "module"
87
- }
85
+ }
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initGenerator = initGenerator;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const fs_1 = require("fs");
6
+ const path_1 = require("path");
7
+ /**
8
+ * Resolves the directory of a package installed in the workspace. The lookup starts at the
9
+ * workspace root, not at this package: with an isolated node_modules layout (pnpm) or Yarn PnP
10
+ * the peer is not resolvable from here. The plain node_modules path is the fallback for packages
11
+ * whose `exports` map hides their package.json.
12
+ */
13
+ function resolvePackageDir(root, packageName) {
14
+ try {
15
+ return (0, path_1.dirname)(require.resolve(`${packageName}/package.json`, { paths: [root] }));
16
+ }
17
+ catch {
18
+ return (0, path_1.join)(root, 'node_modules', ...packageName.split('/'));
19
+ }
20
+ }
21
+ async function initGenerator(tree, options) {
22
+ // The package's own package.json lives on disk next to the compiled generator
23
+ // (inside node_modules when installed), which the virtual Tree does not track.
24
+ // Read it directly from the physical filesystem.
25
+ const packageJsonFilePath = (0, path_1.join)(__dirname, '..', '..', '..', 'package.json');
26
+ if (!(0, fs_1.existsSync)(packageJsonFilePath)) {
27
+ console.error('package.json not found in: ' + packageJsonFilePath);
28
+ return;
29
+ }
30
+ const { peerDependencies, name: packageName } = JSON.parse((0, fs_1.readFileSync)(packageJsonFilePath, 'utf-8'));
31
+ console.log(`Coerce peer dependencies for package: ${packageName}`);
32
+ if (!peerDependencies || !Object.keys(peerDependencies).length) {
33
+ console.log('No peer dependencies found');
34
+ return;
35
+ }
36
+ console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
37
+ const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8'));
38
+ let isDevDependency = !!rootPackageJson.devDependencies?.[packageName];
39
+ if (isDevDependency &&
40
+ [/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))) {
41
+ rootPackageJson.dependencies ??= {};
42
+ rootPackageJson.dependencies[packageName] =
43
+ rootPackageJson.devDependencies[packageName];
44
+ delete rootPackageJson.devDependencies[packageName];
45
+ isDevDependency = false;
46
+ tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
47
+ }
48
+ if (!isDevDependency &&
49
+ [
50
+ /^@rxap\/plugin/,
51
+ /^@rxap\/workspace/,
52
+ /@rxap\/schematic/,
53
+ ].some((rx) => rx.test(packageName))) {
54
+ rootPackageJson.devDependencies ??= {};
55
+ rootPackageJson.devDependencies[packageName] =
56
+ rootPackageJson.dependencies[packageName];
57
+ delete rootPackageJson.dependencies[packageName];
58
+ isDevDependency = true;
59
+ tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
60
+ }
61
+ const missingPeerDependencies = Object.entries(peerDependencies)
62
+ .filter(([dep]) => !rootPackageJson.dependencies?.[dep] &&
63
+ !rootPackageJson.devDependencies?.[dep])
64
+ .reduce((acc, [dep, version]) => ({ ...acc, [dep]: version }), {});
65
+ if (!Object.keys(missingPeerDependencies).length) {
66
+ console.log('No missing peer dependencies');
67
+ return;
68
+ }
69
+ if (isDevDependency) {
70
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingPeerDependencies);
71
+ }
72
+ else {
73
+ (0, devkit_1.addDependenciesToPackageJson)(tree, missingPeerDependencies, {});
74
+ }
75
+ await (0, devkit_1.formatFiles)(tree);
76
+ (0, devkit_1.installPackagesTask)(tree);
77
+ for (const peer of Object.keys(missingPeerDependencies)) {
78
+ console.log(`Peer dependency ${peer} added to package.json`);
79
+ // node_modules is physical and excluded from the virtual Tree, so read the
80
+ // peer files from disk.
81
+ const peerPackageDir = resolvePackageDir(tree.root, peer);
82
+ const peerPackageJsonFilePath = (0, path_1.join)(peerPackageDir, 'package.json');
83
+ if (!(0, fs_1.existsSync)(peerPackageJsonFilePath)) {
84
+ console.log(`Peer dependency ${peer} has no package.json`);
85
+ continue;
86
+ }
87
+ const { generators, schematics } = JSON.parse((0, fs_1.readFileSync)(peerPackageJsonFilePath, 'utf-8'));
88
+ if (!generators && !schematics) {
89
+ console.log(`Peer dependency ${peer} has no generators or schematics`);
90
+ continue;
91
+ }
92
+ const configFile = generators || schematics;
93
+ const configFilePath = (0, path_1.join)(peerPackageDir, configFile);
94
+ if (!(0, fs_1.existsSync)(configFilePath)) {
95
+ console.log(`Peer dependency ${peer} has no generators or schematics file`);
96
+ continue;
97
+ }
98
+ const config = JSON.parse((0, fs_1.readFileSync)(configFilePath, 'utf-8'));
99
+ if (!config.generators?.init) {
100
+ console.log(`Peer dependency ${peer} has no init generator`);
101
+ continue;
102
+ }
103
+ const initGeneratorFilePath = config.generators.init.factory;
104
+ const fullInitGeneratorFilePath = (0, path_1.join)(peerPackageDir, initGeneratorFilePath) + '.js';
105
+ if (!(0, fs_1.existsSync)(fullInitGeneratorFilePath)) {
106
+ console.log(`Peer dependency ${peer} has no init generator file: ` +
107
+ fullInitGeneratorFilePath);
108
+ continue;
109
+ }
110
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
111
+ const initGenerator = require((0, path_1.join)(peerPackageDir, initGeneratorFilePath))?.default;
112
+ if (typeof initGenerator !== 'function') {
113
+ console.log(`Peer dependency ${peer} has no init generator function`);
114
+ continue;
115
+ }
116
+ console.log(`Run init generator for peer dependency ${peer}`);
117
+ await initGenerator(tree, options);
118
+ }
119
+ }
120
+ exports.default = initGenerator;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const generator_1 = require("./generator");
5
+ const schematic = (0, devkit_1.convertNxGenerator)(generator_1.default);
6
+ exports.default = schematic;
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "Init",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {},
7
+ "required": []
8
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }