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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cross-version

v3.0.0

Published

Set android and ios versions in cross platforms like ionic-capacitor

Downloads

13

Readme

cross-version

Cross version setter for platforms like ionic-capacitor.

Description

In cross platform app development it is sometimes hassle to set versions in targetting platform, like in case of Ionic Capacitor project it is Android or iOS. Many web developers who come from web background often find it hard to locate the required file or property to update native app's version. This package addresses to solve that with very simple and intuitive commands.

Installation

Prefer global installation if you want to run commands directly.

npm install -g cross-version

or locally install:

npm install cross-version

Or use npx.

npx cross-version --versionCode 234

Usage

Make sure you run command in ionic root project.

Full command (global install):

cross-version --versionCode 234 --versionName 2.3.4 --bundleVersion 2244 --shortVersion 22.64.5

Where:

versionCode: is for Android's version code, this is integer type (kind of build number).

versionName: is for Android's version name, visible to users, this is string type.

shortVersion: is for iOS's version, this is the version that user sees, its a string value.

bundleVersion: is for iOS's build number, it is string.

You can run any argument in any combination, in any sequence, arguments which are provided are used others are ignored.

For e.g.

cross-version --versionCode 234 --versionName 2.3.4 // only sets android versions

and

cross-version --bundleVersion 2244 --shortVersion 22.64.5 // only sets iOS versions

or even:

cross-version --shortVersion 22.64.5 --versionName 2.3.4 // only set user visible versions for Android and iOS

All arguments are optional, but case sensitive.

New in v3.0.0

  • Optional iOS and Android config in package.json, now you can set any one of them and it will work. Refer to package.json
{

...

  "ios": {
    "bundleVersion": 2233,
    "shortVersion": "2.2.44"
  }

...
}

This would give error previously because of missing Android config but now it is supported.

  • iOS versioning is moved to project config (.pbxproj) file to avoid editing Info.plist directly. This is same file which gets updated when we change version from Xcode GUI.

Auto version bump

Now you can bump versions automatically:

cross-version --bumpMajorVersion  // bumps both ios and android's major versions
// OR
cross-version --bumpAndroidMinorVersion  // bumps only android minor version

Details: | Flag | Description | | --- | --- | | bumpMajorVersion | Bumps major versions in both ios and android | | bumpMinorVersion | Bumps minor versions in both ios and android | | bumpPatchVersion | Bumps patch versions in both ios and android | | bumpAndroidMajorVersion | Bumps major version in android only | | bumpAndroidMinorVersion | Bumps minor version in android only | | bumpAndroidPatchVersion | Bumps patch version in android only | | bumpIosMajorVersion | Bumps major version in ios only | | bumpIosMinorVersion | Bumps minor version in ios only | | bumpIosPatchVersion | Bumps patch version in ios only |

Along with that, this will also update bundle version (or current project version) in iOS and versionCode in android based on semVersion.

Caveats: Minor and Patch version should not exceed more than 2 digits.

New in v2.0.0

  • Fixed: Bug in Android version setting
  • Added: Support for react-native projects. (No difference in usage, same as above)
  • Added: Support for reading versions from package.json

Start by adding version information in package.json in following format

{

...

  "android": {
    "vesionCode": 2233,
    "versionName": "2.2.44"
  },
  "ios": {
    "bundleVersion": 2233,
    "shortVersion": "2.2.44"
  }

...
}

Then run (in case of global install):

cross-version --auto  // picks version data from package.json

or (in case of local install):

npx cross-version --auto  // picks version data from package.json

Convenient

Currently, the package targets ionic-capacitor, so you don't need to worry about where iOS and Android build files are. Just make sure you already have android and ios folders created in your directory where you run the command.