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

@saritasa/cordova-build-utils

v1.0.2

Published

Cordova specific utils to prepare build of an application.

Downloads

199

Readme

Cordova build tools

This package contains Cordova specific build utilities.

Tips:

Use hooks/setVersionAndBundleId as "before_build" cordova hook, because on "before_prepare" build config options are not presented in a Cordova context instance on this step.

Features:

  1. Versioning - uses unified approach to set version code and version name for both: Android and iOS.
  2. Build number information - adds build number info like 1.0.0.build-100 to show builds from CI in Firebase App Distribution as different builds e.g.
  3. Set bundle ID - use bundleId from extended Cordova build config as id attribute of widget in config.xml. Both sections (debug and release) can contain different bundle ID.

Versioning

The setVersionAndBundleId hook retrieve version from the main package.json (used as source of truth) using the utils/version.js and create two kind of versions:

  1. Version name (version attribute in config.xml) - SemVer from the package.json as is. Uses as "displayable" value.
  2. Version code (android-versionCode and ios-CFBundleVersion) - number presentation of version. Uses approach of Android platform (see docs for more details). We reuse the same approach for both platforms to get unified approach for version code to prevent confusing and easily detect that Android and iOS applications are the same version or not.

Build number information

The utils/version.js also retrieve build number from the BUILD_NUMBER environment variable and if it presented, the setVersionAndBundleId hook add this information to the version name or skip this step if the BUILD_NUMBER is not presented or is empty/not a number.

The BUILD_NUMBER automatically provided by Jenkins e.g. and you don't have to do it manually but if you want skip this step (usually for prod buildings) you can just set it to an empty string before call build command.

BUILD_NUMBER='' <build command>

Set bundle ID

This utilities package support dynamically changing bundleId of an application during building process. The setVersionAndBundleId retrieves bundleId property from certain section (platform + mode) of used build.json file. If the bundleId is not presented then this step will be skipped and original bundleId in config.xml will no be changed.

For instance if you want to use different bundle ID for release build you should add bundleId into the release section for certain platforms:

{
	"ios": {
		"debug": {
			// Not bundleId presented then bundleID from config.xml will be used
		},
		"release": {
			...,
      "bundleId": "com.bundleid.for.release.mode"
		}
	},
	"android": {
    "debug": {
			// Not bundleId presented then bundleID from config.xml will be used
		},
		"release": {
			...,
      "bundleId": "com.bundleid.for.release.mode"
		}
	}
}