@@ -6,30 +6,34 @@ function runCommands (hubotDirectory, options) {
66 options . hubotInstallationPath = options ?. hubotInstallationPath ?? 'hubot'
77 console . log ( 'creating hubot directory' , hubotDirectory )
88 try {
9- spawnSync ( 'mkdir' , [ hubotDirectory ] )
9+ spawnSync ( 'mkdir' , [ hubotDirectory ] , { shell : true , stdio : 'inherit' } )
1010 } catch ( error ) {
1111 console . log ( `${ hubotDirectory } exists, continuing to the next operation.` )
1212 }
1313 const envFilePath = path . resolve ( process . cwd ( ) , '.env' )
1414 process . chdir ( hubotDirectory )
1515
16- let output = spawnSync ( 'npm' , [ 'init' , '-y' ] )
16+ let output = spawnSync ( 'npm' , [ 'init' , '-y' ] , { shell : true , stdio : 'inherit' } )
1717 console . log ( 'npm init' , output . stderr . toString ( ) )
1818 if ( options . hubotInstallationPath !== 'hubot' ) {
19- output = spawnSync ( 'npm' , [ 'pack' , `${ options . hubotInstallationPath } ` ] )
19+ output = spawnSync ( 'npm' , [ 'pack' , `${ options . hubotInstallationPath } ` ] , { shell : true , stdio : 'inherit' } )
2020 console . log ( 'npm pack' , output . stderr . toString ( ) , output . stdout . toString ( ) )
2121 const customHubotPackage = JSON . parse ( File . readFileSync ( `${ options . hubotInstallationPath } /package.json` , 'utf8' ) )
22- output = spawnSync ( 'npm' , [ 'i' , `${ customHubotPackage . name } -${ customHubotPackage . version } .tgz` ] )
22+ output = spawnSync ( 'npm' , [ 'i' , `${ customHubotPackage . name } -${ customHubotPackage . version } .tgz` ] , { shell : true , stdio : 'inherit' } )
2323 console . log ( `npm i ${ customHubotPackage . name } -${ customHubotPackage . version } .tgz` , output . stderr . toString ( ) , output . stdout . toString ( ) )
2424 } else {
25- output = spawnSync ( 'npm' , [ 'i' , 'hubot@latest' ] )
25+ output = spawnSync ( 'npm' , [ 'i' , 'hubot@latest' ] , { shell : true , stdio : 'inherit' } )
2626 }
2727 output = spawnSync ( 'npm' , [ 'i' , 'hubot-help@latest' , 'hubot-rules@latest' , 'hubot-diagnostics@latest' ] . concat ( [ options . adapter ] ) . filter ( Boolean ) )
2828 console . log ( 'npm i' , output . stderr . toString ( ) , output . stdout . toString ( ) )
29- spawnSync ( 'mkdir' , [ 'scripts' , 'tests' , 'tests/doubles' ] )
30- spawnSync ( 'touch ', [ 'external-scripts.json' ] )
29+
30+ File . mkdirSync ( path . join ( 'tests ', 'doubles' ) , { recursive : true } )
3131
3232 const externalScriptsPath = path . resolve ( './' , 'external-scripts.json' )
33+ if ( ! File . existsSync ( externalScriptsPath ) ) {
34+ File . writeFileSync ( externalScriptsPath , '[]' )
35+ }
36+
3337 let escripts = File . readFileSync ( externalScriptsPath , 'utf8' )
3438 if ( escripts . length === 0 ) escripts = '[]'
3539 const externalScripts = JSON . parse ( escripts )
@@ -39,6 +43,8 @@ function runCommands (hubotDirectory, options) {
3943
4044 File . writeFileSync ( externalScriptsPath , JSON . stringify ( externalScripts , null , 2 ) )
4145
46+ File . mkdirSync ( path . join ( 'scripts' ) , { recursive : true } )
47+
4248 File . writeFileSync ( './scripts/Xample.mjs' , `// Description:
4349// Test script
4450//
0 commit comments