Skip to content

Commit a688d4f

Browse files
committed
1.0.0rc2
0 parents  commit a688d4f

File tree

5 files changed

+108
-0
lines changed

5 files changed

+108
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

jshelp.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const npm = require('npm');
2+
const Promise = require('bluebird');
3+
const npminfo = Promise.promisify(npm.info, npm);
4+
const format = require('util').format;
5+
const inspect = require('util').inspect;
6+
7+
module.exports = {
8+
init: function (client, imports) {
9+
const ready = Promise.promisify(npm.load, npm)({});
10+
11+
ready.catch(function (err) {
12+
client.error('Plugin-JSHelp', err.name);
13+
client.error('Plugin-JSHelp', err.stack);
14+
});
15+
16+
return {
17+
handlers: {
18+
'!npm': function (command) {
19+
if (command.args.length === 0) {
20+
return;
21+
}
22+
23+
return ready
24+
.then(function () {
25+
return npminfo(command.args[0])
26+
})
27+
.then(function (res) {
28+
const versions = res[0];
29+
const node_module = versions[Object.keys(versions)[0]];
30+
return format('%s: %s - %s -> https://npmjs.org/package/%s',
31+
command.nickname, node_module.name, node_module.description, node_module.name);
32+
return (inspect(res));
33+
})
34+
.catch(function (err) {
35+
client.error('Plugin-JSHelp', err.name);
36+
client.error('Plugin-JSHelp', err.stack);
37+
});
38+
}
39+
},
40+
41+
help: {
42+
npm: [
43+
'!npm <module>',
44+
'Look up the description and link to the specified module.'
45+
]
46+
},
47+
48+
commands: ['npm']
49+
};
50+
}
51+
};

license

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright (c) 2014, Ryan Scheel (havvy) <ryan.havvy@gmail.com>
2+
3+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4+
5+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "tennu-jshelp",
3+
"version": "1.0.0rc2",
4+
"description": "JS Help Plugin for Tennu IRC Bot Framework",
5+
"main": "jshelp.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/Tennu/tennu-jshelp.git"
12+
},
13+
"keywords": [
14+
"tennu",
15+
"tennu-plugin"
16+
],
17+
"author": "Ryan Scheel",
18+
"license": "ISC",
19+
"bugs": {
20+
"url": "https://github.com/Tennu/tennu-jshelp/issues"
21+
},
22+
"homepage": "https://github.com/Tennu/tennu-jshelp",
23+
"dependencies": {
24+
"bluebird": "~0.11.6-0",
25+
"npm": "~1.3.23"
26+
}
27+
}

readme.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This plugin let's you help yourself and others with JavaScript.
2+
3+
## Config
4+
5+
None
6+
7+
## Commands
8+
9+
### !npm <module>
10+
11+
Look up the description and link to the specified module.
12+
13+
## Exports
14+
15+
None
16+
17+
## Hooks
18+
19+
None
20+
21+
## Bugs
22+
23+
The `npm` command will echo to stdout. If you know a solution to this,
24+
https://stackoverflow.com/questions/21070167/call-npm-infomodulename-without-printing-result-to-stdout

0 commit comments

Comments
 (0)