@keycloakify/angular 0.0.8 → 0.0.10
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/README.md +15 -37
- package/bin/338.index.js +27 -11
- package/bin/758.index.js +27 -11
- package/bin/main.js +7 -0
- package/package.json +2 -2
- package/src/bin/update-kc-gen.ts +143 -124
package/README.md
CHANGED
|
@@ -25,51 +25,29 @@
|
|
|
25
25
|
-
|
|
26
26
|
<a href="https://docs.keycloakify.dev">Documentation</a>
|
|
27
27
|
-
|
|
28
|
-
<a href="https://
|
|
28
|
+
<a href="https://github.com/keycloakify/keycloakify-starter-angular-vite">Starter Project Vite (Recommended)</a>
|
|
29
29
|
-
|
|
30
|
-
<a href="https://github.com/keycloakify/keycloakify-starter-angular">Starter
|
|
31
|
-
-
|
|
32
|
-
<a href="https://github.com/keycloakify/keycloakify-starter-angular-vite">Starter project (Vite)</a>
|
|
30
|
+
<a href="https://github.com/keycloakify/keycloakify-starter-angular-webpack">Starter Project Webpack</a>
|
|
33
31
|
</p>
|
|
34
32
|
</p>
|
|
35
33
|
|
|
36
|
-
> **Note:** This library is under active development, we do not recommend implementing it just yet.
|
|
37
|
-
|
|
38
34
|
## Using the library
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
npm install keycloakify @keycloakify/angular
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
or using yarn:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
yarn add keycloakify @keycloakify/angular
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Developing the library
|
|
36
|
+
Don't it's not ready yet. Subscribe to alerts on the repo to get notified when it is.
|
|
51
37
|
|
|
52
|
-
|
|
38
|
+
## Contributing
|
|
53
39
|
|
|
54
|
-
|
|
40
|
+
> **Note:**: This is **not** for using the library, but for contributing to it.
|
|
55
41
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/keycloakify/keycloakify-angular
|
|
44
|
+
git clone https://github.com/keycloakify/keycloakify-angular-starter-vite
|
|
45
|
+
git clone https://github.com/keycloakify/keycloakify-angular-starter-webpack
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"preserveSymlinks": true
|
|
64
|
-
```
|
|
65
|
-
- **Secondly**, disable caching under `cli`:
|
|
66
|
-
```json
|
|
67
|
-
"cli": {
|
|
68
|
-
"cache": {
|
|
69
|
-
"enabled": false
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
2. `ng serve`
|
|
47
|
+
cd keycloakify-angular
|
|
48
|
+
yarn install
|
|
49
|
+
yarn link-in-starter # When prompted select the starter you want to link into
|
|
74
50
|
|
|
75
|
-
|
|
51
|
+
# At this point you can navigate to the starter you've picked.
|
|
52
|
+
# The changes in the library will be reflected live in the starter.
|
|
53
|
+
```
|
package/bin/338.index.js
CHANGED
|
@@ -251,20 +251,24 @@ function runFormat(params) {
|
|
|
251
251
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
252
252
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
|
|
253
253
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
254
|
-
/* harmony import */ var
|
|
254
|
+
/* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49);
|
|
255
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
|
|
256
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
|
|
257
|
+
|
|
255
258
|
|
|
256
259
|
|
|
257
260
|
|
|
258
261
|
function command(params) {
|
|
259
262
|
const { buildContext } = params;
|
|
260
263
|
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, 'kc.gen.ts');
|
|
261
|
-
const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)
|
|
262
|
-
? fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath)
|
|
263
|
-
: undefined;
|
|
264
264
|
const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
|
|
265
|
-
const newContent =
|
|
265
|
+
const newContent = [
|
|
266
|
+
``,
|
|
267
|
+
`/* eslint-disable */`,
|
|
268
|
+
``,
|
|
269
|
+
`// @ts-nocheck`,
|
|
266
270
|
``,
|
|
267
|
-
`//
|
|
271
|
+
`// noinspection JSUnusedGlobalSymbols`,
|
|
268
272
|
``,
|
|
269
273
|
`import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
|
|
270
274
|
``,
|
|
@@ -289,7 +293,6 @@ function command(params) {
|
|
|
289
293
|
`}`,
|
|
290
294
|
``,
|
|
291
295
|
`type ApplicationRefLike = {`,
|
|
292
|
-
` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
|
|
293
296
|
` components: ComponentRef<any>[];`,
|
|
294
297
|
`};`,
|
|
295
298
|
``,
|
|
@@ -364,12 +367,25 @@ function command(params) {
|
|
|
364
367
|
` }`,
|
|
365
368
|
`}`,
|
|
366
369
|
``
|
|
367
|
-
].join('\n')
|
|
368
|
-
|
|
370
|
+
].join('\n');
|
|
371
|
+
const hash = crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(newContent).digest('hex');
|
|
372
|
+
skip_if_no_changes: {
|
|
373
|
+
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)) {
|
|
374
|
+
break skip_if_no_changes;
|
|
375
|
+
}
|
|
376
|
+
const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath).toString('utf8');
|
|
377
|
+
if (!currentContent.includes(hash)) {
|
|
378
|
+
break skip_if_no_changes;
|
|
379
|
+
}
|
|
369
380
|
return;
|
|
370
381
|
}
|
|
371
|
-
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath,
|
|
372
|
-
|
|
382
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, Buffer.from([
|
|
383
|
+
`// This file is auto-generated by keycloakify. Do not edit it manually.`,
|
|
384
|
+
`// Hash: ${hash}`,
|
|
385
|
+
``,
|
|
386
|
+
newContent
|
|
387
|
+
].join('\n'), 'utf8'));
|
|
388
|
+
(0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_3__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
|
|
373
389
|
}
|
|
374
390
|
|
|
375
391
|
|
package/bin/758.index.js
CHANGED
|
@@ -79,20 +79,24 @@ function runFormat(params) {
|
|
|
79
79
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
80
80
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
|
|
81
81
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
82
|
-
/* harmony import */ var
|
|
82
|
+
/* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49);
|
|
83
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
|
|
84
|
+
/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);
|
|
85
|
+
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
function command(params) {
|
|
87
90
|
const { buildContext } = params;
|
|
88
91
|
const filePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(buildContext.themeSrcDirPath, 'kc.gen.ts');
|
|
89
|
-
const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)
|
|
90
|
-
? fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath)
|
|
91
|
-
: undefined;
|
|
92
92
|
const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
|
|
93
|
-
const newContent =
|
|
93
|
+
const newContent = [
|
|
94
|
+
``,
|
|
95
|
+
`/* eslint-disable */`,
|
|
96
|
+
``,
|
|
97
|
+
`// @ts-nocheck`,
|
|
94
98
|
``,
|
|
95
|
-
`//
|
|
99
|
+
`// noinspection JSUnusedGlobalSymbols`,
|
|
96
100
|
``,
|
|
97
101
|
`import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
|
|
98
102
|
``,
|
|
@@ -117,7 +121,6 @@ function command(params) {
|
|
|
117
121
|
`}`,
|
|
118
122
|
``,
|
|
119
123
|
`type ApplicationRefLike = {`,
|
|
120
|
-
` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
|
|
121
124
|
` components: ComponentRef<any>[];`,
|
|
122
125
|
`};`,
|
|
123
126
|
``,
|
|
@@ -192,12 +195,25 @@ function command(params) {
|
|
|
192
195
|
` }`,
|
|
193
196
|
`}`,
|
|
194
197
|
``
|
|
195
|
-
].join('\n')
|
|
196
|
-
|
|
198
|
+
].join('\n');
|
|
199
|
+
const hash = crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(newContent).digest('hex');
|
|
200
|
+
skip_if_no_changes: {
|
|
201
|
+
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(filePath)) {
|
|
202
|
+
break skip_if_no_changes;
|
|
203
|
+
}
|
|
204
|
+
const currentContent = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath).toString('utf8');
|
|
205
|
+
if (!currentContent.includes(hash)) {
|
|
206
|
+
break skip_if_no_changes;
|
|
207
|
+
}
|
|
197
208
|
return;
|
|
198
209
|
}
|
|
199
|
-
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath,
|
|
200
|
-
|
|
210
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, Buffer.from([
|
|
211
|
+
`// This file is auto-generated by keycloakify. Do not edit it manually.`,
|
|
212
|
+
`// Hash: ${hash}`,
|
|
213
|
+
``,
|
|
214
|
+
newContent
|
|
215
|
+
].join('\n'), 'utf8'));
|
|
216
|
+
(0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_3__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
|
|
201
217
|
}
|
|
202
218
|
|
|
203
219
|
|
package/bin/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keycloakify/angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"keycloakify": "^11.3.
|
|
5
|
+
"keycloakify": "^11.3.12",
|
|
6
6
|
"@angular/core": "^18.0.0",
|
|
7
7
|
"@angular/common": "^18.0.0",
|
|
8
8
|
"@angular/platform-browser": "^18.0.0"
|
package/src/bin/update-kc-gen.ts
CHANGED
|
@@ -2,145 +2,164 @@ import type { BuildContext } from './core';
|
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import { join as pathJoin } from 'path';
|
|
4
4
|
import { runFormat } from './tools/runFormat';
|
|
5
|
+
import * as crypto from 'crypto';
|
|
5
6
|
|
|
6
7
|
export function command(params: { buildContext: BuildContext }) {
|
|
7
8
|
const { buildContext } = params;
|
|
8
9
|
|
|
9
10
|
const filePath = pathJoin(buildContext.themeSrcDirPath, 'kc.gen.ts');
|
|
10
11
|
|
|
11
|
-
const currentContent = fs.existsSync(filePath)
|
|
12
|
-
? fs.readFileSync(filePath)
|
|
13
|
-
: undefined;
|
|
14
|
-
|
|
15
12
|
const implementedThemeTypes = (['login', 'account'] as const).filter(
|
|
16
13
|
themeType => buildContext.implementedThemeTypes[themeType].isImplemented
|
|
17
14
|
);
|
|
18
15
|
|
|
19
|
-
const newContent =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
2
|
|
42
|
-
)};`,
|
|
43
|
-
``,
|
|
44
|
-
`export type KcContext =`,
|
|
45
|
-
...implementedThemeTypes.map(
|
|
46
|
-
themeType => ` | import("./${themeType}/KcContext").KcContext`
|
|
47
|
-
),
|
|
48
|
-
` ;`,
|
|
49
|
-
``,
|
|
50
|
-
`declare global {`,
|
|
51
|
-
` interface Window {`,
|
|
52
|
-
` kcContext?: KcContext;`,
|
|
53
|
-
` }`,
|
|
54
|
-
`}`,
|
|
55
|
-
``,
|
|
56
|
-
`type ApplicationRefLike = {`,
|
|
57
|
-
` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
|
|
58
|
-
` components: ComponentRef<any>[];`,
|
|
59
|
-
`};`,
|
|
60
|
-
``,
|
|
61
|
-
`export async function bootstrapKcApplication(params: {`,
|
|
62
|
-
` kcContext: KcContext;`,
|
|
63
|
-
` bootstrapApplication: (params: {`,
|
|
64
|
-
` KcRootComponent: Type<unknown>;`,
|
|
65
|
-
` kcProvider: EnvironmentProviders;`,
|
|
66
|
-
` }) => Promise<ApplicationRefLike>;`,
|
|
67
|
-
`}) {`,
|
|
68
|
-
` const { kcContext, bootstrapApplication } = params;`,
|
|
69
|
-
``,
|
|
70
|
-
` switch (kcContext.themeType) {`,
|
|
71
|
-
...(['login', 'account'] as const)
|
|
72
|
-
.filter(
|
|
73
|
-
themeType =>
|
|
74
|
-
buildContext.implementedThemeTypes[themeType].isImplemented
|
|
16
|
+
const newContent = [
|
|
17
|
+
``,
|
|
18
|
+
`/* eslint-disable */`,
|
|
19
|
+
``,
|
|
20
|
+
`// @ts-nocheck`,
|
|
21
|
+
``,
|
|
22
|
+
`// noinspection JSUnusedGlobalSymbols`,
|
|
23
|
+
``,
|
|
24
|
+
`import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
|
|
25
|
+
``,
|
|
26
|
+
`export type ThemeName = ${buildContext.themeNames.map(themeName => `"${themeName}"`).join(' | ')};`,
|
|
27
|
+
``,
|
|
28
|
+
`export const themeNames: ThemeName[] = [${buildContext.themeNames.map(themeName => `"${themeName}"`).join(', ')}];`,
|
|
29
|
+
``,
|
|
30
|
+
`export type KcEnvName = ${buildContext.environmentVariables.length === 0 ? 'never' : buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(' | ')};`,
|
|
31
|
+
``,
|
|
32
|
+
`export const kcEnvNames: KcEnvName[] = [${buildContext.environmentVariables.map(({ name }) => `"${name}"`).join(', ')}];`,
|
|
33
|
+
``,
|
|
34
|
+
`export const kcEnvDefaults: Record<KcEnvName, string> = ${JSON.stringify(
|
|
35
|
+
Object.fromEntries(
|
|
36
|
+
buildContext.environmentVariables.map(
|
|
37
|
+
({ name, default: defaultValue }) => [name, defaultValue]
|
|
75
38
|
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
39
|
+
),
|
|
40
|
+
null,
|
|
41
|
+
2
|
|
42
|
+
)};`,
|
|
43
|
+
``,
|
|
44
|
+
`export type KcContext =`,
|
|
45
|
+
...implementedThemeTypes.map(
|
|
46
|
+
themeType => ` | import("./${themeType}/KcContext").KcContext`
|
|
47
|
+
),
|
|
48
|
+
` ;`,
|
|
49
|
+
``,
|
|
50
|
+
`declare global {`,
|
|
51
|
+
` interface Window {`,
|
|
52
|
+
` kcContext?: KcContext;`,
|
|
53
|
+
` }`,
|
|
54
|
+
`}`,
|
|
55
|
+
``,
|
|
56
|
+
`type ApplicationRefLike = {`,
|
|
57
|
+
` components: ComponentRef<any>[];`,
|
|
58
|
+
`};`,
|
|
59
|
+
``,
|
|
60
|
+
`export async function bootstrapKcApplication(params: {`,
|
|
61
|
+
` kcContext: KcContext;`,
|
|
62
|
+
` bootstrapApplication: (params: {`,
|
|
63
|
+
` KcRootComponent: Type<unknown>;`,
|
|
64
|
+
` kcProvider: EnvironmentProviders;`,
|
|
65
|
+
` }) => Promise<ApplicationRefLike>;`,
|
|
66
|
+
`}) {`,
|
|
67
|
+
` const { kcContext, bootstrapApplication } = params;`,
|
|
68
|
+
``,
|
|
69
|
+
` switch (kcContext.themeType) {`,
|
|
70
|
+
...(['login', 'account'] as const)
|
|
71
|
+
.filter(
|
|
72
|
+
themeType => buildContext.implementedThemeTypes[themeType].isImplemented
|
|
73
|
+
)
|
|
74
|
+
.map(themeType => [
|
|
75
|
+
` case "${themeType}":`,
|
|
76
|
+
` {`,
|
|
77
|
+
` const [`,
|
|
78
|
+
` { provideKeycloakifyAngular },`,
|
|
79
|
+
` { getI18n },`,
|
|
80
|
+
` {`,
|
|
81
|
+
` PageComponent,`,
|
|
82
|
+
` TemplateComponent,`,
|
|
83
|
+
` doUseDefaultCss,`,
|
|
84
|
+
` classes,`,
|
|
85
|
+
...(themeType === 'login'
|
|
86
|
+
? [
|
|
87
|
+
` UserProfileFormFieldsComponent,`,
|
|
88
|
+
` doMakeUserConfirmPassword,`
|
|
89
|
+
]
|
|
90
|
+
: []),
|
|
91
|
+
` },`,
|
|
92
|
+
` ] = await Promise.all([`,
|
|
93
|
+
` import('@keycloakify/angular/login/providers/keycloakify-angular'),`,
|
|
94
|
+
` import('./${themeType}/i18n'),`,
|
|
95
|
+
` import('./${themeType}/KcPage').then(({ getKcPage }) => getKcPage(kcContext.pageId)),`,
|
|
96
|
+
` ] as const);`,
|
|
97
|
+
``,
|
|
98
|
+
` const appRef = await bootstrapApplication({`,
|
|
99
|
+
` KcRootComponent: TemplateComponent,`,
|
|
100
|
+
` kcProvider: provideKeycloakifyAngular({`,
|
|
101
|
+
` kcContext,`,
|
|
102
|
+
` classes,`,
|
|
103
|
+
` getI18n,`,
|
|
104
|
+
` doUseDefaultCss,`,
|
|
105
|
+
...(themeType === 'login'
|
|
106
|
+
? [` doMakeUserConfirmPassword,`]
|
|
107
|
+
: []),
|
|
108
|
+
` })`,
|
|
109
|
+
` });`,
|
|
110
|
+
``,
|
|
111
|
+
` appRef.components.forEach(componentRef => {`,
|
|
112
|
+
` if ("page" in componentRef.instance) {`,
|
|
113
|
+
` componentRef.setInput("page", PageComponent);`,
|
|
114
|
+
` }`,
|
|
115
|
+
...(themeType === 'login'
|
|
116
|
+
? [
|
|
117
|
+
` if ("userProfileFormFields" in componentRef.instance) {`,
|
|
118
|
+
` componentRef.setInput(`,
|
|
119
|
+
` "userProfileFormFields",`,
|
|
120
|
+
` UserProfileFormFieldsComponent`,
|
|
121
|
+
` );`,
|
|
122
|
+
` }`
|
|
123
|
+
]
|
|
124
|
+
: []),
|
|
125
|
+
` });`,
|
|
126
|
+
` }`,
|
|
127
|
+
` break;`
|
|
128
|
+
])
|
|
129
|
+
.flat(),
|
|
130
|
+
` }`,
|
|
131
|
+
`}`,
|
|
132
|
+
``
|
|
133
|
+
].join('\n');
|
|
134
|
+
|
|
135
|
+
const hash = crypto.createHash('sha256').update(newContent).digest('hex');
|
|
136
|
+
|
|
137
|
+
skip_if_no_changes: {
|
|
138
|
+
if (!fs.existsSync(filePath)) {
|
|
139
|
+
break skip_if_no_changes;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const currentContent = fs.readFileSync(filePath).toString('utf8');
|
|
143
|
+
|
|
144
|
+
if (!currentContent.includes(hash)) {
|
|
145
|
+
break skip_if_no_changes;
|
|
146
|
+
}
|
|
138
147
|
|
|
139
|
-
if (currentContent !== undefined && currentContent.equals(newContent)) {
|
|
140
148
|
return;
|
|
141
149
|
}
|
|
142
150
|
|
|
143
|
-
fs.writeFileSync(
|
|
151
|
+
fs.writeFileSync(
|
|
152
|
+
filePath,
|
|
153
|
+
Buffer.from(
|
|
154
|
+
[
|
|
155
|
+
`// This file is auto-generated by keycloakify. Do not edit it manually.`,
|
|
156
|
+
`// Hash: ${hash}`,
|
|
157
|
+
``,
|
|
158
|
+
newContent
|
|
159
|
+
].join('\n'),
|
|
160
|
+
'utf8'
|
|
161
|
+
)
|
|
162
|
+
);
|
|
144
163
|
|
|
145
164
|
runFormat({ packageJsonFilePath: buildContext.packageJsonFilePath });
|
|
146
165
|
}
|