cap-set-version-from-package v2.0.1
cap-set-version-from-package CLI is a simple utility for updating your Android or iOS build no. and version by using package.json while creating Android or iOS App using Capacitor. Very Useful in Github action for capacitor.
Usage
To Install
npm install cap-set-version-from-packageInstall it in your capacitor/ionic project
To Use
To use this package just use the below command
cap-set-version-from-package
# OR use short form
csvfpIf you are using npx then no need to install, directly use this
npx cap-set-version-from-packagePre Requires
You must have package.json file with update version. You may have android or ios directory added to your capacitor project using:
# to install capacitor Android dependency
npm install @capacitor/android @capacitor/android
# to add Android directory
npx cap add android
# to add ios directory
npx cap add ios
# to clone your dist to android
npx cap syncIncase if any directory is missing, still it will work on existing directory with a WARNING. Once done. Now you are ready to use cap-set-version-from-package
Customise Your Versioning
Using Custom Android Path
If Android folder is getting created or available in custom location.
npm
cap-set-version-from-package --androidPath=../Project2/android
# OR use short form
csvfp -a=../Project2/androidnpx
npx cap-set-version-from-package -a=../Project2/androidUsing Custom ios Path
If ios folder is getting created or available in custom location.
npm
cap-set-version-from-package --iosPath=../Project2/ios
# OR use short form
csvfp -i=../Project2/androidnpx
npx cap-set-version-from-package -i=../Project2/iosUsing Custom package.json / custom.json file Path
If package.json is available in custom location or you want use some custom json file.
npm
cap-set-version-from-package --jsonPath=./Project2/custom.json
# OR use short form
csvfp -j=./Project2/custom.jsonnpx
npx cap-set-version-from-package --jsonPath=../Project2/package.jsonFind value of custom version key inside package.json or custom.json
If custom json file contain custom key which contains version.
npm
cap-set-version-from-package --versionKey=proj-version
# OR use short form
csvfp -k=proj-versionnpx
npx cap-set-version-from-package -j=./Project2/custom.json -k=versionNameFor developers and contibuters
To install package
npm installTo use locally in system
npm i -gTo remove it locally
npm rm -gAuthor
New Feature
- Versioning iOS build.
- Customization for iOS build versioning.
Coming Soon
- Picking paths from capacitor.config.json.