-
Notifications
You must be signed in to change notification settings - Fork 65
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
(improvement) Do not require the www-folder to detect a Cordova-based project. #155
Comments
I would definitely favor this kind of an enhancement. Unfortunately I don't have much time to work on this right now, and other maintainers seem to be pretty overloaded as well. IIRC this would be done in cordova-lib. I think it should check for some things such as package.json and config.xml with proper Cordova configuration. |
Copy of my comment from apache/cordova-cli#529 for better visibility: I think not having to rely on the presence of the Currently we have this implemented similarly (if not identically) in at least:
where the version in |
It is worth to mention that The alternative would be to add a dependency to Any opinions on this? |
Regardless of where we put it, one possibility for the new algorithm could be: const fs = require('fs');
const path = require('path');
const pkgUpSync = require('pkg-up').sync;
module.exports = function findCordovaRootUp (cwd) {
while (cwd && !fs.existsSync(path.join(cwd, 'config.xml'))) {
pkgUpSync({ cwd });
}
return cwd;
} I.e. search upward from the given dir until we find a |
In the case of using Cordova Electron platform, these two files do exist side-by-side at the platform level. E.g.
If someone ran a Cordova command within that folder, the Also, the It might be possible to verify that the |
Good point about the electron case, @erisu. So that means we need a different process after all 😞 Random ideas:
A solution could also combine several of the above points |
Improvement (Bug? Feature Request?)
Currently Cordova requires the file
config.xml
and thewww
folder to detect a Cordova-based project.The need of the www-folder is not necessary. It does not matter if it is empty or not. And Cordova will not touch it. (e.g. for installing a native plugin). Cordova is just happy if the www-folder is there.
It's annoying if the www-folder is the dist (build) folder and not tracked by git.
In this case I have to add a
.gitkeep
file and ignore all other files inside for git.To always keep it.
If you try to install a plugin without the www-folder, you'll get the error:
Expected behavior:
Only detect the Cordova-based project by the config.xml.
Q: Why? The www-folder is the source Folder for Cordova!
A: Well, it is used to build the apk. But If you use frameworks like Ionic / Angular you have another source base (src-folder) and build to the www-folder to finally pack it to the apk with Cordova.
And the www-folder is not a part of the git-repository.
What do you think? Can we do without the www-folder? It's just a dummy in this case.
Cordvoa Version
9.0.0
Workaround
.gitignore
Add a .gitkeep file to the www-folder.
The text was updated successfully, but these errors were encountered: