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

ionic-version

v1.0.3

Published

Version your Ionic app in a `npm version` fashion.

Downloads

337

Readme

ionic-version Build Status

Seamlessly shadows the behaviour of npm version.

npm-scripts hook (automatic method)

Setup

npm install ionic-version --save-dev
# or
yarn add ionic-version --dev

Hook into the "version" or "postversion" npm script in your app's package.json:

{
	"name": "myApp",
	"version": "0.0.1",
	"author": "Ionic Framework",
	"homepage": "http://ionicframework.com/",
	"private": true,
	"scripts": {
		"clean": "ionic-app-scripts clean",
		"build": "ionic-app-scripts build",
		"lint": "ionic-app-scripts lint",
		"ionic:build": "ionic-app-scripts build",
		"ionic:serve": "ionic-app-scripts serve",
+		"postversion": "ionic-version"
	},
	// ...
}

Usage

Before you publish a new build of your app, run npm version <newversion>.

ionic-version will then update your config.xml and therefore your platforms/ code during build. Depending on the script and options you choose, it can also automatically amend the version bump commit and update the Git tag created by npm version. This method should be useful in most cases. If you need more control, take a look at the CLI and options below.

CLI

Setup

npm install -g ionic-version
# or
yarn global add ionic-version

Example usage

cd myApp/
npm version patch
ionic-version

Options

-V, --version      output the version number
-a, --amend        Amend the previous commit. Also updates the latest Git tag to point to the amended commit. This is done automatically when ionic-version is run from the "version" or "postversion" npm script. Use "--never-amend" if you never want to amend.
--skip-tag         For use with "--amend", if you don't want to update Git tags.
-A, --never-amend  Never amend the previous commit.
-q, --quiet        Be quiet, only report errors.
-h, --help         output usage information

You can apply these options to the "version" or "postversion" script too. If for example you want to commit the changes made by ionic-version yourself, add the "--never-amend" option:

{
	// ...
	"scripts": {
		"postversion": "ionic-version --never-amend"
	},
	// ...
}

API

import version from "ionic-version";

async function doSomething() {
	const versionResult = await version({
		amend: true
		// ...
	});
}

// or

version({
	amend: true
	// ...
})
	.then(commitHash => {
		console.log(commitHash);
	})
	.catch(err => {
		console.error(err);
	});

Functions

Typedefs

version(program, projectPath) ⇒ Promise.<(string|Error)>

Versions your app

Kind: global function
Returns: Promise.<(string|Error)> - A promise which resolves with the last commit hash

| Param | Type | Description | | ----------- | ------------------- | --------------------------------------- | | program | Object | commander/CLI-style options, camelCased | | projectPath | string | Path to your Ionic project |

Promise

Custom type definition for Promises

Kind: global typedef
Properties

| Name | Type | Description | | ------ | ------------------ | ------------------------------------------------------------------ | | result | * | See the implementing function for the resolve type and description | | result | Error | Rejection error object |

See also