Skip to content

Commit 7e09ebf

Browse files
committed
chore(package): update standard to the latest version
1 parent 9388dde commit 7e09ebf

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const amqp = require('amqplib')
22
const redis = require('redis')
33

44
const env = require('./lib/env')
5-
const {parseRegistryUrl, checkFollower, startChanges} = require('./lib/follow')
5+
const { parseRegistryUrl, checkFollower, startChanges } = require('./lib/follow')
66

77
;(async () => {
88
const conn = await amqp.connect(env.AMQP_URL)

lib/env.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const envalid = require('envalid')
22
const isEmpty = require('lodash').isEmpty
3-
const {str, url, json, bool, num} = envalid
3+
const { str, url, json, bool, num } = envalid
44

55
const isNotEmpty = (value) => !isEmpty(value)
66

@@ -11,19 +11,19 @@ const urlArray = envalid.makeValidator(x => {
1111
})
1212

1313
const environmentConfig = {
14-
AMQP_URL: url({devDefault: 'amqp://localhost'}),
15-
REGISTRY_URLS: urlArray({default: '["https://replicate.npmjs.com/registry"]'}),
16-
REDIS_URL: url({default: 'redis://redis:6379', devDefault: 'redis://localhost:6379'}),
17-
REDIS_SEQ_KEY: str({default: 'changes-seq'}),
18-
QUEUE_NAME: str({default: 'events'}),
19-
NODE_ENV: str({choices: ['development', 'staging', 'production'], devDefault: 'development'}),
20-
STATSD_HOST: str({default: '172.17.0.1'}),
21-
REGISTRY_CHANGE_DELAY: num({default: 1000 * 60, devDefault: 1000}),
22-
IS_ENTERPRISE: bool({default: false})
14+
AMQP_URL: url({ devDefault: 'amqp://localhost' }),
15+
REGISTRY_URLS: urlArray({ default: '["https://replicate.npmjs.com/registry"]' }),
16+
REDIS_URL: url({ default: 'redis://redis:6379', devDefault: 'redis://localhost:6379' }),
17+
REDIS_SEQ_KEY: str({ default: 'changes-seq' }),
18+
QUEUE_NAME: str({ default: 'events' }),
19+
NODE_ENV: str({ choices: ['development', 'staging', 'production'], devDefault: 'development' }),
20+
STATSD_HOST: str({ default: '172.17.0.1' }),
21+
REGISTRY_CHANGE_DELAY: num({ default: 1000 * 60, devDefault: 1000 }),
22+
IS_ENTERPRISE: bool({ default: false })
2323
}
2424

2525
if (!process.env.IS_ENTERPRISE) {
26-
environmentConfig.ROLLBAR_TOKEN_CHANGES = str({devDefault: ''})
26+
environmentConfig.ROLLBAR_TOKEN_CHANGES = str({ devDefault: '' })
2727
}
2828

2929
module.exports = envalid.cleanEnv(process.env, environmentConfig)

lib/follow.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function parseRegistryUrl (registry) {
3939
}
4040
}
4141

42-
function checkFollower ({registry, client, changes}, done) {
42+
function checkFollower ({ registry, client, changes }, done) {
4343
request({
4444
url: registry.url,
4545
json: true
@@ -57,7 +57,7 @@ function checkFollower ({registry, client, changes}, done) {
5757
})
5858
}
5959

60-
async function handleChange ({channel, client, registry}, change) {
60+
async function handleChange ({ channel, client, registry }, change) {
6161
statsdClient.increment('change')
6262
statsdClient.gauge('sequence', change.seq)
6363
client.set(registry.seqKey, change.seq, err => {
@@ -79,14 +79,14 @@ async function handleChange ({channel, client, registry}, change) {
7979
try {
8080
await asyncTimeout(env.REGISTRY_CHANGE_DELAY, async () => {
8181
const payloadBuffer = Buffer.from(JSON.stringify(payload))
82-
await channel.sendToQueue(env.QUEUE_NAME, payloadBuffer, {priority: 1})
82+
await channel.sendToQueue(env.QUEUE_NAME, payloadBuffer, { priority: 1 })
8383
})
8484
} catch (err) {
8585
rollbar.error(err)
8686
}
8787
}
8888

89-
function startChanges ({channel, client, registry}, cb) {
89+
function startChanges ({ channel, client, registry }, cb) {
9090
client.get(registry.seqKey, function (err, reply) {
9191
if (err) rollbar.error(err)
9292

@@ -106,7 +106,7 @@ function startChanges ({channel, client, registry}, cb) {
106106
changes.destroy()
107107
cb(error || new Error('resarting'))
108108
})
109-
changes.on('data', handleChange.bind(null, {channel, client, registry}))
109+
changes.on('data', handleChange.bind(null, { channel, client, registry }))
110110
cb(null, changes)
111111
})
112112
}

lib/rollbar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {resolve} = require('path')
1+
const { resolve } = require('path')
22

33
const Rollbar = require('rollbar')
44

@@ -18,5 +18,5 @@ if (enabled) {
1818
exitOnUncaughtException: true
1919
})
2020
} else {
21-
module.exports = new Rollbar({enabled: false})
21+
module.exports = new Rollbar({ enabled: false })
2222
}

test/follow.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const {EventEmitter} = require('events')
1+
const { EventEmitter } = require('events')
22

33
const amqp = require('amqplib')
44
const nock = require('nock')
55
const redis = require('redis-mock')
6-
const {test, afterEach, tearDown} = require('tap')
6+
const { test, afterEach, tearDown } = require('tap')
77
const proxyquire = require('proxyquire')
88

99
const env = require('../lib/env')
@@ -79,7 +79,7 @@ const {
7979
t.plan(4)
8080
nock('https://skimdb.npmjs.com')
8181
.get('/registry')
82-
.reply(200, {update_seq: 5000})
82+
.reply(200, { update_seq: 5000 })
8383

8484
const client = redis.createClient()
8585
client.set('gk-seq', 4000, err => {
@@ -107,7 +107,7 @@ const {
107107
t.plan(5)
108108
nock('https://skimdb.npmjs.com')
109109
.get('/registry')
110-
.reply(200, {update_seq: 5000})
110+
.reply(200, { update_seq: 5000 })
111111

112112
const client = redis.createClient()
113113
client.set('gk-seq', 6000, err => {
@@ -182,7 +182,7 @@ const {
182182
next: '2.0.0-rc1'
183183
},
184184
versions: {
185-
'1.0.0': {gitHead: 'a213fe9c'},
185+
'1.0.0': { gitHead: 'a213fe9c' },
186186
'2.0.0-rc1': {}
187187
},
188188
registry: rawUrl
@@ -204,7 +204,7 @@ const {
204204
registry: {
205205
url,
206206
seqKey: 'gk-seq-2',
207-
query: {token: '1234'}
207+
query: { token: '1234' }
208208
}
209209
}, (err, changes) => {
210210
if (err) return t.ok(savedChanges.destroyed, 'destroyed')
@@ -213,7 +213,7 @@ const {
213213
db: url,
214214
since: 'now',
215215
include_docs: true,
216-
query_params: {token: '1234'}
216+
query_params: { token: '1234' }
217217
}, 'opts')
218218
changes.emit('error', new Error('restart'))
219219
})

0 commit comments

Comments
 (0)