[
https://issues.apache.org/jira/browse/CB-13055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16290137#comment-16290137
]
ASF GitHub Bot commented on CB-13055:
-------------------------------------
stevengill closed pull request #11: CB-13055: fixed failing tests in
cordova-lib
URL: https://github.com/apache/cordova-fetch/pull/11
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/.gitignore b/.gitignore
index 3c3629e..d5f19d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+package-lock.json
diff --git a/index.js b/index.js
index 9d77f04..c2510c9 100644
--- a/index.js
+++ b/index.js
@@ -84,7 +84,6 @@ module.exports = function (target, dest, opts) {
})
.then(function (depTree) {
tree1 = depTree;
-
// install new module
return superspawn.spawn('npm', fetchArgs, opts);
})
@@ -99,7 +98,6 @@ module.exports = function (target, dest, opts) {
// Need to use trimID in that case.
// This could happen on a platform update.
var id = getJsonDiff(tree1, tree2) || trimID(target);
-
return module.exports.getPath(id, nodeModulesDir, target);
})
.fail(function (err) {
@@ -119,20 +117,25 @@ module.exports = function (target, dest, opts) {
*
*/
function getJsonDiff (obj1, obj2) {
- var result = '';
-
+ var result = [];
// regex to filter out peer dependency warnings from result
var re = /UNMET PEER DEPENDENCY/;
for (var key in obj2) {
// if it isn't a unmet peer dependency, continue
if (key.search(re) === -1) {
- if (obj2[key] !== obj1[key]) result = key;
+ if (obj2[key] !== obj1[key]) {
+ result.push(key);
+ }
}
}
- return result;
+ if (result.length > 1) {
+ // something went wrong if we have more than one module installed at a
time
+ return false;
+ }
+ // only return the first element
+ return result[0];
}
-
/*
* Takes the specified target and returns the moduleID
* If the git repoName is different than moduleID, then the
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> remove --nofetch option and all old fetching code
> -------------------------------------------------
>
> Key: CB-13055
> URL: https://issues.apache.org/jira/browse/CB-13055
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-lib
> Reporter: Steve Gill
> Labels: backlog, tools-next
> Fix For: cordova@8
>
>
> Cordova uses cordova-fetch for fetching modules by default now. In the next
> major version, lets drop the older methods. This is great for reducing
> maintenance in cordova. Original fetch proposal is at
> https://github.com/cordova/cordova-discuss/pull/33
> remove --nofetch option
> remove lazy_load
> remove gitclone.js
> remove npm dependency
> remove remoteload.js
> update anywhere that these files are used
> Proposal: https://github.com/apache/cordova-discuss/pull/76
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]