Ionic-CLI does not pass --nosave flag to Cordova-CLI

If I run following command:

$ ionic cordova platform add ios --nosave

The ‘–nosave’ flag won’t be passed to the Cordova-CLI and therefore, package.json and config.xml files are updated.

Command output is as followed:

> cordova platform add ios --save
Using cordova-fetch for cordova-ios@~4.5.4
...

Versions installed:

cli packages: (/node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.0.1
Cordova Platforms  : ios 4.5.4
Ionic Framework    : ionic-angular 3.8.0

System:

ios-deploy : 1.9.2
ios-sim    : 6.1.1
Node       : v7.10.1
npm        : 4.1.2
OS         : macOS Sierra
Xcode      : Xcode 9.1 Build version 9B55

Is this behavior intended or a bug? If intended, how can I prevent changes on config.xml and package.json?

Why do you want to install a platform, but not save the information that you did so?

If this really is a bug and --nosave should work (is it a documented parameter of the Ionic CLI?) then you should create a Github issue for ionic-cli.

I fix all my dependency versions in package.json and config.xml (no leading ‘^’ or ‘~’), to have full control over updates.

If I run ionic cordova platform add, cordova and/or ionic will write different versions into package.json and config.xml.

package.json entry before running command (just one example, there are a lot other dependencies that are changed automatically as well):
“cordova-ios”: “4.5.3”,

and after:
“cordova-ios”: “~4.5.4”,

I don’t want those automatic version changes due to possible incompatibility between different dependencies and therefore breaking builds. I want full control over my dependency versions.

The cordova CLI knows a --nosave flag exactly for this purpose: https://cordova.apache.org/docs/en/latest/reference/cordova-cli/#cordova-platform-command

This parameter is not documented in the Ionic CLI, but if i run

ionic cordova platform add --help

i see following hint:

    Like running cordova platform directly, but adds default Ionic icons and splash screen resources (during add) and
    provides friendly checks.

and therefore, I assume Ionic will pass all CLI-Parameters to the Cordova-CLI, what is not the case in this example.

If you install cordova-ios 4.5.4 you should not have 4.5.3 in your package.json.

For saving the exact version of cordova-ios you install I think there was a feature added to Cordova - I am not sure if it was released yet.

I assume Ionic will pass all CLI-Parameters to the Cordova-CLI, what is not the case in this example.

As I said, open a Github issue if you think this is a bug.

Looks like this was added as an issue to the github project and fixed, but it still isn’t working for me: