diff --git a/app/main.development.js b/app/main.development.js
index 0a77c2c7..4de1d2c3 100644
--- a/app/main.development.js
+++ b/app/main.development.js
@@ -45,6 +45,8 @@ if (process.env.NODE_ENV !== 'development') {
}
app.whenReady().then(() => {
+ process.env.CEREBRO_VERSION = app.getVersion()
+
mainWindow = createMainWindow({
isDev,
src: `file://${__dirname}/main/index.html`, // Main window html
diff --git a/app/plugins/core/version/index.js b/app/plugins/core/version/index.js
index e7f952fa..1ecf2a53 100644
--- a/app/plugins/core/version/index.js
+++ b/app/plugins/core/version/index.js
@@ -1,7 +1,6 @@
import React from 'react'
import { search } from 'cerebro-tools'
import icon from '../icon.png'
-import { version } from '../../../../package.json'
// Settings plugin name
const NAME = 'Cerebro Version'
@@ -16,6 +15,8 @@ const KEYWORDS = [
'version'
]
+const { CEREBRO_VERSION } = process.env
+
/**
* Plugin to show app settings in results list
*
@@ -31,7 +32,7 @@ const versionPlugin = ({ term, display, actions }) => {
icon,
title: NAME,
term: NAME,
- getPreview: () => (
{version}
),
+ getPreview: () => ({CEREBRO_VERSION}
),
onSelect: (event) => {
event.preventDefault()
actions.replaceTerm(NAME)
diff --git a/docs/plugins/plugin-structure.md b/docs/plugins/plugin-structure.md
index 21b5d40e..6cea3e5c 100644
--- a/docs/plugins/plugin-structure.md
+++ b/docs/plugins/plugin-structure.md
@@ -1,4 +1,4 @@
-# Plugins → Plugin structure
+# [Plugins](../plugins.md) → Plugin structure
This is a minimum source code of your plugin:
@@ -91,7 +91,7 @@ Arguments: `event: Event`
Action, that should be executed when user selects your result. I.e, to open provided url in default browser:
-```
+```js
onSelect: (event) => actions.open(`http://www.cerebroapp.com`),
```
@@ -183,3 +183,9 @@ This object is used to specify settings that a plugin user can change. Each sett
Check `settings` [example](./examples.md#using-settings)
Look at [React Select](https://github.com/JedWatson/react-select) for more details on how the `option` type works.
+
+## Available `env` variables
+
+The following variables are available in the `process.env` object:
+
+* `CEREBRO_VERSION` – Version of Cerebro