-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Print warning for loading deprecated hubot-scripts.json #970
Conversation
@@ -111,6 +111,11 @@ else | |||
console.error "Error parsing JSON data from hubot-scripts.json: #{err}" | |||
process.exit(1) | |||
|
|||
console.warn "Loading scripts from hubot-scripts.json is deprecated and " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be inside the above try-catch (scripts
could be undefined at this point)
I like this (pending code comments) |
The main downside of this approach is it pushes the work of finding a replacement for a script in the hubot-scripts repository with an npm replacement to every single users. If we can give users specific things they can do as part of an upgrade, I think that'd be much preferred. Also worth noting, {'hubot-scripts': ['alot'], 'hubot-pager-me': '*'} You can see the syntax at https://github.com/github/hubot/blob/master/src/robot.coffee#L285-L290 checks for an array or treats it as an object otherwise. The code in the hubot-example and later the generator-hubot puts this in index.coffee: module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if script in scripts
else
robot.loadFile(scriptsPath, script) That gets users using the external-scripts.json syntax at least, but doesn't ween them off that repository. |
I'm coming around to this idea. I think the key is going the user a path forward. If we can get hubot-scripts updated to warn about deprecated scripts with specific replacements, then we can still use github/hubot-scripts#1641 as the place to direct people. We could mess with the body a little to make it clear it's not a comprehensive list, but there might be other scripts already in the while, and if there aren't users should be encouraged to take ownership of them. |
Just thought about this -- what about a Wiki page on the hubot-scripts repo? |
Having it in a wiki would make it easier for anyone to update. The downside is that anyone can update, which means it'd need to be curated for accuracy. |
Been noodling about this one some more. I was thinking to add a
I'm not quite happy on the language/wording yet, but I'm aiming to:
|
…ripts.json to get more replacements, or installing a version that has the replacements.json
github/hubot-scripts#1697 is shipped in [email protected] to start tracking that replacements.json, so going to see about landing this to start getting the word out. |
This is released in 2.19.0 |
⚡ |
Instead of going through and manually adding deprecations for individual scripts (/cc github/hubot-scripts#1641), what if core prints a warning whenever it loads the deprecated scripts?
This will print the following warning after successfully loading scripts from `hubot-scripts.json: