hubot 11.1.3 → 11.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "11.1.3",
3
+ "version": "11.1.5",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
package/src/Brain.mjs CHANGED
@@ -157,9 +157,9 @@ class Brain extends EventEmitter {
157
157
  this.emit('loaded', this.data)
158
158
  }
159
159
 
160
- // Public: Get an Array of User objects stored in the brain.
160
+ // Public: Get an object of User objects stored in the brain.
161
161
  //
162
- // Returns an Array of User objects.
162
+ // Returns an object of User objects.
163
163
  users () {
164
164
  return this.data.users
165
165
  }
package/src/Robot.mjs CHANGED
@@ -12,6 +12,7 @@ import { Listener, TextListener } from './Listener.mjs'
12
12
  import Message from './Message.mjs'
13
13
  import Middleware from './Middleware.mjs'
14
14
 
15
+ const File = fs.promises
15
16
  const HUBOT_DEFAULT_ADAPTERS = ['Campfire', 'Shell']
16
17
  const HUBOT_DOCUMENTATION_SECTIONS = ['description', 'dependencies', 'configuration', 'commands', 'notes', 'author', 'authors', 'examples', 'tags', 'urls']
17
18
 
@@ -380,10 +381,18 @@ class Robot {
380
381
  // Returns nothing.
381
382
  async load (path) {
382
383
  this.logger.debug(`Loading scripts from ${path}`)
383
-
384
- if (fs.existsSync(path)) {
385
- const tasks = fs.readdirSync(path).sort().map(file => this.loadFile(path, file))
386
- await Promise.all(tasks)
384
+ try {
385
+ const folder = await File.readdir(path, { withFileTypes: true })
386
+ for await (const file of folder) {
387
+ if (file.isDirectory()) continue
388
+ try {
389
+ await this.loadFile(path, file.name)
390
+ } catch (e) {
391
+ this.logger.error(`Error loading file ${file.name} - ${e.stack}`)
392
+ }
393
+ }
394
+ } catch (e) {
395
+ this.logger.error(`Path ${path} does not exist`)
387
396
  }
388
397
  }
389
398