@keycloakify/angular 0.0.7 → 0.0.8

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/bin/338.index.js CHANGED
@@ -173,6 +173,72 @@ function getThisCodebaseRootDirPath() {
173
173
  }
174
174
 
175
175
 
176
+ /***/ }),
177
+
178
+ /***/ 49:
179
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
180
+
181
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
182
+ /* harmony export */ J: () => (/* binding */ runFormat)
183
+ /* harmony export */ });
184
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
185
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
186
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
187
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
188
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
189
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
190
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
191
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
192
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
193
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
194
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ function runFormat(params) {
204
+ const { packageJsonFilePath } = params;
205
+ const parsedPackageJson = (() => {
206
+ const zParsedPackageJson = (() => {
207
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
208
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
209
+ });
210
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
211
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
212
+ })();
213
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
214
+ zParsedPackageJson.parse(parsedPackageJson);
215
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
216
+ return parsedPackageJson;
217
+ })();
218
+ const { scripts } = parsedPackageJson;
219
+ if (scripts === undefined) {
220
+ return;
221
+ }
222
+ for (const scriptName of ['format', 'lint']) {
223
+ if (!(scriptName in scripts)) {
224
+ continue;
225
+ }
226
+ const command = `npm run ${scriptName}`;
227
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
228
+ try {
229
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
230
+ stdio: 'inherit',
231
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
232
+ });
233
+ }
234
+ catch (_a) {
235
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
236
+ }
237
+ return;
238
+ }
239
+ }
240
+
241
+
176
242
  /***/ }),
177
243
 
178
244
  /***/ 758:
@@ -185,6 +251,8 @@ function getThisCodebaseRootDirPath() {
185
251
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
186
252
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
187
253
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
254
+ /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49);
255
+
188
256
 
189
257
 
190
258
  function command(params) {
@@ -195,13 +263,8 @@ function command(params) {
195
263
  : undefined;
196
264
  const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
197
265
  const newContent = Buffer.from([
198
- `/* prettier-ignore-start */`,
199
- ``,
200
- `/* eslint-disable */`,
201
266
  ``,
202
- `// noinspection JSUnusedGlobalSymbols`,
203
- ``,
204
- `// This file is auto-generated by Keycloakify`,
267
+ `// This file is auto-generated by Keycloakify, do not modify it manually.`,
205
268
  ``,
206
269
  `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
207
270
  ``,
@@ -226,6 +289,7 @@ function command(params) {
226
289
  `}`,
227
290
  ``,
228
291
  `type ApplicationRefLike = {`,
292
+ ` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
229
293
  ` components: ComponentRef<any>[];`,
230
294
  `};`,
231
295
  ``,
@@ -299,14 +363,13 @@ function command(params) {
299
363
  .flat(),
300
364
  ` }`,
301
365
  `}`,
302
- ``,
303
- `/* prettier-ignore-end */`,
304
366
  ``
305
367
  ].join('\n'), 'utf8');
306
368
  if (currentContent !== undefined && currentContent.equals(newContent)) {
307
369
  return;
308
370
  }
309
371
  fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, newContent);
372
+ (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_2__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
310
373
  }
311
374
 
312
375
 
package/bin/758.index.js CHANGED
@@ -3,6 +3,72 @@ exports.id = 758;
3
3
  exports.ids = [758];
4
4
  exports.modules = {
5
5
 
6
+ /***/ 49:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ J: () => (/* binding */ runFormat)
11
+ /* harmony export */ });
12
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
13
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
14
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
15
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
16
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
17
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
18
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
19
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
20
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
21
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
22
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ function runFormat(params) {
32
+ const { packageJsonFilePath } = params;
33
+ const parsedPackageJson = (() => {
34
+ const zParsedPackageJson = (() => {
35
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
36
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
37
+ });
38
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
39
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
40
+ })();
41
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
42
+ zParsedPackageJson.parse(parsedPackageJson);
43
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
44
+ return parsedPackageJson;
45
+ })();
46
+ const { scripts } = parsedPackageJson;
47
+ if (scripts === undefined) {
48
+ return;
49
+ }
50
+ for (const scriptName of ['format', 'lint']) {
51
+ if (!(scriptName in scripts)) {
52
+ continue;
53
+ }
54
+ const command = `npm run ${scriptName}`;
55
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
56
+ try {
57
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
58
+ stdio: 'inherit',
59
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
60
+ });
61
+ }
62
+ catch (_a) {
63
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
64
+ }
65
+ return;
66
+ }
67
+ }
68
+
69
+
70
+ /***/ }),
71
+
6
72
  /***/ 758:
7
73
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
74
 
@@ -13,6 +79,8 @@ exports.modules = {
13
79
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
14
80
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
15
81
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
82
+ /* harmony import */ var _tools_runFormat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(49);
83
+
16
84
 
17
85
 
18
86
  function command(params) {
@@ -23,13 +91,8 @@ function command(params) {
23
91
  : undefined;
24
92
  const implementedThemeTypes = ['login', 'account'].filter(themeType => buildContext.implementedThemeTypes[themeType].isImplemented);
25
93
  const newContent = Buffer.from([
26
- `/* prettier-ignore-start */`,
27
94
  ``,
28
- `/* eslint-disable */`,
29
- ``,
30
- `// noinspection JSUnusedGlobalSymbols`,
31
- ``,
32
- `// This file is auto-generated by Keycloakify`,
95
+ `// This file is auto-generated by Keycloakify, do not modify it manually.`,
33
96
  ``,
34
97
  `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
35
98
  ``,
@@ -54,6 +117,7 @@ function command(params) {
54
117
  `}`,
55
118
  ``,
56
119
  `type ApplicationRefLike = {`,
120
+ ` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
57
121
  ` components: ComponentRef<any>[];`,
58
122
  `};`,
59
123
  ``,
@@ -127,14 +191,13 @@ function command(params) {
127
191
  .flat(),
128
192
  ` }`,
129
193
  `}`,
130
- ``,
131
- `/* prettier-ignore-end */`,
132
194
  ``
133
195
  ].join('\n'), 'utf8');
134
196
  if (currentContent !== undefined && currentContent.equals(newContent)) {
135
197
  return;
136
198
  }
137
199
  fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(filePath, newContent);
200
+ (0,_tools_runFormat__WEBPACK_IMPORTED_MODULE_2__/* .runFormat */ .J)({ packageJsonFilePath: buildContext.packageJsonFilePath });
138
201
  }
139
202
 
140
203
 
package/bin/925.index.js CHANGED
@@ -257,14 +257,8 @@ function replaceAll(string, searchValue, replaceValue) {
257
257
  return string.replace(regexFromString, replaceValue);
258
258
  }
259
259
 
260
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
261
- var id = __webpack_require__(94);
262
- // EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
263
- var lib = __webpack_require__(383);
264
- // EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
265
- var is = __webpack_require__(289);
266
- // EXTERNAL MODULE: external "child_process"
267
- var external_child_process_ = __webpack_require__(317);
260
+ // EXTERNAL MODULE: ./dist/bin/tools/runFormat.js
261
+ var runFormat = __webpack_require__(49);
268
262
  ;// CONCATENATED MODULE: ./dist/bin/eject-page.js
269
263
 
270
264
 
@@ -278,9 +272,6 @@ var external_child_process_ = __webpack_require__(317);
278
272
 
279
273
 
280
274
 
281
-
282
-
283
-
284
275
  async function command(params) {
285
276
  const { buildContext } = params;
286
277
  console.log(source/* default */.Ay.cyan('Theme type:'));
@@ -399,42 +390,9 @@ async function command(params) {
399
390
  console.log(`${source/* default */.Ay.green('✓')} ${source/* default */.Ay.bold(`.${external_path_.sep}` + (0,external_path_.relative)(process.cwd(), destDirPath))} moved from the @keycloakify/angular to your project`);
400
391
  }
401
392
  }
402
- run_format: {
403
- const parsedPackageJson = (() => {
404
- const zParsedPackageJson = (() => {
405
- const zTargetType = lib.z.object({
406
- scripts: lib.z.record(lib.z.string()).optional()
407
- });
408
- (0,assert/* assert */.v)();
409
- return (0,id.id)(zTargetType);
410
- })();
411
- const parsedPackageJson = JSON.parse(external_fs_.readFileSync(buildContext.packageJsonFilePath).toString('utf8'));
412
- zParsedPackageJson.parse(parsedPackageJson);
413
- (0,assert/* assert */.v)((0,is.is)(parsedPackageJson));
414
- return parsedPackageJson;
415
- })();
416
- const { scripts } = parsedPackageJson;
417
- if (scripts === undefined) {
418
- break run_format;
419
- }
420
- for (const scriptName of ['format', 'lint']) {
421
- if (!(scriptName in scripts)) {
422
- continue;
423
- }
424
- const command = `npm run ${scriptName}`;
425
- console.log(source/* default */.Ay.grey(`$ ${command}`));
426
- try {
427
- external_child_process_.execSync(`npm run ${scriptName}`, {
428
- stdio: 'inherit',
429
- cwd: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
430
- });
431
- }
432
- catch (_a) {
433
- console.log(source/* default */.Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
434
- }
435
- break run_format;
436
- }
437
- }
393
+ (0,runFormat/* runFormat */.J)({
394
+ packageJsonFilePath: buildContext.packageJsonFilePath
395
+ });
438
396
  edit_KcPage: {
439
397
  if (pageIdOrComponent !== templateValue &&
440
398
  pageIdOrComponent !== userProfileFormFieldsValue) {
@@ -540,6 +498,72 @@ function getThisCodebaseRootDirPath() {
540
498
  }
541
499
 
542
500
 
501
+ /***/ }),
502
+
503
+ /***/ 49:
504
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
505
+
506
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
507
+ /* harmony export */ J: () => (/* binding */ runFormat)
508
+ /* harmony export */ });
509
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
510
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
511
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
512
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
513
+ /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(966);
514
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(797);
515
+ /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94);
516
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(383);
517
+ /* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
518
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(317);
519
+ /* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_4__);
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+ function runFormat(params) {
529
+ const { packageJsonFilePath } = params;
530
+ const parsedPackageJson = (() => {
531
+ const zParsedPackageJson = (() => {
532
+ const zTargetType = zod__WEBPACK_IMPORTED_MODULE_5__.z.object({
533
+ scripts: zod__WEBPACK_IMPORTED_MODULE_5__.z.record(zod__WEBPACK_IMPORTED_MODULE_5__.z.string()).optional()
534
+ });
535
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)();
536
+ return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_6__.id)(zTargetType);
537
+ })();
538
+ const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(packageJsonFilePath).toString('utf8'));
539
+ zParsedPackageJson.parse(parsedPackageJson);
540
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_2__/* .assert */ .v)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_3__.is)(parsedPackageJson));
541
+ return parsedPackageJson;
542
+ })();
543
+ const { scripts } = parsedPackageJson;
544
+ if (scripts === undefined) {
545
+ return;
546
+ }
547
+ for (const scriptName of ['format', 'lint']) {
548
+ if (!(scriptName in scripts)) {
549
+ continue;
550
+ }
551
+ const command = `npm run ${scriptName}`;
552
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.grey(`$ ${command}`));
553
+ try {
554
+ child_process__WEBPACK_IMPORTED_MODULE_4__.execSync(`npm run ${scriptName}`, {
555
+ stdio: 'inherit',
556
+ cwd: (0,path__WEBPACK_IMPORTED_MODULE_1__.dirname)(packageJsonFilePath)
557
+ });
558
+ }
559
+ catch (_a) {
560
+ console.log(chalk__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Ay.yellow(`\`${command}\` failed, please format your code manually, continuing...`));
561
+ }
562
+ return;
563
+ }
564
+ }
565
+
566
+
543
567
  /***/ }),
544
568
 
545
569
  /***/ 672:
package/bin/main.js CHANGED
@@ -442,7 +442,7 @@ const { buildContext, commandName } = readParams({ apiVersion: 'v1' });
442
442
  return;
443
443
  case 'update-kc-gen':
444
444
  {
445
- const { command } = await __nccwpck_require__.e(/* import() */ 758).then(__nccwpck_require__.bind(__nccwpck_require__, 758));
445
+ const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(603), __nccwpck_require__.e(758)]).then(__nccwpck_require__.bind(__nccwpck_require__, 758));
446
446
  command({ buildContext });
447
447
  }
448
448
  return;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@keycloakify/angular",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "peerDependencies": {
5
- "keycloakify": "^11.3.9",
5
+ "keycloakify": "^11.3.10",
6
6
  "@angular/core": "^18.0.0",
7
7
  "@angular/common": "^18.0.0",
8
8
  "@angular/platform-browser": "^18.0.0"
@@ -25,10 +25,7 @@ import { transformCodebase } from './tools/transformCodebase';
25
25
  import { kebabCaseToCamelCase } from './tools/kebabCaseToSnakeCase';
26
26
  import { replaceAll } from './tools/String.prototype.replaceAll';
27
27
  import { capitalize } from 'tsafe/capitalize';
28
- import { id } from 'tsafe/id';
29
- import { z } from 'zod';
30
- import { is } from 'tsafe/is';
31
- import * as child_process from 'child_process';
28
+ import { runFormat } from './tools/runFormat';
32
29
 
33
30
  export async function command(params: { buildContext: BuildContext }) {
34
31
  const { buildContext } = params;
@@ -246,66 +243,9 @@ export async function command(params: { buildContext: BuildContext }) {
246
243
  }
247
244
  }
248
245
 
249
- run_format: {
250
- const parsedPackageJson = (() => {
251
- type ParsedPackageJson = {
252
- scripts?: Record<string, string>;
253
- };
254
-
255
- const zParsedPackageJson = (() => {
256
- type TargetType = ParsedPackageJson;
257
-
258
- const zTargetType = z.object({
259
- scripts: z.record(z.string()).optional()
260
- });
261
-
262
- assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
263
-
264
- return id<z.ZodType<TargetType>>(zTargetType);
265
- })();
266
-
267
- const parsedPackageJson = JSON.parse(
268
- fs.readFileSync(buildContext.packageJsonFilePath).toString('utf8')
269
- );
270
-
271
- zParsedPackageJson.parse(parsedPackageJson);
272
-
273
- assert(is<ParsedPackageJson>(parsedPackageJson));
274
-
275
- return parsedPackageJson;
276
- })();
277
-
278
- const { scripts } = parsedPackageJson;
279
-
280
- if (scripts === undefined) {
281
- break run_format;
282
- }
283
-
284
- for (const scriptName of ['format', 'lint']) {
285
- if (!(scriptName in scripts)) {
286
- continue;
287
- }
288
-
289
- const command = `npm run ${scriptName}`;
290
-
291
- console.log(chalk.grey(`$ ${command}`));
292
-
293
- try {
294
- child_process.execSync(`npm run ${scriptName}`, {
295
- stdio: 'inherit',
296
- cwd: pathDirname(buildContext.packageJsonFilePath)
297
- });
298
- } catch {
299
- console.log(
300
- chalk.yellow(
301
- `\`${command}\` failed, please format your code manually, continuing...`
302
- )
303
- );
304
- }
305
-
306
- break run_format;
307
- }
308
- }
246
+ runFormat({
247
+ packageJsonFilePath: buildContext.packageJsonFilePath
248
+ });
309
249
 
310
250
  edit_KcPage: {
311
251
  if (
@@ -0,0 +1,71 @@
1
+ import * as fs from 'fs';
2
+ import { dirname as pathDirname } from 'path';
3
+ import { assert, Equals } from 'tsafe/assert';
4
+ import chalk from 'chalk';
5
+ import { id } from 'tsafe/id';
6
+ import { z } from 'zod';
7
+ import { is } from 'tsafe/is';
8
+ import * as child_process from 'child_process';
9
+
10
+ export function runFormat(params: { packageJsonFilePath: string }) {
11
+ const { packageJsonFilePath } = params;
12
+
13
+ const parsedPackageJson = (() => {
14
+ type ParsedPackageJson = {
15
+ scripts?: Record<string, string>;
16
+ };
17
+
18
+ const zParsedPackageJson = (() => {
19
+ type TargetType = ParsedPackageJson;
20
+
21
+ const zTargetType = z.object({
22
+ scripts: z.record(z.string()).optional()
23
+ });
24
+
25
+ assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
26
+
27
+ return id<z.ZodType<TargetType>>(zTargetType);
28
+ })();
29
+
30
+ const parsedPackageJson = JSON.parse(
31
+ fs.readFileSync(packageJsonFilePath).toString('utf8')
32
+ );
33
+
34
+ zParsedPackageJson.parse(parsedPackageJson);
35
+
36
+ assert(is<ParsedPackageJson>(parsedPackageJson));
37
+
38
+ return parsedPackageJson;
39
+ })();
40
+
41
+ const { scripts } = parsedPackageJson;
42
+
43
+ if (scripts === undefined) {
44
+ return;
45
+ }
46
+
47
+ for (const scriptName of ['format', 'lint']) {
48
+ if (!(scriptName in scripts)) {
49
+ continue;
50
+ }
51
+
52
+ const command = `npm run ${scriptName}`;
53
+
54
+ console.log(chalk.grey(`$ ${command}`));
55
+
56
+ try {
57
+ child_process.execSync(`npm run ${scriptName}`, {
58
+ stdio: 'inherit',
59
+ cwd: pathDirname(packageJsonFilePath)
60
+ });
61
+ } catch {
62
+ console.log(
63
+ chalk.yellow(
64
+ `\`${command}\` failed, please format your code manually, continuing...`
65
+ )
66
+ );
67
+ }
68
+
69
+ return;
70
+ }
71
+ }
@@ -1,6 +1,7 @@
1
1
  import type { BuildContext } from './core';
2
2
  import * as fs from 'fs';
3
3
  import { join as pathJoin } from 'path';
4
+ import { runFormat } from './tools/runFormat';
4
5
 
5
6
  export function command(params: { buildContext: BuildContext }) {
6
7
  const { buildContext } = params;
@@ -17,13 +18,8 @@ export function command(params: { buildContext: BuildContext }) {
17
18
 
18
19
  const newContent = Buffer.from(
19
20
  [
20
- `/* prettier-ignore-start */`,
21
21
  ``,
22
- `/* eslint-disable */`,
23
- ``,
24
- `// noinspection JSUnusedGlobalSymbols`,
25
- ``,
26
- `// This file is auto-generated by Keycloakify`,
22
+ `// This file is auto-generated by Keycloakify, do not modify it manually.`,
27
23
  ``,
28
24
  `import type { ComponentRef, EnvironmentProviders, Type } from "@angular/core";`,
29
25
  ``,
@@ -58,6 +54,7 @@ export function command(params: { buildContext: BuildContext }) {
58
54
  `}`,
59
55
  ``,
60
56
  `type ApplicationRefLike = {`,
57
+ ` // eslint-disable-next-line @typescript-eslint/no-explicit-any`,
61
58
  ` components: ComponentRef<any>[];`,
62
59
  `};`,
63
60
  ``,
@@ -134,8 +131,6 @@ export function command(params: { buildContext: BuildContext }) {
134
131
  .flat(),
135
132
  ` }`,
136
133
  `}`,
137
- ``,
138
- `/* prettier-ignore-end */`,
139
134
  ``
140
135
  ].join('\n'),
141
136
  'utf8'
@@ -146,4 +141,6 @@ export function command(params: { buildContext: BuildContext }) {
146
141
  }
147
142
 
148
143
  fs.writeFileSync(filePath, newContent);
144
+
145
+ runFormat({ packageJsonFilePath: buildContext.packageJsonFilePath });
149
146
  }