@oclif/plugin-warn-if-update-available
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -1,1 +0,1 @@ | ||
{"version":"1.3.1","commands":{}} | ||
{"version":"1.3.2","commands":{}} |
@@ -0,1 +1,9 @@ | ||
<a name="1.3.2"></a> | ||
## [1.3.2](https://github.com/oclif/plugin-warn-if-update-available/compare/v1.3.1...v1.3.2) (2018-04-20) | ||
### Bug Fixes | ||
* always pull new version when current changes ([f4e5f93](https://github.com/oclif/plugin-warn-if-update-available/commit/f4e5f93)) | ||
<a name="1.3.1"></a> | ||
@@ -2,0 +10,0 @@ ## [1.3.1](https://github.com/oclif/plugin-warn-if-update-available/compare/v1.3.0...v1.3.1) (2018-04-18) |
@@ -13,9 +13,9 @@ "use strict"; | ||
} | ||
async function run(name, file) { | ||
async function run(name, file, version) { | ||
await touch(file); | ||
const { body } = await http_call_1.default.get(`https://registry.npmjs.org/${name.replace('/', '%2f')}`, { timeout: 5000 }); | ||
await fs.outputJSON(file, body['dist-tags']); | ||
await fs.outputJSON(file, Object.assign({}, body['dist-tags'], { current: version })); | ||
process.exit(0); | ||
} | ||
run(process.argv[2], process.argv[3]) | ||
run(process.argv[2], process.argv[3], process.argv[4]) | ||
.catch(require('@oclif/errors/handle')); |
@@ -13,2 +13,6 @@ "use strict"; | ||
const distTags = await fs.readJSON(file); | ||
if (config.version.includes('-')) { | ||
// TODO: handle channels | ||
return; | ||
} | ||
if (distTags && distTags.latest && semver.gt(distTags.latest.split('-')[0], config.version.split('-')[0])) { | ||
@@ -27,6 +31,9 @@ const chalk = require('chalk'); | ||
const cfg = config.pjson.oclif['warn-if-update-available'] || {}; | ||
const timeoutInDays = cfg.timeoutInDays || 7; | ||
const timeoutInDays = cfg.timeoutInDays || 60; | ||
const { mtime } = await fs.stat(file); | ||
const staleAt = new Date(mtime.valueOf() + 1000 * 60 * 60 * 24 * timeoutInDays); | ||
return staleAt < new Date(); | ||
if (staleAt < new Date()) | ||
return true; | ||
const versions = await fs.readJSON(file); | ||
return !versions.current || versions.current !== config.version; | ||
} | ||
@@ -40,3 +47,3 @@ catch (err) { | ||
debug('spawning version refresh'); | ||
child_process_1.spawn(process.execPath, [path.join(__dirname, '../../../lib/get_version'), config.name, file], { | ||
child_process_1.spawn(process.execPath, [path.join(__dirname, '../../../lib/get_version'), config.name, file, config.version], { | ||
detached: !config.windows, | ||
@@ -43,0 +50,0 @@ stdio: 'ignore', |
{ | ||
"name": "@oclif/plugin-warn-if-update-available", | ||
"description": "warns if there is a newer version of CLI released", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/plugin-warn-if-update-available/issues", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11973
83