Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubot-npm

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubot-npm - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

5

index.js

@@ -5,2 +5,3 @@ // Description:

// HUBOT_NPM_SECRET - The hook secret
// HUBOT_NPM_ROOM - The default room for notifications
// Commands:

@@ -12,2 +13,4 @@ // None

const defaultRoom = process.env.HUBOT_NPM_ROOM;
const getMessage = (hook) => {

@@ -52,3 +55,3 @@ const url = `https://www.npmjs.com/package/${hook.name}`;

const hook = req.body;
let room = req.query.room;
let room = req.query.room || defaultRoom;

@@ -55,0 +58,0 @@ if (!room) {

2

package.json
{
"name": "hubot-npm",
"version": "0.0.7",
"version": "0.0.8",
"description": "Hubot script for npm notifications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,2 +27,8 @@ # hubot-npm

If you want to set a default room for notifications:
```
export HUBOT_NPM_ROOM=<room>
```
## Usage

@@ -33,6 +39,6 @@

```
<hubot_url>:<port>/hubot/npm?room=<room>
<hubot_url>:<port>/hubot/npm[?room=<room>]
```
Be sure to set the `?room` query string parameter.
Be sure to set the `?room` query string parameter if you've not set the `HUBOT_NPM_ROOM` variable.

@@ -42,3 +48,3 @@ You can add your hook using the [wombat CLI tool](https://www.npmjs.com/package/wombat):

```
wombat hook add <user|package|scope> <hubot_url>:<port>/hubot/npm?room=<room> <secret>
wombat hook add <user|package|scope> <hubot_url>:<port>/hubot/npm[?room=<room>] <secret>
```

@@ -11,14 +11,44 @@ 'use strict';

const hooks = {
'package:publish': require('./hooks/package:publish'),
'package:unpublish': require('./hooks/package:unpublish'),
'package:star': require('./hooks/package:star'),
'package:unstar': require('./hooks/package:unstar'),
'package:owner': require('./hooks/package:owner'),
'package:owner-rm': require('./hooks/package:owner-rm'),
'package:dist-tag': require('./hooks/package:dist-tag'),
'package:dist-tag-rm': require('./hooks/package:dist-tag-rm'),
'package:deprecated': require('./hooks/package:deprecated'),
'package:undeprecated': require('./hooks/package:undeprecated')
};
const hooks = [
{
event: 'package:publish',
expected: 'npm-hook-test@0.0.4 published – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:unpublish',
expected: 'npm-hook-test@0.0.4 unpublished – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:star',
expected: 'a-user starred npm-hook-test – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:unstar',
expected: 'a-user unstarred npm-hook-test – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:owner',
expected: 'npm-hook-test owner added: a-user – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:owner-rm',
expected: 'npm-hook-test owner removed: a-user – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:dist-tag',
expected: 'npm-hook-test new dist-tag: beta – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:dist-tag-rm',
expected: 'npm-hook-test dist-tag removed: beta – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:deprecated',
expected: 'npm-hook-test@0.0.4 deprecated – https://www.npmjs.com/package/npm-hook-test'
},
{
event: 'package:undeprecated',
expected: 'npm-hook-test@0.0.4 undeprecated – https://www.npmjs.com/package/npm-hook-test'
}
];

@@ -44,181 +74,21 @@ describe('hubot-npm', () => {

});
it('supports the package:publish hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:publish'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 published – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:unpublish hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:unpublish'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 unpublished – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:star hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:star'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'a-user starred npm-hook-test – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:unstar hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:unstar'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'a-user unstarred npm-hook-test – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:owner hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:owner'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test owner added: a-user – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:owner-rm hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:owner-rm'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test owner removed: a-user – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:dist-tag hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:dist-tag'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test new dist-tag: beta – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:dist-tag-rm hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:dist-tag-rm'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test dist-tag removed: beta – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:deprecated hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:deprecated'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 deprecated – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
});
it('supports the package:undeprecated hook', (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(hooks['package:undeprecated'])
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
'npm-hook-test@0.0.4 undeprecated – https://www.npmjs.com/package/npm-hook-test'
);
done();
});
hooks.forEach((hook) => {
it(`supports the ${hook.event} hook`, (done) => {
request(robot.router)
.post('/hubot/npm?room=test-room')
.send(require(`./hooks/${hook.event}`))
.expect(200)
.end((err) => {
assert.ifError(err);
sinon.assert.calledWith(
robot.send,
sinon.match({
room: ['#test-room']
}),
hook.expected
);
done();
});
});
});

@@ -225,0 +95,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc