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

devDependencies are saved as dependencies #13

Closed
BloodyHell opened this issue Dec 2, 2015 · 8 comments
Closed

devDependencies are saved as dependencies #13

BloodyHell opened this issue Dec 2, 2015 · 8 comments

Comments

@BloodyHell
Copy link

The following line of code presents line 92 of run.js, version 0.1.4:

info.saveCmd = info.type === "devDependencies" ? "--save-dev" : "--save";

If I follow the source correctly, this is used to make the difference between your dependencies being saved in devDependencies or dependencies.

But when I use the plugin all the dependencies are always placed in "dependencies", even if they are originally contained in "devDependencies".

In the test file there is also no mention of devDependencies 😄.

Anyone else facing the same issue that can confirm this? I'm at the moment unable to pull the code and add tests to check thoroughly.

@matthaias
Copy link
Member

With which version of npm? You need >= 2.5 since the package type was added to this version, should be listed in the package.json.

But yes, we should add tests to check this and maybe a check when starting updtr if the npm version is >= 2.5.

I did a short check:

➜ npm i servus.js@0.0.1 --save
updtrtest@0.0.1 
└── servus.js@0.0.1

➜ npm i xunit-file@0.0.1 --save-dev
updtrtest@0.0.1 
└── xunit-file@0.0.1

➜ updtr
Found 2 outdated modules

Starting to update your modules...
1/2      ● servus.js 0.0.2 success
2/2      ● xunit-file 0.0.9 success

Finished
➜ cat package.json
{
  "name": "updtr test",
  "version": "0.0.1",
  "description": "updtr test",
  "main": "index.js",
  "devDependencies": {
    "xunit-file": "0.0.9"
  },
  "scripts": {
    "test": "mocha -R spec"
  },
  "dependencies": {
    "servus.js": "0.0.2"
  }
}

So for me this works. Can you please check your npm version?

@BloodyHell
Copy link
Author

My bad, checked the npm version and it was sorely outdated.
After updating to >= 2.5 Updtr works just fine. Thanks! 👍

@fkrauthan
Copy link

Can we reopen this issue? I run into exactly the same issue. I am using updtr version 0.2.1, npm version 3.8.6 and node version 5.11.1

When I run updtr it moves devDependencies into dependencies

@matthaias
Copy link
Member

Sure. I hope we can check this soon enough.

@matthaias matthaias reopened this Jul 14, 2016
@fkrauthan
Copy link

Sorry it not moves it it just re adds them as regular dependency. So devDependency contains the old version dependencies contains the new version.

@matthaias
Copy link
Member

Good to know.

@matthaias
Copy link
Member

@fkrauthan i still can't reproduce this behavior, sorry. Can you please to check it again? Otherwise i would be happy to receive a pull request solving this problem. Thanks?

@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 jhnns closed this as completed Mar 25, 2018
@jhnns
Copy link
Member

jhnns commented Mar 25, 2018

Has been fixed with the rewrite

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