hubot 13.0.0 → 13.0.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/GenHubot.mjs +17 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
package/src/GenHubot.mjs CHANGED
@@ -6,30 +6,34 @@ function runCommands (hubotDirectory, options) {
6
6
  options.hubotInstallationPath = options?.hubotInstallationPath ?? 'hubot'
7
7
  console.log('creating hubot directory', hubotDirectory)
8
8
  try {
9
- spawnSync('mkdir', [hubotDirectory])
9
+ File.mkdirSync(hubotDirectory, { recursive: true })
10
10
  } catch (error) {
11
11
  console.log(`${hubotDirectory} exists, continuing to the next operation.`)
12
12
  }
13
13
  const envFilePath = path.resolve(process.cwd(), '.env')
14
14
  process.chdir(hubotDirectory)
15
15
 
16
- let output = spawnSync('npm', ['init', '-y'])
17
- console.log('npm init', output.stderr.toString())
16
+ let output = spawnSync('npm', ['init', '-y'], { shell: true, stdio: 'inherit' })
17
+ console.log('npm init', output.stderr?.toString() ?? '')
18
18
  if (options.hubotInstallationPath !== 'hubot') {
19
- output = spawnSync('npm', ['pack', `${options.hubotInstallationPath}`])
20
- console.log('npm pack', output.stderr.toString(), output.stdout.toString())
19
+ output = spawnSync('npm', ['pack', `${options.hubotInstallationPath}`], { shell: true, stdio: 'inherit' })
20
+ console.log('npm pack', output.stderr?.toString() ?? '', output.stdout?.toString() ?? '')
21
21
  const customHubotPackage = JSON.parse(File.readFileSync(`${options.hubotInstallationPath}/package.json`, 'utf8'))
22
- output = spawnSync('npm', ['i', `${customHubotPackage.name}-${customHubotPackage.version}.tgz`])
23
- console.log(`npm i ${customHubotPackage.name}-${customHubotPackage.version}.tgz`, output.stderr.toString(), output.stdout.toString())
22
+ output = spawnSync('npm', ['i', `${customHubotPackage.name}-${customHubotPackage.version}.tgz`], { shell: true, stdio: 'inherit' })
23
+ console.log(`npm i ${customHubotPackage.name}-${customHubotPackage.version}.tgz`, output.stderr?.toString() ?? '', output.stdout?.toString() ?? '')
24
24
  } else {
25
- output = spawnSync('npm', ['i', 'hubot@latest'])
25
+ output = spawnSync('npm', ['i', 'hubot@latest'], { shell: true, stdio: 'inherit' })
26
26
  }
27
27
  output = spawnSync('npm', ['i', 'hubot-help@latest', 'hubot-rules@latest', 'hubot-diagnostics@latest'].concat([options.adapter]).filter(Boolean))
28
- console.log('npm i', output.stderr.toString(), output.stdout.toString())
29
- spawnSync('mkdir', ['scripts', 'tests', 'tests/doubles'])
30
- spawnSync('touch', ['external-scripts.json'])
28
+ console.log('npm i', output.stderr?.toString() ?? '', output.stdout?.toString() ?? '')
29
+
30
+ File.mkdirSync(path.join('tests', 'doubles'), { recursive: true })
31
31
 
32
32
  const externalScriptsPath = path.resolve('./', 'external-scripts.json')
33
+ if (!File.existsSync(externalScriptsPath)) {
34
+ File.writeFileSync(externalScriptsPath, '[]')
35
+ }
36
+
33
37
  let escripts = File.readFileSync(externalScriptsPath, 'utf8')
34
38
  if (escripts.length === 0) escripts = '[]'
35
39
  const externalScripts = JSON.parse(escripts)
@@ -39,6 +43,8 @@ function runCommands (hubotDirectory, options) {
39
43
 
40
44
  File.writeFileSync(externalScriptsPath, JSON.stringify(externalScripts, null, 2))
41
45
 
46
+ File.mkdirSync(path.join('scripts'), { recursive: true })
47
+
42
48
  File.writeFileSync('./scripts/Xample.mjs', `// Description:
43
49
  // Test script
44
50
  //