cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CB-12705) Project *_plugin_install hooks don't have information on installed plugin
Date Thu, 27 Apr 2017 05:07:04 GMT


ASF GitHub Bot commented on CB-12705:

Github user feichngr commented on a diff in the pull request:
    --- Diff: cordova-lib/src/hooks/HooksRunner.js ---
    @@ -178,7 +178,9 @@ function runScriptViaModuleLoader(script, context) {
         var scriptFn = require(script.fullPath);
         context.scriptLocation = script.fullPath;
    -    context.opts.plugin = script.plugin;
    +    if(script.plugin) {
    +        context.opts.plugin = script.plugin;
    --- End diff --
    Yes and no. cordova-lib/src/plugman/install.js already populates `opts.plugin` before
it is passed to `HooksRunner`.
    What currently happens in this code snippet is that the field is overridden with either
information on the plugin which provides the script (i.e. the on in which `plugin.xml` it
is defined) or `undefined` if the script is part of the project (i.e. defined in config.xml)
because `script.plugin` is `undefined`.
    My change just prevents the override in the later case. The first case should behave as
before so it doesn't break existing scripts.

> Project *_plugin_install hooks don't have information on installed plugin
> -------------------------------------------------------------------------
>                 Key: CB-12705
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-cli, CordovaLib
>    Affects Versions: 6.5.0
>            Reporter: Fabian Eichinger
> I want to build a {{after_plugin_install}} javascript hook for my project that only executes
it logic when installing a specific plugin (in my case {{cordova-plugin-file}}). As it turns
out the context passed to project-level {{\*_plugin_install}} hooks do not contain *any* information
on the plugin that was installed and this makes these kind of hooks basically useless.
> I propose passing to them the same information in {{context.opts.plugin}} as to plugin

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message