-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please restore --nofetch
flag to support Yarn
#303
Comments
Actually, this could have been fixed by apache/cordova-fetch#24. Could you please check if your problem persists when using a recent nightly build? |
Looking at the PR and description I don't believe it work (cause e.g we don't have plugins in Also, I don't feel comfortable to test nightlies, cause something else can be broken. But I'm ready to test when the next release is shipped! Will it be release of |
Well, then where does You should probably clarify your use case. Because I don't think
It won't set your machine on fire, I promise 😉. But seriously, I am only asking you to test it, not to use it in production.
The change will be part of the next Cordova CLI major version. Testing it only after that has been released might be a little late. The earlier we know what you really need, the earlier we can start working on it 😉 |
Thanks for detailed comments! Currently we use What we would like to have:
Cordova 8 doesn't have Since I see the effort to help from your side - I'll do my best to test it with the nightly build as you suggested! |
I tried nightly, previously cleaned Click to view output
It broke on one of our cordova hooks, because previously it "screwed" So, problem is there. |
@kirillgroshkov Thanks for testing! Could you please re-run your experiment using Edit: Oh, and please be sure to do a |
To provide a bit of background here, there are several reasons that The old installation code was unfortunately tied to npm2, which is several years old and relies on versions of dependencies with known security vulnerabilities. Because npm2 was installed as a dependency, running npm scripts within projects using Cordova would run with npm2 rather than the system npm. This was a frequent source of problems for users of Cordova, because npm2 and npm3 have different behaviour around peerDependencies. The way forward for Cordova is to have platforms and plugins listed in package.json and installed into node_modules. When you ask Cordova to install something, it will use npm to install it if it is not already installed. From what I understand, this means it should be possible to make this work with Yarn, but you'll need to add the platforms to your package.json manually, and install them with Yarn. For instance, with the following in your package.json: {
"dependencies": {
"cordova-android": "^7.1.0"
},
"cordova": {
"platforms": [
"android"
]
}
} After you run |
@dpogue Great explanation! And I totally agree that instead of reinventing different package management methods it's easier for everyone to just stick to the same one that is also battle-tested (NPM), to have everything inside Looks like the issue is:
|
Hello guys, here at my company we are using Cordova (and Ionic) to make some mobile apps. We have a Jenkins agent doing Android builds with the following steps:
We have a mix of registry, git and local plugins and currently the prepare step takes a long time. From what I could understand cordova uses npm to install everything again, even though the install step already placed everything inside I tried using Yarn and pinning I can't help but wonder if it wouldn't be better if cordova ditched the dependency manager role and only used the node resolution algorithm to find the referenced plugins (and platforms), allowing the user to pick whatever package manager he prefers. |
@leandro-manifesto totally agree, cordova should do it's job and not try to do npm's (or yarn's or pnpm's) job. |
I would love to do that, but people need to be able to run commands like What we can do (and I'm working on this) is to not run any package management commands as part of |
Just an idea, maybe
Oh, that would be awesome, it'll solve the problem for so many people! |
Hi, Can't wait for this too ! But what about yarn workspaces and plug and play ? Dependencies won't always be local. Thanks anyway for the great job |
Crazy that such complex solutions as spypkg are developed to address this issue:) Should indicate the need for native yarn support! If Capacitor (https://capacitor.ionicframework.com/) will reach GA sooner - we'll probably switch to it instead of waiting for yarn support here... |
@kirillgroshkov Cordova is Open Source - feel free to invest the time and submit a Pull Request if you really need this feature. |
Would the work need to be done in cordova-lib? cordova-cli appears to be a wrapper to me. |
The feature as requested here will most likely not be re-implemented. We are however aware of the fact that people want to use different package managers for various reasons. We plan to cater to these needs by doing less package management ourselves like @dpogue wrote in #303 (comment). However, this is a huge task and we are seriously short on developers that have the time and knowledge to tackle it. Almost all work on Cordova is done by volunteers in their spare time. |
Sad, but I understand. We'll need to stay on Cordova 7.1 then and keep using |
@kirillgroshkov Did you test Cordova 9? |
I haven't tried Cordova 9 yet. How does |
@kirillgroshkov Cordova will follow the standard module resolution rules of Node.js (details in apache/cordova-fetch#43 and the PR linked therein), starting in your project root. |
Since when (which version of Cordova) is this logic in |
9 |
Allright. Thanks for the info! I'll try 9 when I have time. If your description is correct - then it's great news and hopefully we can make it work with yarn (by preinstalling all dependencies with yarn and |
@kirillgroshkov Hope it works for you. When running whatever |
So, this would exclude any local plugins? The behaviour I am seeing is that |
@cmdickson yes, we always need to invoke |
Just verified that cordova v9.0.0's |
@vzts @raphinesse I can confirm that npm install is not called when pre-yarn installed environment BUT npm install is called when a cordova plugin has been added using This is a normal way to install dependencies, and useful when installing forks of cordova plugins. Please either re-add --nofetch, or make it use yarn if configured as such, or just check by looking in node_modules/cordova-plugin-referrer instead of a more complicated way (which fails here) |
I have worked around this issue in a funny way : by running a hook that restores node_modules after cordova has finished messing with it. In config.xml :
hooks/before_build/run_yarn.js :
|
We're using Yarn and without
--nofetch
ournode_modules
folder gets screwed by npm (invoked bycordova-fetch
). We would really really like--nofetch
back to be able to work.The text was updated successfully, but these errors were encountered: