正在显示
1 个修改的文件
包含
19 行增加
和
17 行删除
... | ... | @@ -2,33 +2,35 @@ |
2 | 2 | // # app |
3 | 3 | |
4 | 4 | var express = require('express') |
5 | -var updateNotifier = require('update-notifier') | |
6 | 5 | var winstonRequestLogger = require('winston-request-logger') |
7 | 6 | var bootable = require('bootable') |
8 | 7 | var bootableEnvironment = require('bootable-environment') |
8 | +var _ = require('underscore') | |
9 | +var updateNotifier = require('update-notifier') | |
9 | 10 | var path = require('path') |
10 | -var pkg = require(path.join(__dirname, '..', 'package')) | |
11 | 11 | |
12 | 12 | exports = module.exports = function(logger, settings) { |
13 | 13 | |
14 | - // check for updates to igloo | |
15 | - if (settings.updateNotifier) { | |
16 | - | |
17 | - var notifier = updateNotifier({ | |
18 | - packageName: pkg.name, | |
19 | - packageVersion: pkg.version | |
20 | - }) | |
21 | - | |
22 | - if (notifier.update) | |
14 | + // check for updates to all packages when not in production | |
15 | + if (settings.updateNotifier.enabled) | |
16 | + _.each(settings.pkg.dependencies, function(version, name) { | |
17 | + var notifier = updateNotifier({ | |
18 | + packageName: name, | |
19 | + packageVersion: version, | |
20 | + optOut: settings.updateNotifier.dependencies[name] || false, | |
21 | + updateCheckInterval: settings.updateNotifier.updateCheckInterval | 1000 * 60 * 60, // hourly | |
22 | + updateCheckTimeout: settings.updateNotifier.updateCheckTimeout | 1000 * 20 // 20 seconds | |
23 | + }) | |
24 | + if (_.isUndefined(notifier.update)) return | |
23 | 25 | logger.warn( |
24 | - 'v%s of %s is now available (current: %s), run `npm update %s` to upgrade', | |
26 | + '%s of %s released (current: %s), run `npm install -S %s@%s` to upgrade', | |
25 | 27 | notifier.update.latest, |
26 | - pkg.version, | |
27 | - pkg.name, | |
28 | - pkg.name | |
28 | + name, | |
29 | + version, | |
30 | + name, | |
31 | + notifier.update.latest | |
29 | 32 | ) |
30 | - | |
31 | - } | |
33 | + }) | |
32 | 34 | |
33 | 35 | // create the app |
34 | 36 | var app = bootable(express()) | ... | ... |
请
注册
或
登录
后发表评论