trayvon2017 opened a new issue, #629:
URL: https://github.com/apache/cordova-cli/issues/629

   # Bug Report
   
   ## Problem
   I want to do something after plugin is removed.
   I have tried to use `after_plugin_rm` hook in "plugin.xml" but it did not 
work.
   ### What is expected to happen?
   
   Script for `after_plugin_rm` need to be executed
   
   ### What does actually happen?
   
   No scripts found for hook `after_plugin_rm`
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   
   Scripts for hooks(`after_plugin_add` 、 `before_plugin_rm` and 
`before_plugin_uninstall`) are all  performed normally.
   After removing the plugin, the commandline outputs 'No scripts found for 
hook "after_plugin_rm"'
   
   I built a [simple cordova plugin 
repository](https://github.com/trayvon2017/plugindemo.git) for test.
   
   #### add plugin
   `cordova plugin add https://github.com/trayvon2017/plugindemo.git`
   outputs:
   ```shell
   Installing "com.trayvon2017.plugindemo" for android
   Installing "com.trayvon2017.plugindemo" for ios
   Adding com.trayvon2017.plugindemo to package.json
   after_plugin_add waited 1004 ms
   ```
   #### remove plugin
   `cordova plugin remove com.trayvon2017.plugindemo --verbose`
   outputs:
   ```shell
   Executing script found in plugin com.trayvon2017.plugindemo for hook 
"before_plugin_rm": 
plugins/com.trayvon2017.plugindemo/scripts/before_plugin_rm.js
   before_plugin_rm waited 1003 ms
   Calling plugman.uninstall on plugin "com.trayvon2017.plugindemo" for 
platform "android"
   Finding scripts for "before_plugin_uninstall" hook from plugin 
com.trayvon2017.plugindemo on android platform only.
   Executing script found in plugin com.trayvon2017.plugindemo for hook 
"before_plugin_uninstall": 
plugins/com.trayvon2017.plugindemo/scripts/before_plugin_uninstall.js
   before_plugin_uninstall waited 1003 ms
   Uninstalling com.trayvon2017.plugindemo from android
   Loaded API for android project 
/Users/trayvon/code/cordova-projects/hello/platforms/android/cordova/Api.js
   Beginning processing of action stack for android project...
   Action stack processing complete.
   Calling plugman.uninstall on plugin "com.trayvon2017.plugindemo" for 
platform "ios"
   Finding scripts for "before_plugin_uninstall" hook from plugin 
com.trayvon2017.plugindemo on ios platform only.
   No scripts found for hook "before_plugin_uninstall".
   Uninstalling com.trayvon2017.plugindemo from ios
   Loaded API for ios project 
/Users/trayvon/code/cordova-projects/hello/platforms/ios/cordova/Api.js
   Beginning processing of action stack for ios project...
   Action stack processing complete.
   pods.json found in platforms/ios
   Podfile found in platforms/ios
   Removing "com.trayvon2017.plugindemo"
   Deleted plugin "com.trayvon2017.plugindemo"
   Running command: npm uninstall com.trayvon2017.plugindemo --save-dev
   Command finished with error code 0: npm 
uninstall,com.trayvon2017.plugindemo,--save-dev
   Removing com.trayvon2017.plugindemo from package.json
   Removing plugin com.trayvon2017.plugindemo from fetch.json
   No scripts found for hook "after_plugin_rm".
   ```
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   The full plugin code is [here](https://github.com/trayvon2017/plugindemo.git)
   
   Partial code in plugin.xml
   ```xml
   <plugin id="com.trayvon2017.plugindemo" version="1.0.0" 
xmlns="http://apache.org/cordova/ns/plugins/1.0"; 
xmlns:android="http://schemas.android.com/apk/res/android";>
        ...
        <platform name="android">
                   <hook type="after_plugin_add" 
src="scripts/after_plugin_add.js" />
                <hook type="before_plugin_rm" src="scripts/before_plugin_rm.js" 
/>
                <hook type="before_plugin_uninstall" 
src="scripts/before_plugin_uninstall.js" />
                <hook type="after_plugin_rm" src="scripts/after_plugin_rm.js" />
           ...
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Cordova CLI: 11.0.0 and 12.0.0
   Cordova Platforms: android
   Operating System: macos 13.5.2
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to