apache / apache/cordova-cli

Is plugin removal broken when there are plugin dependencies?

Open
#548 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
967
Forks
344
Avg merge
8h 41m
Merged PRs (30d)
9

Description

# Bug Report

Something seems to have changed in cordova 10 with respect to `cordova plugin remove` when there are dependencies. This new behavior makes it difficult for plugin authors to easily remove and then re-add (linked) a plugin when we need to make changes.

## Problem

`cordova plugin remove --nosave xxx` used to remove a plugin, even if there were dependencies involved, but it now, even if you use `--force` it sometimes fails to get the job done, leaving some dependencies installed, as well as the main plugin itself.

It goes without saying that, if it hasn't removed, I cannot attempt to do `cordova plugin add --link --nosave xxx` as my next step.

### What is expected to happen?

It would be nice for `remove` followed by `add --link` to work even when there are dependencies, but I'd be happy enough if they just operated on the main plugin and ignored the dependencies.

### What does actually happen?

Removal seems to partially fail (I haven't figured out if it is only when plugin dependencies have dependencies themselves, so I'll have to do more testing).

## Information

For example:

npx cordova plugin remove --nosave @company/cordova-plugin-pushaaaa --force

Results in:

npx cordova plugin remove -d --nosave @company/cordova-plugin-pushaaaa --force
No scripts found for hook "before_plugin_rm".
Calling plugman.uninstall on plugin "@company/cordova-plugin-pushaaaa" for platform "android"
Uninstalling 4 dependent plugins.
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-devicedata on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-devicedata from android
Platform API successfully found in: /Users/tamburro/cm/ms-mobile/native/cordova/platforms/android/cordova/Api.js
Beginning processing of action stack for android project...
Action stack processing complete.
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-dialphonenumber on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-dialphonenumber from android
Beginning processing of action stack for android project...
Action stack processing complete.
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-rrr on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-rrr from android
Beginning processing of action stack for android project...
Uninstalling Android library: src/android/build-extras.gradle
Uninstalling Android library: com.google.android.gms:play-services-safetynet:17.0.0
Uninstalling Android library: com.google.android.gms:play-services-gcm:17.0.0
Action stack processing complete.
Updating build files since android plugin contained
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: @company/cordova-plugin-gradlemodule/mobile-mscordova
Subproject Path: @company/cordova-plugin-checkcapture/mobile-mmm
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-vvv on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-vvv from android
Beginning processing of action stack for android project...
Uninstalling Android library: src/android/build-extras.gradle
Action stack processing complete.
Updating build files since android plugin contained
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: @company/cordova-plugin-gradlemodule/mobile-mscordova
Subproject Path: @company/cordova-plugin-checkcapture/mobile-mmm
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-pushaaaa on android platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-pushaaaa from android
Beginning processing of action stack for android project...
Action stack processing complete.
Calling plugman.uninstall on plugin "@company/cordova-plugin-pushaaaa" for platform "ios"
The plugin '@company/cordova-plugin-pushaaaa' is required by (@company/cordova-plugin-deviceregistration) but forcing removal
Finding scripts for "before_plugin_uninstall" hook from plugin @company/cordova-plugin-pushaaaa on ios platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling @company/cordova-plugin-pushaaaa from ios
Platform API successfully found in: /Users/tamburro/cm/ms-mobile/native/cordova/platforms/ios/cordova/Api.js
Beginning processing of action stack for ios project...
Action stack processing complete.
Removing Bridging-Headers since the plugin contained with type="BridgingHeader"
pods.json found in platforms/ios
Podfile found in platforms/ios
Removing "@company/cordova-plugin-pushaaaa"
Plugin "@company/cordova-plugin-deviceplugin" is required by (@company/cordova-plugin-mobileanalytics, @company/cordova-plugin-actionsheet, @company/cordova-plugin-activityview, @company/cordova-plugin-adbmobile, @company/cordova-plugin-updater, @company/cordova-plugin-application, @company/cordova-plugin-applicationcache, @company/cordova-plugin-appstore, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-bitly, @company/cordova-plugin-checkcapture, @company/cordova-plugin-contacts, @company/cordova-plugin-credentials, @company/cordova-plugin-datepicker, @company/cordova-plugin-deviceangle, @company/cordova-plugin-deviceregistration, @company/cordova-plugin-emulatorbbbbbbbb, @company/cordova-plugin-filepicker, @company/cordova-plugin-forcetouchquickactions, @company/cordova-plugin-map, @company/cordova-plugin-notification, @company/cordova-plugin-places, @company/cordova-plugin-reload, @company/cordova-plugin-safearea, @company/cordova-plugin-shim, @company/cordova-plugin-touchid, @company/cordova-plugin-userdefaults, @company/cordova-plugin-viewbbbbbbbbmodal, @company/cordova-plugin-yubikit, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-q" is required by (@company/cordova-plugin-mobileanalytics, @company/cordova-plugin-actionsheet, @company/cordova-plugin-activityview, @company/cordova-plugin-adbmobile, @company/cordova-plugin-updater, @company/cordova-plugin-application, @company/cordova-plugin-applicationcache, @company/cordova-plugin-appstore, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-bitly, @company/cordova-plugin-checkcapture, @company/cordova-plugin-contacts, @company/cordova-plugin-credentials, @company/cordova-plugin-datepicker, @company/cordova-plugin-deviceangle, @company/cordova-plugin-deviceregistration, @company/cordova-plugin-emulatorbbbbbbbb, @company/cordova-plugin-filepicker, @company/cordova-plugin-forcetouchquickactions, @company/cordova-plugin-map, @company/cordova-plugin-notification, @company/cordova-plugin-places, @company/cordova-plugin-reload, @company/cordova-plugin-safearea, @company/cordova-plugin-shim, @company/cordova-plugin-touchid, @company/cordova-plugin-userdefaults, @company/cordova-plugin-viewbbbbbbbbmodal, @company/cordova-plugin-yubikit, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-devicedata" is required by (@company/cordova-plugin-adbmobile, @company/cordova-plugin-deviceregistration, @company/cordova-plugin-touchid) but forcing removal.
Plugin "@company/cordova-plugin-utils" is required by (@company/cordova-plugin-mobileanalytics, @company/cordova-plugin-activityview, @company/cordova-plugin-adbmobile, @company/cordova-plugin-applicationcache, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-bitly, @company/cordova-plugin-checkcapture, @company/cordova-plugin-deviceregistration, @company/cordova-plugin-emulatorbbbbbbbb, @company/cordova-plugin-filepicker, @company/cordova-plugin-map, @company/cordova-plugin-notification, @company/cordova-plugin-places, @company/cordova-plugin-safearea, @company/cordova-plugin-shim, @company/cordova-plugin-touchid, @company/cordova-plugin-userdefaults, @company/cordova-plugin-viewbbbbbbbbmodal, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-deeplinkstore" is required by (@wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-globaldata" is required by (@company/cordova-plugin-adbmobile, @company/cordova-plugin-applicationcache, @company/cordova-plugin-touchid, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-plist" is required by (@company/cordova-plugin-adbmobile, @company/cordova-plugin-applicationcache, @company/cordova-plugin-touchid, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-dialphonenumber" is required by (@company/cordova-plugin-deviceregistration) but forcing removal.
Plugin "@company/cordova-plugin-pub" is required by (@company/cordova-plugin-activityview, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "cordova-plugin-whitelist" is required by (@company/cordova-plugin-activityview, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-cp" is required by (@company/cordova-plugin-activityview, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-bbb" is required by (@company/cordova-plugin-activityview, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-ttttttt" is required by (@company/cordova-plugin-activityview, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-analytics" is required by (@company/cordova-plugin-mobileanalytics, @company/cordova-plugin-activityview, @company/cordova-plugin-adbmobile, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-bitly, @company/cordova-plugin-checkcapture, @company/cordova-plugin-emulatorbbbbbbbb, @company/cordova-plugin-map, @company/cordova-plugin-places, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobilesettings) but forcing removal.
Plugin "@company/cordova-plugin-rrr" is required by (@company/cordova-plugin-deviceregistration) but forcing removal.
Plugin "@company/cordova-plugin-locationhelper" is required by (@company/cordova-plugin-places) but forcing removal.
Plugin "@company/cordova-plugin-patches" is required by (@company/cordova-plugin-mobileanalytics, @company/cordova-plugin-actionsheet, @company/cordova-plugin-activityview, @company/cordova-plugin-adbmobile, @company/cordova-plugin-updater, @company/cordova-plugin-application, @company/cordova-plugin-applicationcache, @company/cordova-plugin-appstore, @company/cordova-plugin-binaryviewer, @company/cordova-plugin-bitly, @company/cordova-plugin-checkcapture, @company/cordova-plugin-contacts, @company/cordova-plugin-credentials, @company/cordova-plugin-datepicker, @company/cordova-plugin-deviceangle, @company/cordova-plugin-deviceregistration, @company/cordova-plugin-emulatorbbbbbbbb, @company/cordova-plugin-filepicker, @company/cordova-plugin-forcetouchquickactions, @company/cordova-plugin-gradlemodule, @company/cordova-plugin-map, @company/cordova-plugin-notification, @company/cordova-plugin-places, @company/cordova-plugin-reload, @company/cordova-plugin-safearea, @company/cordova-plugin-shim, @company/cordova-plugin-touchid, @company/cordova-plugin-userdefaults, @company/cordova-plugin-viewbbbbbbbbmodal, @company/cordova-plugin-yubikit, @wmclientonline/cordova-plugin-mobileanalytics, @wmclientonline/cordova-plugin-mobiledeeplink, @wmclientonline/cordova-plugin-mobilesettings, @wmclientonline/cordova-plugin-mobiletestharness) but forcing removal.
Plugin "@company/cordova-plugin-vvv" is required by (@company/cordova-plugin-deviceregistration) but forcing removal.
Plugin "@company/cordova-plugin-pushaaaa" is required by (@company/cordova-plugin-deviceregistration) but forcing removal.
Deleted plugin "@company/cordova-plugin-deviceplugin"
Running command: npm uninstall @company/cordova-plugin-deviceplugin --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-deviceplugin,--no-save
Deleted plugin "@company/cordova-plugin-q"
Running command: npm uninstall @company/cordova-plugin-q --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-q,--no-save
Deleted plugin "@company/cordova-plugin-devicedata"
Running command: npm uninstall @company/cordova-plugin-devicedata --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-devicedata,--no-save
Deleted plugin "@company/cordova-plugin-utils"
Running command: npm uninstall @company/cordova-plugin-utils --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-utils,--no-save
Deleted plugin "@company/cordova-plugin-deeplinkstore"
Running command: npm uninstall @company/cordova-plugin-deeplinkstore --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-deeplinkstore,--no-save
Deleted plugin "@company/cordova-plugin-globaldata"
Running command: npm uninstall @company/cordova-plugin-globaldata --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-globaldata,--no-save
Deleted plugin "@company/cordova-plugin-plist"
Running command: npm uninstall @company/cordova-plugin-plist --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-plist,--no-save
Deleted plugin "@company/cordova-plugin-dialphonenumber"
Running command: npm uninstall @company/cordova-plugin-dialphonenumber --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-dialphonenumber,--no-save
Deleted plugin "@company/cordova-plugin-pub"
Running command: npm uninstall @company/cordova-plugin-pub --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-pub,--no-save
Deleted plugin "cordova-plugin-whitelist"
Running command: npm uninstall cordova-plugin-whitelist --no-save
Command finished with error code 0: npm uninstall,cordova-plugin-whitelist,--no-save
Deleted plugin "@company/cordova-plugin-cp"
Running command: npm uninstall @company/cordova-plugin-cp --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-cp,--no-save
Deleted plugin "@company/cordova-plugin-bbb"
Running command: npm uninstall @company/cordova-plugin-bbb --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-bbb,--no-save
Deleted plugin "@company/cordova-plugin-ttttttt"
Running command: npm uninstall @company/cordova-plugin-ttttttt --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-ttttttt,--no-save
Deleted plugin "@company/cordova-plugin-analytics"
Running command: npm uninstall @company/cordova-plugin-analytics --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-analytics,--no-save
Deleted plugin "@company/cordova-plugin-rrr"
Running command: npm uninstall @company/cordova-plugin-rrr --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-rrr,--no-save
Deleted plugin "@company/cordova-plugin-locationhelper"
Running command: npm uninstall @company/cordova-plugin-locationhelper --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-locationhelper,--no-save
Deleted plugin "@company/cordova-plugin-patches"
Running command: npm uninstall @company/cordova-plugin-patches --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-patches,--no-save
Deleted plugin "@company/cordova-plugin-vvv"
Running command: npm uninstall @company/cordova-plugin-vvv --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-vvv,--no-save
Deleted plugin "@company/cordova-plugin-pushaaaa"
Running command: npm uninstall @company/cordova-plugin-pushaaaa --no-save
Command finished with error code 0: npm uninstall,@company/cordova-plugin-pushaaaa,--no-save
Removing plugin @company/cordova-plugin-pushaaaa from fetch.json
No scripts found for hook "after_plugin_rm".

### Command or Code

npx cordova plugin remove --nosave @company/cordova-plugin-pushaaaa --force

(reluctantly using --force)

### Environment, Platform, Device

macOS 10.15.7

### Version information

cordova 10

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start with the `cordova plugin remove` entry point and the `plugman.uninstall` calls shown in the Android and iOS logs. Reproduce the dependency case with `--nosave` and `--force`, then compare whether the main plugin and its dependencies are removed consistently. Done means removal completes reliably and permits the subsequent `cordova plugin add --link --nosave` operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.