Skip to content

Commit

Permalink
Update readme.md (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Nov 9, 2024
1 parent 51001d7 commit e11ba4d
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions doc/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,72 +150,6 @@ cordova create path [id [name]] [options]
|--------|-------------|
| --template | Use a custom template located locally, in NPM, or GitHub. |
### Directory structure
Cordova CLI works with the following directory structure:
```bash
myapp/
|-- config.xml
|-- merges/
| | |-- android/
| | |-- ios/
|-- www/
|-- platforms/
| |-- android/
| |-- ios/
|-- plugins/
|-- cordova-plugin-camera/
```
#### config.xml
Configures your application and allows you to customize the behavior of your project. See also [config.xml reference documentation][config.xml ref]
#### www/
The "`www`" directory contains the web artifacts of the project, encompassing various file types with extensions including, but not limited to, `.html`, `.css`, and `.js`.
As a Cordova application developer, most of your code and assets will be placed in this directory. During the `cordova prepare` command execution, the contents of the "`www`" directory are copied to the corresponding `www` directories within each platform's subdirectory. For instance, you can find it at `platforms/ios/www` or `platforms/android/assets/www`.
It's important to note that since the CLI regularly copies files from the source "`www`" folder, you should only make edits to the files in this directory and avoid modifying the ones located in the platform subdirectories.
If you're using version control software, it's recommended to include both the source "`www`" folder and the "`merges`" folder in your version control system.
When using frameworks that require a transpiling process, it is crucial to understand that the final output, which is intended for distribution, should be placed in the "`www`" directory. The purpose of the "`www`" directory is not to store the untranspiled source code. Instead, it is recommended to keep the untranspiled source code in a separate directory dedicated to that purpose.
#### platforms/
Contains all of the source code for the platforms that you add to your project.
> **WARNING:** When using the CLI to build your application, you should not edit any files in the /platforms/ directory unless you know what you are doing, or if documentation specifies otherwise. The files in this directory are routinely overwritten when preparing applications for building, or when plugins are re-installed.
#### plugins/
Any added plugins will be extracted or copied into this directory.
#### merges/
Platform-specific web assets (HTML, CSS and JavaScript files) are contained within appropriate subfolders in this directory. These are deployed during a `prepare` to the appropriate native directory. Files placed under `merges/` will override matching files in the `www/` folder for the relevant platform. A quick example, assuming a project structure of:
```bash
merges/
|-- ios/
| -- app.js
|-- android/
| -- android.js
www/
-- app.js
```
After building the Android and iOS projects, the Android application will contain both `app.js` and `android.js`. However, the iOS application will only contain an `app.js`, and it will be the one from `merges/ios/app.js`, overriding the "common" `app.js` located inside `www/`.
#### Version control
To ensure a cleaner version control setup, it is advisable not to include the `platforms/` and `plugins/` directories in your version control system. These directories are considered build artifacts. Instead, the platforms and plugins used in your project are automatically recorded in the `config.xml` and `package.json` files. When you invoke the `cordova prepare` command, the necessary platforms and plugins will be downloaded and set up based on the information specified in these configuration files.
By excluding the `platforms/` and `plugins/` directories from version control and relying on the `config.xml` and `package.json` files, you can maintain a more streamlined development and continuous integration workflow.
### Examples
- Create a Cordova project in `myapp` directory using the specified ID and display name:
Expand Down

0 comments on commit e11ba4d

Please sign in to comment.