@@ -20,7 +20,7 @@ import {
2020 posix as pathPosix ,
2121 basename as pathBase
2222} from 'path' ;
23- import { assert , Equals } from 'tsafe/assert' ;
23+ import { assert , type Equals } from 'tsafe/assert' ;
2424import chalk from 'chalk' ;
2525import { transformCodebase } from './tools/transformCodebase_async' ;
2626import { kebabCaseToCamelCase } from './tools/kebabCaseToSnakeCase' ;
@@ -129,6 +129,8 @@ export async function command(params: { buildContext: BuildContext }) {
129129 return pathJoin ( 'pages' , pageIdOrComponent . replace ( / \. f t l $ / , '' ) ) ;
130130 } ) ( ) ;
131131
132+ let hasEjectedUserProfileFormFieldsComponent = false ;
133+
132134 {
133135 const componentDirRelativeToThemeTypePaths = [
134136 componentDirRelativeToThemeTypePath
@@ -140,6 +142,13 @@ export async function command(params: { buildContext: BuildContext }) {
140142
141143 assert ( componentDirRelativeToThemeTypePath_i !== undefined ) ;
142144
145+ if (
146+ componentDirRelativeToThemeTypePath_i ===
147+ pathJoin ( 'components' , 'user-profile-form-fields' )
148+ ) {
149+ hasEjectedUserProfileFormFieldsComponent = true ;
150+ }
151+
143152 const destDirPath = pathJoin (
144153 buildContext . themeSrcDirPath ,
145154 themeType ,
@@ -301,16 +310,28 @@ export async function command(params: { buildContext: BuildContext }) {
301310 }
302311
303312 edit_KcFiles: {
304- if (
305- pageIdOrComponent !== templateValue &&
306- pageIdOrComponent !== userProfileFormFieldsValue
307- ) {
313+ const componentRelativeDirPath_posix = ( ( ) => {
314+ if ( pageIdOrComponent === templateValue ) {
315+ return 'template' ;
316+ }
317+
318+ if (
319+ pageIdOrComponent === userProfileFormFieldsValue ||
320+ hasEjectedUserProfileFormFieldsComponent
321+ ) {
322+ return 'components/user-profile-form-fields' ;
323+ }
324+
325+ return undefined ;
326+ } ) ( ) ;
327+
328+ if ( componentRelativeDirPath_posix === undefined ) {
308329 break edit_KcFiles;
309330 }
310331
311332 const filesToProcess = [ 'KcPage.ts' , 'KcPageStory.ts' ] ;
312333
313- for ( let fileName of filesToProcess ) {
334+ for ( const fileName of filesToProcess ) {
314335 const filePath = pathJoin ( buildContext . themeSrcDirPath , themeType , fileName ) ;
315336
316337 if ( ! fs . existsSync ( filePath ) ) {
@@ -321,10 +342,6 @@ export async function command(params: { buildContext: BuildContext }) {
321342 const originalCode = fs . readFileSync ( filePath ) . toString ( 'utf8' ) ;
322343
323344 const modifiedCode = await ( async ( ) => {
324- const componentRelativeDirPath_posix = componentDirRelativeToThemeTypePath
325- . split ( pathSep )
326- . join ( '/' ) ;
327-
328345 let sourceCode = originalCode . replace (
329346 `@keycloakify/angular/${ themeType } /${ componentRelativeDirPath_posix } ` ,
330347 componentRelativeDirPath_posix_to_componentRelativeFilePath_posix ( {
0 commit comments