npm-upgrade
Advanced tools
Comparing version
@@ -87,3 +87,3 @@ #! /usr/bin/env node | ||
(function main() { | ||
var packageFile, packageJson, depsGroupsToCheck, depsGroupsToCheckStr, updatedModules, updatedTable, packageUpdated, outdatedModule, _name, from, to, changelogUrl, homepage, answer, shouldUpdatePackageFile; | ||
var packageFile, packageJson, depsGroupsToCheck, depsGroupsToCheckStr, updatedModules, updatedTable, packageUpdated, isUpdateFinished, outdatedModule, _name, from, to, changelogUrl, homepage, answer, shouldUpdatePackageFile; | ||
@@ -159,4 +159,5 @@ return _regeneratorRuntime.async(function main$(context$1$0) { | ||
packageUpdated = false; | ||
isUpdateFinished = false; | ||
case 17: | ||
case 18: | ||
outdatedModule = updatedModules.shift(); | ||
@@ -171,3 +172,3 @@ _name = outdatedModule.name; | ||
context$1$0.next = 26; | ||
context$1$0.next = 27; | ||
return _regeneratorRuntime.awrap(_askUser2['default']({ | ||
@@ -180,3 +181,3 @@ type: 'list', | ||
// Show this if we haven't found changelog | ||
changelogUrl === null && homepage !== null && { name: 'Open homepage', value: 'homepage' }]), | ||
changelogUrl === null && homepage !== null && { name: 'Open homepage', value: 'homepage' }, { name: 'Finish update process', value: 'finish' }]), | ||
// Automatically setting cursor to "Open homepage" after we haven't found changelog | ||
@@ -186,9 +187,9 @@ 'default': changelogUrl === null && homepage === undefined ? 2 : 0 | ||
case 26: | ||
case 27: | ||
answer = context$1$0.sent; | ||
context$1$0.t0 = answer; | ||
context$1$0.next = context$1$0.t0 === 'changelog' ? 30 : context$1$0.t0 === 'homepage' ? 38 : context$1$0.t0 === true ? 47 : 50; | ||
context$1$0.next = context$1$0.t0 === 'changelog' ? 31 : context$1$0.t0 === 'homepage' ? 39 : context$1$0.t0 === 'finish' ? 48 : context$1$0.t0 === true ? 50 : 53; | ||
break; | ||
case 30: | ||
case 31: | ||
// Ask user about this module again | ||
@@ -198,3 +199,3 @@ updatedModules.unshift(outdatedModule); | ||
if (!(changelogUrl === undefined)) { | ||
context$1$0.next = 36; | ||
context$1$0.next = 37; | ||
break; | ||
@@ -204,9 +205,9 @@ } | ||
console.log('Trying to find changelog URL...'); | ||
context$1$0.next = 35; | ||
context$1$0.next = 36; | ||
return _regeneratorRuntime.awrap(_changelogUtils.findModuleChangelogUrl(_name, DEFAULT_REMOTE_CHANGELOGS_DB_URL)); | ||
case 35: | ||
case 36: | ||
changelogUrl = outdatedModule.changelogUrl = context$1$0.sent; | ||
case 36: | ||
case 37: | ||
@@ -219,5 +220,5 @@ if (changelogUrl) { | ||
} | ||
return context$1$0.abrupt('break', 50); | ||
return context$1$0.abrupt('break', 53); | ||
case 38: | ||
case 39: | ||
// Ask user about this module again | ||
@@ -227,3 +228,3 @@ updatedModules.unshift(outdatedModule); | ||
if (!(homepage === undefined)) { | ||
context$1$0.next = 45; | ||
context$1$0.next = 46; | ||
break; | ||
@@ -233,10 +234,10 @@ } | ||
console.log('Trying to find homepage URL...'); | ||
context$1$0.next = 43; | ||
context$1$0.next = 44; | ||
return _regeneratorRuntime.awrap(_packageUtils.getModuleInfo(_name)); | ||
case 43: | ||
case 44: | ||
context$1$0.t1 = context$1$0.sent; | ||
homepage = outdatedModule.homepage = _packageUtils.getModuleHomepage(context$1$0.t1); | ||
case 45: | ||
case 46: | ||
@@ -249,16 +250,20 @@ if (homepage) { | ||
} | ||
return context$1$0.abrupt('break', 50); | ||
return context$1$0.abrupt('break', 53); | ||
case 47: | ||
case 48: | ||
isUpdateFinished = true; | ||
return context$1$0.abrupt('break', 53); | ||
case 50: | ||
packageUpdated = true; | ||
_packageUtils.setModuleVersion(_name, to, packageJson); | ||
return context$1$0.abrupt('break', 50); | ||
return context$1$0.abrupt('break', 53); | ||
case 50: | ||
if (updatedModules.length) { | ||
context$1$0.next = 17; | ||
case 53: | ||
if (updatedModules.length && !isUpdateFinished) { | ||
context$1$0.next = 18; | ||
break; | ||
} | ||
case 51: | ||
case 54: | ||
@@ -269,3 +274,3 @@ // Adds new line | ||
if (!packageUpdated) { | ||
context$1$0.next = 61; | ||
context$1$0.next = 64; | ||
break; | ||
@@ -276,6 +281,6 @@ } | ||
console.log('New package.json:\n\n' + packageJson + '\n'); | ||
context$1$0.next = 57; | ||
context$1$0.next = 60; | ||
return _regeneratorRuntime.awrap(_askUser2['default']({ type: 'confirm', message: 'Update package.json?', 'default': true })); | ||
case 57: | ||
case 60: | ||
shouldUpdatePackageFile = context$1$0.sent; | ||
@@ -287,9 +292,9 @@ | ||
} | ||
context$1$0.next = 62; | ||
context$1$0.next = 65; | ||
break; | ||
case 61: | ||
case 64: | ||
console.log('Nothing to update'); | ||
case 62: | ||
case 65: | ||
case 'end': | ||
@@ -296,0 +301,0 @@ return context$1$0.stop(); |
{ | ||
"name": "npm-upgrade", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "Interactive CLI utility to easily update outdated NPM dependencies", | ||
@@ -35,3 +35,3 @@ "author": "Yuriy Grunin <grunin.ya@ya.ru>", | ||
"npm": "^3.5.1", | ||
"npm-check-updates": "2.5.4", | ||
"npm-check-updates": "2.7.2", | ||
"opener": "1.4.1" | ||
@@ -38,0 +38,0 @@ }, |
# npm-upgrade | ||
Interactive CLI utility to easily update outdated NPM dependencies | ||
Interactive CLI utility to easily update outdated NPM dependencies with changelogs inspection support. | ||
@@ -4,0 +4,0 @@ [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] |
@@ -99,2 +99,3 @@ #! /usr/bin/env node | ||
let packageUpdated = false; | ||
let isUpdateFinished = false; | ||
do { | ||
@@ -118,3 +119,4 @@ const outdatedModule = updatedModules.shift(); | ||
(changelogUrl === null && homepage !== null) && | ||
{ name: 'Open homepage', value: 'homepage' } | ||
{ name: 'Open homepage', value: 'homepage' }, | ||
{ name: 'Finish update process', value: 'finish' } | ||
]), | ||
@@ -164,2 +166,6 @@ // Automatically setting cursor to "Open homepage" after we haven't found changelog | ||
case 'finish': | ||
isUpdateFinished = true; | ||
break; | ||
case true: | ||
@@ -171,3 +177,3 @@ packageUpdated = true; | ||
} while (updatedModules.length); | ||
} while (updatedModules.length && !isUpdateFinished); | ||
@@ -174,0 +180,0 @@ // Adds new line |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
47525
1.14%905
1%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated