hubot 8.0.2 → 8.0.3

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.
package/bin/hubot.js CHANGED
@@ -8,13 +8,13 @@ const OptParse = require('optparse')
8
8
  const Hubot = require('..')
9
9
 
10
10
  const switches = [
11
- ['-a', '--adapter ADAPTER', 'The Adapter to use, e.g. "shell" (to load the default hubot shell adapter)'],
12
- ['-f', '--file PATH', 'Path to adapter file, e.g. "./adapters/CustomAdapter.mjs"'],
13
- ['-c', '--create PATH', 'Create a deployable hubot'],
14
- ['-d', '--disable-httpd DISABLE_HTTPD', 'Disable the HTTP server'],
11
+ ['-a', '--adapter HUBOT_ADAPTER', 'The Adapter to use, e.g. "shell" (to load the default hubot shell adapter)'],
12
+ ['-f', '--file HUBOT_FILE', 'Path to adapter file, e.g. "./adapters/CustomAdapter.mjs"'],
13
+ ['-c', '--create HUBOT_CREATE', 'Create a deployable hubot'],
14
+ ['-d', '--disable-httpd HUBOT_HTTPD', 'Disable the HTTP server'],
15
15
  ['-h', '--help', 'Display the help information'],
16
- ['-l', '--alias ALIAS', "Enable replacing the robot's name with alias"],
17
- ['-n', '--name NAME', 'The name of the robot in chat'],
16
+ ['-l', '--alias HUBOT_ALIAS', "Enable replacing the robot's name with alias"],
17
+ ['-n', '--name HUBOT_NAME', 'The name of the robot in chat'],
18
18
  ['-r', '--require PATH', 'Alternative scripts path'],
19
19
  ['-t', '--config-check', "Test hubot's config to make sure it won't fail at startup"],
20
20
  ['-v', '--version', 'Displays the version of hubot installed']
@@ -97,6 +97,7 @@ if (options.create) {
97
97
  if (options.file) {
98
98
  options.adapter = options.file.split('/').pop().split('.')[0]
99
99
  }
100
+
100
101
  const robot = Hubot.loadBot(options.adapter, options.enableHttpd, options.name, options.alias)
101
102
  module.exports = robot
102
103
 
@@ -107,7 +108,6 @@ async function loadScripts () {
107
108
  loadExternalScripts()
108
109
 
109
110
  const tasks = options.scripts.map((scriptPath) => {
110
- console.log('loadding', scriptPath)
111
111
  if (scriptPath[0] === '/') {
112
112
  return robot.load(scriptPath)
113
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
package/src/robot.js CHANGED
@@ -347,7 +347,7 @@ class Robot {
347
347
  }
348
348
 
349
349
  async loadmjs (filePath) {
350
- const script = await import(filePath)
350
+ const script = await import(pathToFileURL(filePath))
351
351
  if (typeof script?.default === 'function') {
352
352
  script.default(this)
353
353
  } else {
@@ -526,7 +526,7 @@ class Robot {
526
526
  try {
527
527
  this.adapter = this.requireAdapterFrom(adapterPathInCurrentWorkingDirectory)
528
528
  } catch (err) {
529
- if (err.name === 'SyntaxError' && err.message.includes('Cannot use import statement outside a module')) {
529
+ if (err.name === 'SyntaxError') {
530
530
  this.adapter = await this.importAdapterFrom(adapterPathInCurrentWorkingDirectory)
531
531
  } else {
532
532
  throw err