cordova-cli icon indicating copy to clipboard operation
cordova-cli copied to clipboard

In package.json, cordova plugin list is never sorted

Open jpike88 opened this issue 6 years ago • 4 comments

Bug Report

Problem

In package.json, cordova plugin list is not sorted. Makes things hard to understand when adding new plugins.

Screen Shot 2019-04-04 at 12 35 36 pm

What is expected to happen?

Object keys should be sorted alphabetically.

What does actually happen?

They're never sorted.

Information

Command or Code

Environment, Platform, Device

Version information

macOS High Sierra Cordova 9.0.0

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

jpike88 avatar Apr 04 '19 05:04 jpike88

Good point. Same goes for the list of installed platforms. Could be done using either sort-object-keys or sorted-object.

@dpogue Should be added to the long list of features for https://github.com/apache/cordova-common/pull/34.

Should we move this issue to cordova-common then?

raphinesse avatar Apr 10 '19 20:04 raphinesse

Yeah... I will mention that the order of the list in package.json is the order in which cordova prepare restores the plugins, and I've needed to manually order that list at times to avoid weird plugin installation failures 😢

So I'm not super keen on reordering this in package.json whenever a plugin is added, because that will be frustrating for people who have things in a specific order.

dpogue avatar Apr 10 '19 20:04 dpogue

Ugh, that's horrifying :nauseated_face:

raphinesse avatar Apr 10 '19 20:04 raphinesse

Not having a stable order for plugins and platforms also makes it unnessesarily difficult to understand changes in a version control system: removing an old version of a platform and adding a new one makes one line disappear and another one appear, even though only a version number changed. When you update many dependencies at once, the diff easily becomes incomprehensible.

kputh avatar Mar 12 '21 21:03 kputh