Capacitor App Identifier and Name Updater
capacitor-identity is a focused command-line interface (CLI) tool designed to simplify the process of updating the application ID (bundle identifier for iOS, `applicationId` for Android) and the display name (`appName`) for Capacitor-based mobile applications. Currently at version 1.0.4, it serves as a utility for developers needing to quickly configure their Capacitor projects for different environments (e.g., staging vs. production) or rebranding efforts. Its primary differentiator is its simplicity and direct approach to modifying core native project settings without requiring manual edits in Xcode or Android Studio. It is executed via `npx` and directly manipulates the necessary configuration files within the Capacitor project structure. The package is likely updated on an as-needed basis to support new Capacitor versions or address specific platform changes, rather than following a frequent release cadence, given its specialized function.
Common errors
-
Error: ENOENT: no such file or directory, open 'capacitor.config.ts'
cause The `capacitor-identity` command was executed outside the root directory of a Capacitor project.fixChange your current directory to your Capacitor project's root, then re-run `npx capacitor-identity ...`. -
Error: Missing required argument: bundleId
cause The `--bundleId` argument was omitted when running the `capacitor-identity` command.fixInclude the `--bundleId com.your.app` argument in your `npx capacitor-identity` command. -
Error: Missing required argument: appName
cause The `--appName` argument was omitted when running the `capacitor-identity` command.fixInclude the `--appName "Your App Name"` argument in your `npx capacitor-identity` command.
Warnings
- gotcha Ensure you run `capacitor-identity` from the root directory of your Capacitor project. Executing it elsewhere will result in 'file not found' errors or incorrect modifications.
- gotcha The `--bundleId` and `--appName` flags are mandatory for `capacitor-identity` to perform its updates. Omitting either will lead to an `Error: Missing required argument` and the operation will not complete.
- gotcha After running `capacitor-identity`, it is crucial to rebuild your native projects (`npx cap sync && npx cap open [ios|android]`) to ensure the changes are picked up by Xcode and Android Studio.
Install
-
npm install capacitor-identity -
yarn add capacitor-identity -
pnpm add capacitor-identity
Imports
- capacitor-identity (CLI)
import { updateIdentity } from 'capacitor-identity';npx capacitor-identity --bundleId com.example.newapp --appName "New App Staging"
Quickstart
npx capacitor-identity --bundleId com.example.newapp --appName "New App Staging" # After running, ensure to sync and rebuild your native projects: npx cap sync npx cap open ios npx cap open android