peerigon / updtr

Update outdated npm modules with zero pain™

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updtr changes the specifity defined in `package.json`

cloudlena opened this issue · comments

After running updtr, some of the packages I had specified in my package.json have changed in their specifity. updtr has changed some of them to be more specific and some of them to be less specific as before. Here's the output of git diff package.json after running updtr:

     "extend": "^3.0.0",
-    "gulp-angular-templatecache": "^1.8.0",
+    "gulp-angular-templatecache": "^2.0.0",
     "gulp-autoprefixer": "^3.1.0",
     "gulp-bootlint": "^0.8.0",
-    "gulp-changed": "1.3.0",
+    "gulp-changed": "^1.3.2",
     "gulp-clean-css": "^2.0.4",
     "gulp-csso": "^2.0.0",
-    "gulp-header": "1.8.2",
-    "gulp-htmllint": "^0.0.8",
+    "gulp-header": "^1.8.2",
+    "gulp-htmllint": "0.0.8",
     "gulp-htmlmin": "^2.0.0",
     "gulp-typescript": "^2.7.5",
-    "gulp-uglify": "^1.1.0",
+    "gulp-uglify": "^2.0.0",
     "gulp-util": "^3.0.4",
     "inquirer": "^1.0.3",
-    "karma": "^0.13.19",
+    "karma": "^1.2.0",
     "karma-chai": "^0.1.0",
-    "karma-coverage": "1.1.0",
+    "karma-coverage": "^1.1.1",
     "karma-mocha": "^1.0.1",
-    "karma-mocha-reporter": "2.0.4",
+    "karma-mocha-reporter": "^2.1.0",
     "karma-ng-html2js-preprocessor": "^1.0.0"

For some of them it added a ^ and for some of them it removed it. I think we should have a flag that allows to either keep the existing specifity or replace it with the recommended one instead. By default, I would expect it to keep the existing specifity.

--save-exact ?

Thanks, @djhi but that's not what i mean. --save exact always overwrites with the most specific version possible (i.e. without any ~ or ^ prefixed). What I would expect on the other hand is that my current specifity is kept. That means:

  • if my version is prefixed with a ~, the ~ is still there after the upgrade
  • if my version is prefixed with a ^, the ^ is still there after the upgrade
  • if my version is not prefixed, it won't be prefixed after the upgrade
    and so on...

You can find all the different possibilities of how to specify version ranges in package.json here: https://docs.npmjs.com/files/package.json#dependencies.

I also have a quite similar problem : If the upgrade fails, the specifity is changed,

for example if I have :

"xmldom": "0.1.19",

do updtr, if it fails, it will look :

"xmldom": "^0.1.19",

which makes my test failing at the end.

Fixed with the rewrite