You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/22 11:42:18 UTC

[cordova-lib] branch master updated: fix: plugin installation from git url w/ semver (#827)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new 0447384  fix: plugin installation from git url w/ semver (#827)
0447384 is described below

commit 0447384e96fcce0d51f8d4d95d35a0c0a3132c35
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Fri Nov 22 12:42:11 2019 +0100

    fix: plugin installation from git url w/ semver (#827)
    
    AFAICT, the check that is removed here was part of our previous plugin
    fetching mechanism and was not removed when migrating to cordova-fetch.
    
    Fixes #795
---
 integration-tests/pkgJson.spec.js | 11 +++++++++++
 src/plugman/fetch.js              |  5 -----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/integration-tests/pkgJson.spec.js b/integration-tests/pkgJson.spec.js
index 87fcf67..9c12e94 100644
--- a/integration-tests/pkgJson.spec.js
+++ b/integration-tests/pkgJson.spec.js
@@ -278,6 +278,17 @@ describe('pkgJson', function () {
                     expect(getPkgJson(`dependencies.${PLUGIN}`)).toBeDefined();
                 });
         });
+
+        it('Test#026 : should successfully add a plugin with git/semver combo', async () => {
+            const URL = 'https://github.com/apache/cordova-plugin-device.git#semver:2.0.x';
+
+            expect(getPkgJson('cordova.plugins')).toBeUndefined();
+            expect(getPkgJson(`dependencies.${pluginId}`)).toBeUndefined();
+
+            await cordova.plugin('add', URL, { save: true });
+            expect(getPkgJson('cordova.plugins')[pluginId]).toBeDefined();
+            expect(getPkgJson('dependencies')[pluginId]).toMatch(URL);
+        });
     });
 
     // This group of tests checks if platforms are added and removed as expected from package.json.
diff --git a/src/plugman/fetch.js b/src/plugman/fetch.js
index 9417a7c..cb13f8f 100644
--- a/src/plugman/fetch.js
+++ b/src/plugman/fetch.js
@@ -61,11 +61,6 @@ function fetchPlugin (plugin_src, plugins_dir, options) {
         if (result) {
             if (result[1]) { options.git_ref = result[1]; }
             if (result[2]) { options.subdir = result[2]; }
-
-            // throw error for subdirectories
-            if (options.subdir && options.subdir !== '.') {
-                return Promise.reject(new CordovaError('Cordova does not support subdirectories'));
-            }
         }
     }
     return Promise.resolve().then(function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org