Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updtr changes the specifity defined in package.json #47

Closed
cloudlena opened this issue Aug 19, 2016 · 4 comments
Closed

Updtr changes the specifity defined in package.json #47

cloudlena opened this issue Aug 19, 2016 · 4 comments

Comments

@cloudlena
Copy link

cloudlena commented Aug 19, 2016

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.

@djhi
Copy link
Contributor

djhi commented Aug 21, 2016

--save-exact ?

@cloudlena
Copy link
Author

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.

@edi9999
Copy link

edi9999 commented Dec 4, 2016

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.

@jhnns jhnns mentioned this issue Apr 25, 2017
jhnns added a commit that referenced this issue May 8, 2017
### Changes

- A batch update is attempted for all **non-breaking** updates according to semver
- All **breaking** updates are still performed in a sequential manner
- If the batch update fails, the failed update tasks are performed sequentially to find out, which module was breaking
- During a rollback, the next module update is installed in parallel
- The `package.json` is now written in the end after the whole operation
- The updtr tries to preserve the semver range style. If the style can not be preserved, it falls back to caret ranges.
- This behavior can be changed by specifying a `--save` option
- By specifying the `update-to=non-breaking` option, you can now choose to install non-breaking updates. It replaces the old `--wanted` flag
- Re-design of the default reporter (it's now called `dense`)
- Missing dependencies are now installed automatically before running `npm outdated`

### Fixes

- Fixes #14 #47 #46 #13 #51 #58
- Provides a workaround for #48 by sorting all dependencies

BREAKING CHANGE: New and changed CLI options

``` 
  --use, -u             Specify the package manager to use  [choices: "npm", "yarn"] [default: "npm"]
  --exclude, --ex       Space separated list of module names that should not be updated  [array]
  --update-to, --to     Specify which updates you want to install  [choices: "latest", "non-breaking", "wanted"] [default: "latest"]
  --save, -s            Specify how updated versions should be saved to the package.json  [choices: "smart", "caret", "exact"] [default: "smart"]
  --reporter, -r        Choose a reporter for the console output  [choices: "dense", "none"] [default: "dense"]
  --test, -t            Specify a custom test command. Surround with quotes.
  --test-stdout, --out  Show test stdout if the update fails  [boolean]
  --registry, --reg     Specify a custom registry to use
  --version             Show version number  [boolean]
  --help                Show help  [boolean]
```
@jhnns
Copy link
Member

jhnns commented Mar 25, 2018

Fixed with the rewrite

@jhnns jhnns closed this as completed Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants