@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.
- package/CHANGELOG.md +30 -0
- package/README.md +5 -3
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +74 -5
- package/compodoc/dependencies.html +92 -19
- package/compodoc/index.html +50 -8
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +26 -13
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +110 -0
- package/compodoc/miscellaneous/functions.html +129 -6
- package/compodoc/miscellaneous/variables.html +51 -4
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +55 -4
- package/compodoc/pipes/DeleteIdentifierPipe.html +89 -12
- package/compodoc/pipes/EscapeQuotationMarkPipe.html +89 -11
- package/compodoc/pipes/GetFromObjectPipe.html +86 -10
- package/compodoc/pipes/JoinPipe.html +86 -10
- package/compodoc/pipes/LimitPipe.html +88 -11
- package/compodoc/pipes/ReplacePipe.html +87 -10
- package/compodoc/pipes/RxapCurrencyPipe.html +87 -10
- package/compodoc/pipes/SlicePipe.html +88 -11
- package/compodoc/pipes/ToDisplayPipe.html +87 -10
- package/compodoc/pipes/TruncatePipe.html +86 -10
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/compodoc/todo.html +45 -136
- package/docs/documentation.json +224 -124
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/DeleteIdentifierPipe.html +87 -3
- package/docs/html/classes/EscapeQuotationMarkPipe.html +84 -3
- package/docs/html/classes/GetFromObjectPipe.html +84 -3
- package/docs/html/classes/JoinPipe.html +84 -3
- package/docs/html/classes/LimitPipe.html +88 -3
- package/docs/html/classes/ReplacePipe.html +85 -3
- package/docs/html/classes/RxapCurrencyPipe.html +97 -8
- package/docs/html/classes/SlicePipe.html +89 -3
- package/docs/html/classes/ToDisplayPipe.html +84 -3
- package/docs/html/classes/TruncatePipe.html +85 -3
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +44 -7
- package/docs/html/modules.html +36 -1
- package/docs/markdown/README.md +6 -4
- package/docs/markdown/classes/DeleteIdentifierPipe.md +12 -10
- package/docs/markdown/classes/EscapeQuotationMarkPipe.md +8 -8
- package/docs/markdown/classes/GetFromObjectPipe.md +6 -6
- package/docs/markdown/classes/JoinPipe.md +7 -7
- package/docs/markdown/classes/LimitPipe.md +9 -7
- package/docs/markdown/classes/ReplacePipe.md +6 -6
- package/docs/markdown/classes/RxapCurrencyPipe.md +10 -10
- package/docs/markdown/classes/SlicePipe.md +10 -8
- package/docs/markdown/classes/ToDisplayPipe.md +8 -8
- package/docs/markdown/classes/TruncatePipe.md +8 -8
- package/docs/markdown/globals.md +2 -2
- package/docs/wiki/Class.DeleteIdentifierPipe.md +11 -9
- package/docs/wiki/Class.EscapeQuotationMarkPipe.md +7 -7
- package/docs/wiki/Class.GetFromObjectPipe.md +5 -5
- package/docs/wiki/Class.JoinPipe.md +6 -6
- package/docs/wiki/Class.LimitPipe.md +8 -6
- package/docs/wiki/Class.ReplacePipe.md +5 -5
- package/docs/wiki/Class.RxapCurrencyPipe.md +9 -9
- package/docs/wiki/Class.SlicePipe.md +9 -7
- package/docs/wiki/Class.ToDisplayPipe.md +7 -7
- package/docs/wiki/Class.TruncatePipe.md +7 -7
- package/docs/wiki/Home.md +5 -3
- package/docs/wiki/globals.md +1 -1
- package/generators.json +16 -0
- package/package.json +10 -12
- package/src/generators/init/generator.js +120 -0
- package/src/generators/init/index.js +6 -0
- package/src/generators/init/schema.json +8 -0
- package/src/generators/package.json +3 -0
- package/compodoc/js/libs/vis.min.js +0 -47
- package/compodoc/js/menu-wc_es5.js +0 -40
- package/compodoc/modules/CurrencyPipeModule/dependencies.svg +0 -66
- package/compodoc/modules/CurrencyPipeModule.html +0 -390
- 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/
|
|
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
|
-
###
|
|
13
|
+
### Constructor
|
|
14
14
|
|
|
15
|
-
> **new RxapCurrencyPipe**():
|
|
15
|
+
> **new RxapCurrencyPipe**(): `RxapCurrencyPipe`
|
|
16
16
|
|
|
17
17
|
#### Returns
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`RxapCurrencyPipe`
|
|
20
20
|
|
|
21
21
|
## Methods
|
|
22
22
|
|
|
23
23
|
### transform()
|
|
24
24
|
|
|
25
|
-
> **transform**(`value`, `currencyCode
|
|
25
|
+
> **transform**(`value`, `currencyCode?`, `display?`, `digitsInfo?`, `locale?`): `string` \| `null`
|
|
26
26
|
|
|
27
|
-
Defined in: [currency.pipe.ts:45](https://gitlab.com/rxap/packages/-/blob/
|
|
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
|
-
`
|
|
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/
|
|
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
|
-
###
|
|
13
|
+
### Constructor
|
|
14
14
|
|
|
15
|
-
> **new SlicePipe**():
|
|
15
|
+
> **new SlicePipe**(): `SlicePipe`
|
|
16
16
|
|
|
17
17
|
#### Returns
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`SlicePipe`
|
|
20
20
|
|
|
21
21
|
## Methods
|
|
22
22
|
|
|
23
23
|
### transform()
|
|
24
24
|
|
|
25
|
-
> **transform**\<`T`\>(`value`, `start`, `end
|
|
25
|
+
> **transform**\<`T`\>(`value`, `start`, `end?`): `T`[]
|
|
26
26
|
|
|
27
|
-
Defined in: [slice.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/
|
|
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
|
-
|
|
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/
|
|
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
|
-
###
|
|
13
|
+
### Constructor
|
|
14
14
|
|
|
15
|
-
> **new ToDisplayPipe**():
|
|
15
|
+
> **new ToDisplayPipe**(): `ToDisplayPipe`
|
|
16
16
|
|
|
17
17
|
#### Returns
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`ToDisplayPipe`
|
|
20
20
|
|
|
21
21
|
## Methods
|
|
22
22
|
|
|
23
23
|
### transform()
|
|
24
24
|
|
|
25
|
-
> **transform**(`value`, `toDisplay
|
|
25
|
+
> **transform**(`value`, `toDisplay?`): `string`
|
|
26
26
|
|
|
27
|
-
Defined in: [to-display.pipe.ts:16](https://gitlab.com/rxap/packages/-/blob/
|
|
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/
|
|
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
|
-
###
|
|
13
|
+
### Constructor
|
|
14
14
|
|
|
15
|
-
> **new TruncatePipe**():
|
|
15
|
+
> **new TruncatePipe**(): `TruncatePipe`
|
|
16
16
|
|
|
17
17
|
#### Returns
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`TruncatePipe`
|
|
20
20
|
|
|
21
21
|
## Methods
|
|
22
22
|
|
|
23
23
|
### transform()
|
|
24
24
|
|
|
25
|
-
> **transform**(`value
|
|
25
|
+
> **transform**(`value?`, `length?`, `ellipsis?`): `string`
|
|
26
26
|
|
|
27
|
-
Defined in: [truncate.pipe.ts:12](https://gitlab.com/rxap/packages/-/blob/
|
|
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
|
-
`
|
|
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
|
-
|
|
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
|
-
|
|
24
|
+
npm install @angular/common @angular/core @angular/platform-browser @rxap/utilities
|
|
23
25
|
```
|
|
24
26
|
**Execute the init generator:**
|
|
25
27
|
```bash
|
|
26
|
-
|
|
28
|
+
nx g @rxap/pipes:init
|
|
27
29
|
```
|
|
28
30
|
# Generators
|
|
29
31
|
|
package/docs/wiki/globals.md
CHANGED
package/generators.json
ADDED
|
@@ -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.
|
|
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.
|
|
8
|
+
"tslib": "2.9.1"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "^22.
|
|
12
|
-
"@angular/core": "^22.
|
|
13
|
-
"@angular/platform-browser": "^22.
|
|
14
|
-
"@rxap/utilities": "^16.5.
|
|
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.
|
|
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;
|