rtf_leg
rtf_leg

Reputation: 1819

What is the purpose of fetch.json file inside cordova plugins folder?

File fetch.json created inside plugins folder after cordova plugin add executed first time. This file also modified each time I add/remove plugins.

Content of fetch.json:

{
    "com.phonegap.plugins.PushPlugin": {
        "source": {
            "type": "git",
            "url": "https://github.com/phonegap-build/PushPlugin.git",
            "subdir": "."
        },
        "is_top_level": true,
        "variables": {}
    },
    "cordova-plugin-file": {
        "source": {
            "type": "registry",
            "id": "cordova-plugin-file"
        },
        "is_top_level": true,
        "variables": {}
    }
}

Upvotes: 24

Views: 9310

Answers (1)

jujule
jujule

Reputation: 11531

Looks like this file tracks installed plugins, their origin and revision, like npm package.json dependencies does, but for plugman. I guess and hope this should migrate to the npm standard soon.

This file is updated on cordova add/remove plugins (https://github.com/apache/cordova-lib/blob/e4e5904619bab05705d62bce92a4c4cd0d45bb82/cordova-lib/src/cordova/plugin.js#L272)

When we cordova prepare, cordova reads plugin list from plugins/ios.json (for ios), then, for each one :

  • get the plugin infos from plugins/fetch.json
  • try to find the plugin locally

looks like its not possible to restore plugins with this file. My workflow is :

  • define plugins dependencies in config.xml
  • remote platforms and empty plugins folder
  • run cordova platform add xxx

this will refetch plugins as defined in config.xml

Looks like the only doc is the source code : https://github.com/apache/cordova-lib/search?utf8=%E2%9C%93&q=fetch

Upvotes: 9

Related Questions