3.8 KiB
Development
Setup
-
Install the requirements defined in the README.md
-
Install npm dependencies.
npm install
Using a Cloned Repo as a Shared Framework
By default, when you add a platform to a Cordova project, the platform files are copied directly into your Android project. However, during development, it can be easier to use a shared framework instead.
Using the --link option creates symbolic links to your cloned repository instead of copying the files. This allows you to make changes to the core platform files in Android Studio and have those changes automatically reflected in your cloned development repository (and vice versa).
To add a linked platform, run:
cordova platform add --link /path/to/cordova-android
Unit Testing
Our projects include unit tests, which can be run with:
npm test
Linting
During development, you should run the linter to ensure the code follows our coding standards:
npm run lint
Note
Running
npm testwill also execute the linter before running the tests.
Fixing Lint Issues
In many cases, lint warnings can be fixed automatically with:
npm run lint:fix
If an issue cannot be resolved automatically, it will require manual review and correction.
Install Nightly Build
Warning
Nightly builds are generated daily from the
mainbranch and are considered unstable and untested. They are not for use in production applications and are intended only for development and testing purposes.See Apache Cordova - Nightly Builds for more details.
You can install the nightly build with:
cordova platform add android@nightly
Note
Due to recent changes to npm authentication tokens, nightly builds may occasionally stop publishing.
Building from Source
-
Clone the repository locally.
-
Change to the repository directory.
-
Install dependencies:
npm installInstalls all production and development dependencies required for using and developing the package.
-
Update sub-dependencies:
npm updateOver time,
package-lock.jsoncan become stale and may trigger audit warnings.npm updaterefreshes dependencies within the pinned versions.Under normal circumstances, users install the published package from the npm registry, which does not include its own
package-lock.json. Instead, npm resolves and installs the latest compatible dependency versions at install time, which may result in no audit warnings.Running
npm updatelocally can provide a more accurate representation of current npm audit results for the project. -
Generate a tarball:
npm packCreates a
.tgztarball file in the.asf-releasedirectory. This tarball file can be installed in a Cordova project via:cordova platform add /path/to/package.tgz