-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Javascript regression: Hubot tries to load all files in script directories, even if they aren't Javascript #1355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This would need to be tested, but if anyone is running into it, you could try moving the files out of the scripts directory as a work around. That might require other code changes to account for different paths. |
Thanks for the research into the problem @technicalpickles, it sounds right. I think we can check for just Line 352 in d3df713
|
@gr2m I'd use the same check that was there, ie I checked the require.extenisons docs and it says it's deprecated, but not going anywhere. I don't think we need to tackle that as part of this 3.0 release for javascript support. |
sounds good |
@technicalpickles I’ll prepare a PR today |
sorry didn’t manage to yesterday and will be in a meeting all day today. I’ll send a PR tomorrow |
@technicalpickles @timothywellsjr @mistydemeo I started a PR that should fix the problem: |
👍 |
Had a question on how to resolve the related issue of adding a warning for when unsupported files are rejected from loading. I was going to address it by adding something like:
But getting the list of accepted extensions, I found that it accepts .js, .json and .node. If coffee-script is also required, it will also allow .coffee, .litcoffee and .coffee.md. Now, most of those should not be accepted by the .loadFile method AND the require.extensions is also depreciated, requiring a Due to the above, why not just use a fixed array of accepted types, being just |
Unsupported extensions were silently omitted from loadFile, this made it hard to debug. The accepted extensions were also incorrect due to use of require.extensions which is depreciated and contained types that are incompatible with hubot to load as scripts - fixes hubotio#1377 related hubotio#1355
@timothywellsjr posted on the Javascript evolution with a report that hubot was trying to require a YAML in
scripts
. @mistydemeo asked if the updated hubot is trying to load all files, not just javascript.It seems like, yes, it is. Here's a dive through the relevant codes:
scripts
: https://github.com/hubotio/hubot/blob/master/bin/hubot.js#L115robot.load
finds all files in thescripts
directory, then callsrobot.loadFile
: https://github.com/hubotio/hubot/blob/master/src/robot.js#L376robot.loadFile
tries to requireCompare this to the previous behavior of
loadFile
which checks if it's a supported require type: https://github.com/hubotio/hubot/pull/1347/files#diff-740956d8fdad73632c4937d631b7c79bL353cc @gr2m
The text was updated successfully, but these errors were encountered: