You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/02 20:57:04 UTC
[jira] [Commented] (CB-12786) Improve logic for searching plugin id
in case of module already exists in node_modules
[ https://issues.apache.org/jira/browse/CB-12786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035414#comment-16035414 ]
ASF GitHub Bot commented on CB-12786:
-------------------------------------
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/555#discussion_r119950730
--- Diff: cordova-fetch/index.js ---
@@ -148,9 +148,15 @@ function trimID(target) {
target = parts[1];
}
- //If local path exists, set target to final directory
+ // If local path exists, try to get plugin id from package.json or set target to final directory
if (fs.existsSync(target)) {
- target = path.basename(target);
+ var pluginId, pkgJsonPath = path.join(target, 'package.json');
+
+ if (fs.existsSync(pkgJsonPath)) {
+ pluginId = JSON.parse(fs.readFileSync(pkgJsonPath)).cordova.id;
--- End diff --
why use `pkgJsonPath.cordova.id` instead of `pkgJsonPath.cordova.name` ? I don't even remember why we have `cordova.id` anymore haha.
> Improve logic for searching plugin id in case of module already exists in node_modules
> --------------------------------------------------------------------------------------
>
> Key: CB-12786
> URL: https://issues.apache.org/jira/browse/CB-12786
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-fetch
> Affects Versions: 1.1.0
> Environment: cordova-7.0.2-dev
> Reporter: Nikita Matrosov
> Assignee: Nikita Matrosov
> Labels: cordova-next
>
> Steps to reproduce
> There is the issue with searching plugin id if the module already exists in node_modules.
> cordova create sample
> cordova platform add android
> cordova plugin add cordova-plugin-ms-adal
> cordova plugin add ../azure-activedirectory-library-for-cordova (use local folder)
> Get error message:
> Error: Failed to get absolute path to installed module
> This error occurs since folder name in node_modules (cordova-plugin-ms-adal) differs from base name of installation folder (azure-activedirectory-library-for-cordova).
> PR: https://github.com/apache/cordova-lib/pull/555
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org