From 31364a97740f75e88a21990adbd82bd7acc7d4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=B9?= Date: Sat, 21 Feb 2026 03:24:25 +0900 Subject: [PATCH] chore: add DEVELOPMENT.md & cleanup README.md (#1883) --- .npmignore | 1 + DEVELOPMENT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 43 +++++------------ 3 files changed, 142 insertions(+), 30 deletions(-) create mode 100644 DEVELOPMENT.md diff --git a/.npmignore b/.npmignore index 84766f50..a3f05d2d 100644 --- a/.npmignore +++ b/.npmignore @@ -21,6 +21,7 @@ test spec framework/build cordova-js-src +DEVELOPMENT.md # ASF release workspace .asf-release/ diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000..771d0127 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,128 @@ + + +# Development + +## Setup + +1. Install the requirements defined in the [README.md](README.md#requirements) +2. Install npm dependencies. + + ```bash + 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: + +```bash +cordova platform add --link /path/to/cordova-android +``` + +## Unit Testing + +Our projects include unit tests, which can be run with: + +```bash +npm test +``` + +## Linting + +During development, you should run the linter to ensure the code follows our coding standards: + +```bash +npm run lint +``` + +> [!NOTE] +> Running `npm test` will also execute the linter before running the tests. + +### Fixing Lint Issues + +In many cases, lint warnings can be fixed automatically with: + +```bash +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 `main` branch 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](https://cordova.apache.org/contribute/nightly_builds.html) for more details. + +You can install the nightly build with: + +```bash +cordova platform add android@nightly +``` + +> [!NOTE] +> Due to recent changes to npm authentication tokens, nightly builds may occasionally stop publishing. + +## Building from Source + +1. **Clone the repository** locally. + +2. **Change to the repository directory.** + +3. **Install dependencies:** + + ```bash + npm install + ``` + + Installs all production and development dependencies required for using and developing the package. + +4. **Update sub-dependencies:** + + ```bash + npm update + ``` + + Over time, `package-lock.json` can become stale and may trigger audit warnings. `npm update` refreshes dependencies within the pinned versions. + + > [!NOTE] + > When you install the published package from the npm registry (normal usage), it does **not** include a `package-lock.json` and automatically fetches the latest compatible dependencies. Running `npm update` locally simulates this behavior. + +5. **Generate a tarball:** + + ```bash + npm pack + ``` + + Creates a `.tgz` file that can be installed in a project via: + + ```bash + npm install /path/to/package.tgz + ``` + + > [!NOTE] + > Tarball will be created in the `.asf-release` directory within this repository directory. diff --git a/README.md b/README.md index 55ff2cb4..9bfb67ef 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,11 @@ # Cordova Android [![npm - Latest](https://img.shields.io/npm/v/cordova-android/latest?label=Latest%20Release%20(npm))](https://npmjs.com/package/cordova-android) + [![GitHub](https://img.shields.io/github/package-json/v/apache/cordova-android?label=Development%20(Git))](https://github.com/apache/cordova-android) -[![Node CI](https://github.com/apache/cordova-android/workflows/Node%20CI/badge.svg?branch=master)](https://github.com/apache/cordova-android/actions?query=branch%3Amaster) -[![codecov.io](https://codecov.io/github/apache/cordova-android/coverage.svg?branch=master)](https://codecov.io/github/apache/cordova-android?branch=master) +[![GitHub - Node Workflow](https://github.com/apache/cordova-android/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/apache/cordova-android/actions/workflows/ci.yml?query=branch%3Amaster) +[![GitHub - Release Audit Workflow](https://github.com/apache/cordova-android/actions/workflows/release-audit.yml/badge.svg?branch=master)](https://github.com/apache/cordova-android/actions/workflows/release-audit.yml?query=branch%3Amaster) +[![Code Coverage](https://codecov.io/github/apache/cordova-android/coverage.svg?branch=master)](https://codecov.io/github/apache/cordova-android?branch=master) Cordova Android is an Android application library that allows for Cordova-based projects to be built for the Android Platform. Cordova based applications are, at the core, applications written with web technology: HTML, CSS and JavaScript. @@ -32,20 +34,22 @@ Cordova Android is an Android application library that allows for Cordova-based ## Requirements -* Java Development Kit (JDK) 17 +* Java Development Kit (JDK) * [Android SDK](https://developer.android.com/) +* [Gradle](https://gradle.org/) * [Node.js](https://nodejs.org) +> [!TIP] +> Refer to the official Apache Cordova documentation for details on the requirements and prerequisites for building Cordova-Android applications. These resources outline the necessary tools, supported versions, and platform requirements: +> +> * [System Requirements](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#system-requirements) +> * [Required Software & Tools](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#the-required-software-&-tools) +> * [Android API Level Support](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#android-api-level-support) + ## Create a Cordova project Follow the instructions in the [**Create your first Cordova app**](https://cordova.apache.org/docs/en/latest/guide/cli/index.html) section of [Apache Cordova Docs](https://cordova.apache.org/docs/en/latest/) -To use a **shared framework**, for example in development, link the appropriate cordova-android platform folder path: - -```bash -cordova platform add --link /path/to/cordova-android -``` - ## Updating a Cordova project When you install a new version of the [`Cordova CLI`](https://www.npmjs.com/package/cordova) that pins a new version of the [`Cordova-Android`](https://www.npmjs.com/package/cordova-android) platform, you can follow these simple upgrade steps within your project: @@ -59,27 +63,6 @@ cordova platform add android Import project in Android Studio through _File > Open_ and targeting `/path/to/your-cdv-project/platforms/android/`. -## How to Test Repo Development - -```bash -npm install -npm test -``` - -## Install Nightly Build - -```bash -cordova platform add android@nightly -``` - -### Notes - -Nightly builds are **not recommended for production apps**. They are intended for testing purposes. This allows users either to check if recent changes in the main branch have fixed existing issues or to identify new bugs before an official release. - -Nightly builds are generated daily and may be **unstable**. - -See [Apache Cordova - Nightly Builds](https://cordova.apache.org/contribute/nightly_builds.html) for more details. - ## Further reading * [Apache Cordova](https://cordova.apache.org/)