I often find myself making changes that require commits to both plugman and
cli, it’s not always clear which repo new code should live in and sharing
utility functions between the two projects is not trivial.

The idea of “cordova-lib” was mentioned several times on this mailing list.
The lib would contain most of the code from both plugman and cli while the
end tools will be thin wrappers around the lib.

I wanted to probe how people working on CLI feel about such rearrangement.

But if we are already in this discussion, now that the heavy platforms
files are distributed separately from cordova-cli (repos like cordova-ios
etc), is there anything that prevents us from merging plugman and cli into
a single npm package with 2 executables?


Examples of code that should be shared include:
- Common logging and error handling logic (e.g. CordovaError exception)
- Fetching logic (for plugins and platforms)
- Platform-specific logic (e.g. where the config.xml file lives within each
project)
- Generic utilities like xml-helpers.js (currently copied but slightly
diverged in the 2 repos)

The first option that comes to mind is to create another repo and another
npm package for cordova-lib, but this creates significant overhead:
 - Version release would get more difficult (see the failed release vote
thread <https://www.mail-archive.com/dev@cordova.apache.org/msg15419.html>from
last Friday)
 - In many cases new functionality in plugman or CLI would require changes
in 2 or even 3 repos. This is a significant additional barrier for new
contributors that don’t have commit rights - coordinating two
interdependent pull request is quite a hassle.
 - Strictly speaking, cordova-lib major version number will have to be
bumped every time we change some function signatures, which will happen
rather frequently in this case (this point also partially holds true if the
lib will be part of the plugman repo and npm package).

Based on the points above a single repo and npm package containing both
plugman and cli seems to provide the most benefit.

What do you think?

Reply via email to