Skip to content
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

Change Cordova project detection. #529

Closed
infacto opened this issue Aug 27, 2020 · 5 comments
Closed

Change Cordova project detection. #529

infacto opened this issue Aug 27, 2020 · 5 comments

Comments

@infacto
Copy link

infacto commented Aug 27, 2020

Feature Request

Motivation Behind Feature

Currently a Cordova project is detected by the config.xml and the folder www (empty or not).
The www folder is a deployment folder which should not included in git repo. You only use the www as source folder if you develop vanilla html and js without any framework. But the real life scenario is that you build an app with e.g. Angular, Vue, React, etc. and set the www as dist-folder.

Feature Description

Cordova should detect its project workspace by the config.xml or package.json only. Not the www-folder.

Alternatives or Workarounds

I have to ensure the existence of the temp folder www. But this is a pain.

@breautek
Copy link
Contributor

The www folder is a deployment folder which should not included in git repo. You only use the www as source folder if you develop vanilla html and js without any framework. But the real life scenario is that you build an app with e.g. Angular, Vue, React, etc. and set the www as dist-folder.

I think this is an invalid assumption. Even if you build with frameworks like the ones you mentioned, you can always gitignore the files that are actually built/generated.

e.g: I use react in my projects, with my source files inside a ./src/ directory, and use webpack to bundle my sources to www/ but not all of my www files are generated, i.e: my index.html file.

@infacto
Copy link
Author

infacto commented Aug 27, 2020

Yes you can use git ignore like:

www/*
!www/.gitkeep

Which will deploy .gitkeep to the app too. And may removed with a www clean command.
Btw. the index.html can also be copied during the build process. No need to keep files in the www-folder.
But anyway, I don't want to get off the topic. I just wonder if we could ignore the www-folder for a Cordova project detection.
Many commands depends on it to have the www-folder (empty or not). Also if you don't want to build. For example: Adding plugins. Only fail on builds / runs if the www-folder does not exist. But it should not be a part of the Cordova project detection.

I think we should consider to change this behavior. What's wrong to detect it by the config.xml and maybe package.json only. Regardless of the use of the www folder.

@raphinesse
Copy link
Contributor

I think not having to rely on the presence of the www folder is a reasonable request. But before that change can be implemented sanely, we have to DRY our implementations of the methods to find the Cordova project root.

Currently we have this implemented similarly (if not identically) in at least:

  • cordova-lib/src/cordova/util.js
  • cordova-common/src/CordovaCheck.js
  • cordova-serve/src/util.js

where the version in cordova-common is not actually used anywhere AFAICT.

@brodycj
Copy link

brodycj commented Aug 31, 2020

And I think we should check for www before trying to build or run.

@raphinesse
Copy link
Contributor

Since this issue affects multiple repositories, I am going to close this in favor of apache/cordova#155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants