dpa99c / cordova-check-plugins

A CLI tool to check for / manage plugin updates in Cordova/Phonegap projects.
216 stars 25 forks source link

cordova-check-plugins --update=auto is mess up with plugins #35

Closed almothafar closed 5 years ago

almothafar commented 5 years ago

I just installed this module, and seems not working well, even with issues like #34 I got another strange issues with module messing up the project.

I got the following plugins in config:

    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.3" />
    <plugin name="cordova-plugin-file" spec="^6.0.1" />
    <plugin name="cordova-plugin-file-opener2" spec="^2.1.4">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-x-toast" spec="^2.7.2" />
    <plugin name="cordova-plugin-app-version" spec="~0.1.9" />
    <plugin name="cordova-plugin-ionic-webview" spec="~3.1.2">
        <variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
    </plugin>
    <engine name="android" spec="7.1.4" />
    <engine name="ios" spec="5.0.0" />

And in package.json:

  "dependencies": {
    "cordova-android": "7.1.4",
    "cordova-ios": "5.0.0",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "6.0.1",
    "cordova-plugin-file-opener2": "^2.1.4",
    "cordova-plugin-inappbrowser": "^3.0.0",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-toast": "2.7.2"
  },
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ],
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-statusbar": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-opener2": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-x-toast": {},
      "cordova-plugin-app-version": {}
    }
  }

After I ran cordova-check-plugins --update=auto many times, I found that the project broken, I saw that the command downgraded cordova-plugin-ionic-webview to 3.1.0 and removed cordova-plugin-file-opener2 at all, from package.json and config.xml.

This should not be happening, also until now, it detects only version 3.1.0 for cordova-plugin-ionic-webview:

plugin: cordova-plugin-ionic-webview
source: npm://cordova-plugin-ionic-webview@3.1.0
installed version: 3.1.0
remote version: 3.1.0

I only run cordova-check-plugins --update=auto or cordova-check-plugins --update=auto --verbose nothing else added

dpa99c commented 5 years ago

This tool uses existing Cordova CLI commands such as cordova plugin rm cordova-plugin-ionic-webview and cordova plugin add cordova-plugin-ionic-webview so if your config.xml and package.json have got corrupted, it's because Cordova corrupted them, not this tool.

As such, there's nothing this tool can do to affect do how Cordova modifies the config.xml and package.json files, so closing this issue.

Check your plugins/fetch.json as this can get corrupted by Cordova during plugin installation/removal.