loganrosen / ember-cli-app-version

Adds your app's version to Ember Inspector's Info tab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ember-cli-app-version Build Status EmberObserver Badge

Adds your Ember App's version to Info tab in Ember Inspector. The version is taken from your project's package.json#version. If you add build metadata to the version, this addon will automatically append SHA to the end of the version.

Compatibility

  • Ember.js v3.24 or above
  • Ember CLI v3.24 or above
  • Node.js v12 or above

Installation

ember install ember-cli-app-version

Usage

Ember Inspector Info Tab

{{app-version}} helper

This addon provides {{app-version}} helper that allows you to show your current app version in your app.

The addon has flags to display parts of the version:

  • {{app-version versionOnly=true}} // => 2.0.1
  • {{app-version versionOnly=true showExtended=true}} // => 2.0.1-alpha.1
  • {{app-version shaOnly=true}} // => <git SHA>

Flags are false by default.

Heroku

When running on Heroku the .git folder is not present, making it impossible to fetch the git SHA. A workaround for this is adding the below in your config/environment.js:

// Heroku Git Hash support
if (process.env.SOURCE_VERSION) {
  const pkg = require('../package.json');
  const hash = process.env.SOURCE_VERSION.substr(0, 7);
  ENV['ember-cli-app-version'] = {
    version: `${pkg.version}+${hash}`
  };
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

About

Adds your app's version to Ember Inspector's Info tab

License:MIT License


Languages

Language:JavaScript 88.8%Language:HTML 10.4%Language:Handlebars 0.7%Language:CSS 0.2%