@@ -86,6 +86,11 @@ const validateAppConfiguration = () => {
8686 }
8787}
8888
89+ /**
90+ * Executes a command in the application-extension directory.
91+ * @param {string } command - The command to execute.
92+ * @param {string } pkgRoot - The root directory of the package.
93+ */
8994const runCommandInExtensions = ( command , pkgRoot ) => {
9095 const extensionsDir = p . join ( pkgRoot , '..' , '..' , '..' , 'app' , 'application-extensions' )
9196
@@ -104,21 +109,21 @@ const runCommandInExtensions = (command, pkgRoot) => {
104109 return fse . statSync ( p . join ( extensionPath , subDir ) ) . isDirectory ( )
105110 } )
106111
107- // Lint each subdirectory for namespaced extensions
112+ // Execute the provided command in each subdirectory for namespaced extensions
108113 subDirs . forEach ( ( subDir ) => {
109114 const subDirPath = p . join ( extensionPath , subDir )
110115 try {
111116 execSync ( `cd ${ subDirPath } && ${ command } ` )
112117 } catch ( error ) {
113- console . error ( `Error executing command in ${ subDirPath } :` , error . message ) // Log the error
118+ console . error ( `Error executing command in ${ subDirPath } :` , error . message )
114119 }
115120 } )
116121 } else {
117- // For non-namespaced extensions, run the command in the extension directory
122+ // For non-namespaced extensions, execute the provided command in the extension directory
118123 try {
119124 execSync ( `cd ${ extensionPath } && ${ command } ` )
120125 } catch ( error ) {
121- console . error ( `Error executing command in ${ extensionPath } :` , error . message ) // Log the error
126+ console . error ( `Error executing command in ${ extensionPath } :` , error . message )
122127 }
123128 }
124129 } )
@@ -481,7 +486,7 @@ const main = async () => {
481486 . description ( 'lint all source files' )
482487 . argument ( '<path>' , 'path or glob to lint' )
483488 . option ( '--fix' , 'Try and fix errors (default: false)' )
484- . action ( async ( pathArg , { fix} ) => {
489+ . action ( async ( path , { fix} ) => {
485490 const eslint = p . join ( require . resolve ( 'eslint' ) , '..' , '..' , '..' , '.bin' , 'eslint' )
486491 const command = `"${ eslint } " --resolve-plugins-relative-to "${ pkgRoot } "${
487492 fix ? ' --fix' : ''
@@ -491,7 +496,7 @@ const main = async () => {
491496 runCommandInExtensions ( command , pkgRoot )
492497
493498 // Run the command on the provided path
494- execSync ( `${ command } "${ pathArg } "` )
499+ execSync ( `${ command } "${ path } "` )
495500 } )
496501
497502 program
@@ -599,17 +604,15 @@ const main = async () => {
599604 . description ( 'compile TypeScript files in all files' )
600605 . argument ( '<path>' , 'path or glob to compile' )
601606 . argument ( '[args...]' , 'additional arguments for tsc' )
602- . action ( async ( pathArg , args ) => {
607+ . action ( async ( path , args ) => {
603608 const tsc = p . join ( require . resolve ( 'typescript' ) , '..' , '..' , '..' , '.bin' , 'tsc' )
604609 const command = `"${ tsc } " ${ args . join ( ' ' ) } `
605610
606- console . log ( `Debug: Executing TypeScript command: ${ command } "${ pathArg } "` )
607-
608611 // Run the command in application extensions
609612 runCommandInExtensions ( command , pkgRoot )
610613
611614 // Run the command on the provided path
612- execSync ( `${ command } "${ pathArg } "` )
615+ execSync ( `${ command } "${ path } "` )
613616 } )
614617
615618 // Global options
0 commit comments