Code Monkey home page Code Monkey logo

Comments (1)

Chuckytuh avatar Chuckytuh commented on May 30, 2024

I was about to open a bug on cordova-fetch with this exact same behaviour but wasn't entirely sure if it should be opened there or here, on cordova-lib. Anyway, I'll just use this issue and expand with my findings on the situation, hopefully it will help understand the real root of the problem.

As reported here, there's a mismatch between the public documentation and the behaviour experienced when installing a cordova plugin that in turn depends on another plugin and specified the commit attribute.

https://github.com/apache/cordova-lib/blob/rel/10.0.0/src/plugman/install.js#L306 : Here the model representing the dependency contains all the correct information as obtained from PluginInfo, namely, URL, ID, git_ref, etc, they are all correctly parsed. Example:

{
    "id": "cordova-plugin-secure-storage",
    "version": "",
    "url": "<https://github.com/OutSystems/cordova-plugin-secure-storage.git>",
    "subdir": "",
    "commit": "2.6.8-OS5",
    "git_ref": "2.6.8-OS5",
    "install_dir": "/Users/calcifer/Development/tmp/test-plugin-dependency/myapp/plugins/cordova-plugin-secure-storage"
}

In fact, this is the value of dep, the input argument for installDependency but internally it does

var dep_src = dep.url.length ? dep.url : (dep.version ? dep.id + '@' + dep.version : dep.id);
return possiblyFetch(dep_src, install.plugins_dir, opts)
which ends up executing possiblyFetch where the "id" argument receives the value of the URL alone. In turn, possiblyFetch ends up executing cordova-fetch by providing only the following inputs:

> target
"https://github.com/OutSystems/cordova-plugin-secure-storage.git"
> dest
"/Users/calcifer/Development/tmp/test-plugin-dependency/myapp"
> opts
{
    "cli_variables": {},
    "save": true,
    "searchpath": [],
    "link": false,
    "pluginInfoProvider": {
        ...
    },
    "usePlatformWww": true,
    "force": false,
    "save_exact": false,
    "production": true,
    "is_top_level": false,
    "graph": {
        ...
    },
    "platformVersion": "9.0.0",
    "subdir": ".",
    "git_ref": "2.6.8-OS5",
    "expected_id": "cordova-plugin-secure-storage",
    "client": "plugman"
}

As we can see, git_ref property is correctly set, however, cordova-fetch does nothing with that information and just ends up calling npm install with the provided URL alone.

This is why I wasn't sure if this is a bug here or on cordova-fetch.

This is replicable on cordova-cli 10.0.0.

from cordova-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.