1 | # ember-cli-app-version
|
2 |
|
3 | [![CI](https://github.com/ember-cli/ember-cli-app-version/workflows/CI/badge.svg)](https://github.com/ember-cli/ember-cli-app-version/actions?query=workflow%3ACI)
|
4 | [![NPM Version](https://badge.fury.io/js/ember-cli-app-version.svg)](https://badge.fury.io/js/ember-cli-app-version)
|
5 | [![Ember Observer Score](https://emberobserver.com/badges/ember-cli-app-version.svg)](https://emberobserver.com/addons/ember-cli-app-version)
|
6 |
|
7 | Adds your Ember App's version to Info tab in Ember Inspector. The version is taken from your project's package.json#version.
|
8 | If you add build metadata to the version, this addon will automatically append SHA to the end of the version.
|
9 |
|
10 | ## Compatibility
|
11 |
|
12 | - Ember.js v3.28 or above
|
13 | - Ember CLI v3.28 or above
|
14 | - Node.js v18 or above
|
15 |
|
16 | ## Installation
|
17 |
|
18 | ```
|
19 | ember install ember-cli-app-version
|
20 | ```
|
21 |
|
22 | ## Usage
|
23 |
|
24 | ![Ember Inspector Info Tab](https://www.evernote.com/shard/s51/sh/c2f52608-bc17-4d5c-ac76-dec044eeb2e2/2f08de0cfb77217502cfc3a9188d84bf/res/3fb1d3d9-d809-48f6-9d3b-6e9a4af29892/skitch.png?resizeSmall&width=832)
|
25 |
|
26 | ## {{app-version}} helper
|
27 |
|
28 | This addon provides `{{app-version}}` helper that allows you to show your current app version in your app.
|
29 |
|
30 | The addon has flags to display parts of the version:
|
31 |
|
32 | - `{{app-version versionOnly=true}} // => 2.0.1`
|
33 | - `{{app-version versionOnly=true showExtended=true}} // => 2.0.1-alpha.1`
|
34 | - `{{app-version shaOnly=true}} // => <git SHA>`
|
35 |
|
36 | Flags are `false` by default.
|
37 |
|
38 | ## Heroku
|
39 |
|
40 | 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`:
|
41 |
|
42 | ```js
|
43 | // Heroku Git Hash support
|
44 | if (process.env.SOURCE_VERSION) {
|
45 | const pkg = require('../package.json');
|
46 | const hash = process.env.SOURCE_VERSION.substr(0, 7);
|
47 | ENV['ember-cli-app-version'] = {
|
48 | version: `${pkg.version}+${hash}`,
|
49 | };
|
50 | }
|
51 | ```
|
52 |
|
53 | ## Contributing
|
54 |
|
55 | See the [Contributing](CONTRIBUTING.md) guide for details.
|
56 |
|
57 | ## License
|
58 |
|
59 | This project is licensed under the [MIT License](LICENSE.md).
|