@@ -28,21 +28,34 @@ program
2828 . option ( '-C, --no-initial-commit' , "don't perform an initial commit" )
2929 . option ( '-I, --no-install' , "don't install packages after initialization" )
3030 . option ( '-M, --module-federation' , 'install to use as module (only internal)' )
31- . option ( '-T, --tobit-internal' , 'includes tobit internal packages (chayns-logger and tobit-textstrings)' )
31+ . option (
32+ '-T, --tobit-internal' ,
33+ 'includes tobit internal packages (chayns-logger and tobit-textstrings)' ,
34+ )
3235 . option (
3336 '-p, --package-manager <manager>' ,
3437 'specify the package manager to use (`npm` or `yarn`). Defaults to the one used to execute the command.' ,
3538 )
3639 . action ( createChaynsApp )
3740 . parse ( process . argv ) ;
3841
39- async function createChaynsApp ( { git, initialCommit, install, packageManager, moduleFederation, tobitInternal } ) {
42+ async function createChaynsApp ( {
43+ git,
44+ initialCommit,
45+ install,
46+ packageManager,
47+ moduleFederation,
48+ tobitInternal,
49+ } ) {
4050 let projectVersion ;
4151 let projectType ;
4252
4353 if ( tobitInternal ) {
4454 try {
45- const res = await fetch ( `https://repo.tobit.ag` , { method : 'HEAD' , signal : AbortSignal . timeout ( 3000 ) } ) ;
55+ const res = await fetch ( `https://repo.tobit.ag` , {
56+ method : 'HEAD' ,
57+ signal : AbortSignal . timeout ( 3000 ) ,
58+ } ) ;
4659 if ( ! res . ok ) {
4760 tobitInternal = false ;
4861 }
@@ -342,28 +355,38 @@ async function createChaynsApp({ git, initialCommit, install, packageManager, mo
342355 fs . mkdirSync ( path . join ( destination , '/src/utils' ) ) ;
343356 }
344357 await copyFile (
345- getTemplatePath ( `../templates/api-v5/internal/${ extension } /src/utils/logger.${ extension } ` ) ,
358+ getTemplatePath (
359+ `../templates/api-v5/internal/${ extension } /src/utils/logger.${ extension } ` ,
360+ ) ,
346361 path . join ( destination , `/src/utils/logger.${ extension } ` ) ,
347362 ) ;
348363
349364 const filePath = path . join ( destination , `/src/components/AppWrapper.${ extension } x` ) ;
350- fs . writeFileSync ( filePath , createAppWrapper ( {
351- useRedux,
352- useTypescript,
353- moduleFederation,
354- tobitInternal,
355- packageNameUnderscore : projectName . replace ( '-' , '_' ) ,
356- } ) ) ;
365+ fs . writeFileSync (
366+ filePath ,
367+ createAppWrapper ( {
368+ useRedux,
369+ useTypescript,
370+ moduleFederation,
371+ tobitInternal,
372+ packageNameUnderscore : projectName . replace ( '-' , '_' ) ,
373+ } ) ,
374+ ) ;
357375
358376 const npmrcPath = path . join ( destination , '.npmrc' ) ;
359377 fs . writeFileSync ( npmrcPath , 'registry=https://repo.tobit.ag/repository/npm/\n' ) ;
360378 }
361379
362- const fileSource = getTemplatePath ( `../templates/api-v5/shared/toolkit.config${ moduleFederation ? '-module' : '' } .js` ) ;
380+ const fileSource = getTemplatePath (
381+ `../templates/api-v5/shared/toolkit.config${ moduleFederation ? '-module' : '' } .js` ,
382+ ) ;
363383 const fileDestination = path . join ( destination , 'toolkit.config.js' ) ;
364384 let configContent = fs . readFileSync ( fileSource , 'utf-8' ) ;
365385 if ( tobitInternal ) {
366- configContent = configContent . replace ( / ( \s + ) ( p o r t : .* ) / , `$1$2$1cert: '//fs1/SSL/tobitag.crt',$1key: '//fs1/SSL/tobitag.key',` ) ;
386+ configContent = configContent . replace (
387+ / ( \s + ) ( p o r t : .* ) / ,
388+ `$1$2$1cert: '//fs1/SSL/tobitag.crt',$1key: '//fs1/SSL/tobitag.key',` ,
389+ ) ;
367390 }
368391 fs . writeFileSync ( fileDestination , configContent ) ;
369392 }
@@ -425,7 +448,9 @@ async function createChaynsApp({ git, initialCommit, install, packageManager, mo
425448 `./${ projectName } /` ,
426449 ) } folder in your favorite editor.`,
427450 ) ;
428- console . log ( `Initialize ${ chalk . yellowBright ( 'tobit-textstrings' ) } by calling ${ chalk . cyanBright ( 'npx tobit-textstrings init' ) } .` )
451+ console . log (
452+ `Initialize ${ chalk . yellowBright ( 'tobit-textstrings' ) } by calling ${ chalk . cyanBright ( 'npx tobit-textstrings init' ) } .` ,
453+ ) ;
429454 console . log ( `Search for ${ chalk . greenBright ( 'TODO:' ) } and follow the instructions.` ) ;
430455 console . log ( `Start ${ chalk . cyanBright ( '`' + runCommand + '`' ) } .\n` ) ;
431456 } else {
0 commit comments