Open jayvdb opened 6 years ago
Please take a look at https://github.com/apache/cordova-cli/pull/292. Especially @dpogue's and my comment towards the end of the discussion. In short: I do not think that this is feasible, the way cordova currently works.
If you are interested in more technical details, I can provide them. Thanks for taking the time to create this issue and providing some helpful links too.
Well, I just tried yarn
for giggles, and found it did work with cordova@8 .
Im not discounting that you've fixed a lot of bugs by more tightly integrating with npm, but it shouldnt be hard to have similar integration with the other package managers. This train is coming.
I would question that tighter integration with npm
solves anything, because there are a raft of differences between npm versions, and also massive changes in how npm works based on npm config variables, which are beyond your control unless cordova reads and understands the npm config, and possibly even override them, and also understands all reasonable npm versions, and how those config variables operate in each version -- usually a few are broken in any npm release.
Perhaps as an interim measure, cordova fetch at least checks which package manager is used, and fails early when it isnt npm
, indicating that patches are welcome to support for other package managers, but those patches would need to pass the test suite, ensuring it is as supportable as npm
.
I think only supporting NPM because of tight coupling with that package manager is an indication that some plugins are not using package managers in a way the're supposed to. However, since I just started to try things with Cordova and because I don't know how things work you should take my comment with a grain of sailt.
Preferences aside, in the JavaScript community nobody expects not being able to swap NPM with Yarn, so I think that should be documented in the basic introductions like the "Get started": https://cordova.apache.org/
Although 'spypkg' doesn't detect which package manager to use, its capable of parsing npm expressions to be mapped into yarn expressions. When installed and configured, in essence it intercepts execution, maps the expression and executes the modified expression.
https://github.com/pnpm/pnpm is almost a drop-in replacement for npm, and I am successfully using it with cordova-fetch by creating a symlink from
npm
topnpm
.The flags used by cordova-fetch are also compatible with
yarn
, afaics, but I havent tested that. npm is also planning a new package manager on the horizon, https://github.com/npm/tink , which looks likely to support the same args.@zkochan, creator of pnpm, has created https://github.com/zkochan/which-pm to do the detection, so it should be fairly easy to invoke the correct package manager, using the same flags.