Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14243

Cordova-lib 8.0.0 ignores save-exact

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 8.0.0
    • None
    • cordova-lib
    • None

    Description

      When installing plugins with an exact version (no semver prefixes) and save-exact is specified either on the command line or via the global config (e.g. cordova config), cordova-lib 8.0.0 modifies package.json and config.xml with semver prefixes. 

      The problem is that cli.js records the option in an object with a key of "save_exact", but in src/cordova/plugin/add.js of cordova-lib, keys of the propagated options object from cli.js are copied into another fetch options object for the plugman fetch. However, save-exact is copied into the new options object by referencing the key "save-exact" instead of "save_exact", which is how it was initially stored in cli.js. Since the referenced key doesn't exist, save-exact will be undefined (i.e. false) when passed to plugman.fetch and therefore ignored.

      This affects both the "--save-exact" command line flag and the save-exact attribute in the cordova global config.

      The fix is to change "save-exact" to "save_exact" on lines 90 and 125 of src/cordova/plugin/add.js in cordova-lib. When I make these changes locally, save-exact works properly.

      https://github.com/apache/cordova-lib/blob/b8e2c4ddc119c4c8bbe8c073c51612625e084cab/src/cordova/plugin/add.js

      Attachments

        Activity

          People

            Unassigned Unassigned
            amaldonado Aaron T Maldonado
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m