npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ea-utilities/build-capacitor

v1.0.6

Published

This CLI tool automates the process of setting up the necessary environment and building Capacitor.js applications, specifically targeting Android. It handles the installation and configuration of Java Development Kits (JDKs), Android SDK command-line too

Readme

Capacitor Build CLI

This CLI tool automates the process of setting up the necessary environment and building Capacitor.js applications, specifically targeting Android. It handles the installation and configuration of Java Development Kits (JDKs), Android SDK command-line tools, and required Android SDK components, followed by executing the Gradle build process.

Support for Windows and Linux (some distributions) has been tested.

Installing CapacitorJs

Installation

To use this CLI, ensure you have Node.js installed. Then, you can run it directly from your project directory.

npm install @ea-utilities/build-capacitor -D

Usage

This CLI provides the following commands:

Commands

build command

Builds a Capacitor project.

Syntax
npx build-capacitor build [options]
Options
  • --output-file, -o

    • Description: Specifies the output path and filename for the generated APK.
    • Type: string
    • Default: dist/app (e.g., dist/app.apk)
    • Example: npx build-capacitor build -o C:/apks/myapp-debug.apk
  • --build-type, -t

    • Description: Defines the type of build to perform.
    • Type: string
    • Default: debug
    • Possible Values: debug, release (or other Gradle build types configured in your project)
    • Example: npx build-capacitor build -t debug
  • --format, -f

    • Description: Specifies the format(s) to build.
    • Type: string
    • Default: apk
    • Possible Values: apk, aab (comma-separated for multiple)
    • Example: npx build-capacitor build -f apk,aab
Examples
  • Build a debug APK (default output: dist/app.apk):

    npx build-capacitor build
  • Build a debug APK and specify an output file:

    npx build-capacitor build -t debug -o C:/apks/myapp-debug.apk

clean command

Removes all downloaded applications and related files.

Syntax
npx build-capacitor clean

clean-cache command

Cleans only the Gradle cache.

Syntax
npx build-capacitor clean-cache

Build Command Details

The build command orchestrates the following steps:

  1. Environment Setup:

    • Java Development Kit (JDK) Configuration: Downloads and configures JDK 17 and JDK 21. The build process will first attempt to use JDK 17, and if that fails, it will fall back to JDK 21.
    • Android Command-Line Tools: Downloads and sets up the necessary Android command-line tools (e.g., sdkmanager).
    • Android SDK Component Installation: Installs required Android SDK build tools (version 34.0.0) and platform API (API level 34). It also handles the acceptance of Android SDK licenses.
  2. Gradle Build:

    • Executes the gradle assemble command to compile the Capacitor Android project. The build type (debug or release) is passed to Gradle.
  3. APK Relocation:

    • Moves the generated APK file from the Gradle build output directory to the specified --output-file location.

Full Workflow Example (Angular with Capacitor)

This section provides a step-by-step guide for setting up and building an Angular Capacitor application using this CLI.

  1. Create a new Angular project:

    npm i -g @angular/cli@latest
    ng new myapp
    cd myapp
  2. Install Capacitor:

    npm install -g @capacitor/cli
    npm i @capacitor/android
  3. Install this build CLI:

    npm install @ea-utilities/build-capacitor -D
  4. Initialize Capacitor and add Android platform:

    npx cap init "myapp" "com.example.myapp" --web-dir "dist/myapp/browser"
    npx cap add android
  5. Build and Sync (for new changes): Whenever you make changes to your Angular application, build it and sync with Capacitor before building the Android APK.

    ng build
    npx cap sync
    npx build-capacitor build

    The first build might take some time as it downloads and configures dependencies. Subsequent builds will be faster.

    The default output APK will be located at dist/app.apk.