Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD]: updating Cerebro core #559

Merged
merged 63 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6f53d9a
fix: removeNoise function not working correctly
dubisdev May 18, 2022
b300270
style: fix linter errors
dubisdev May 26, 2022
61da3ab
chore(deps): use exact dependencies
dubisdev May 26, 2022
ed2be79
CI: try build gh action
dubisdev May 26, 2022
589c3c8
ci: fix gh token
dubisdev May 26, 2022
b5a88dc
ci: fix repo
dubisdev May 26, 2022
fa9ac98
chore: small refactor
dubisdev May 29, 2022
dfe8a68
chore: rm deprecated proptypes - use prop-types
dubisdev May 29, 2022
6618214
chore: small refactor
dubisdev May 29, 2022
a3bd284
fix: can not read getPrimarydisplay of undefined
dubisdev May 29, 2022
ad405dc
chore: update electron to v19
dubisdev May 29, 2022
096c344
chore: update deps
dubisdev May 30, 2022
e6b1389
chore: update deps
dubisdev May 30, 2022
a12d4b4
chore: use new electron whenReady
dubisdev May 30, 2022
4298828
chore: lint webpack configs
dubisdev May 30, 2022
ed6a44b
CI: delete unused files
dubisdev May 30, 2022
69f3581
CI: run on workflow dispatch
dubisdev May 30, 2022
a8e795d
chore: update dev deps
dubisdev May 31, 2022
2ab6005
chore: update deps
dubisdev May 31, 2022
df995cb
deps: update url-loader
dubisdev May 31, 2022
a5fd922
chore: fix plugin installation errors
dubisdev Jun 1, 2022
209dae8
chore: fix building errors
dubisdev Jun 1, 2022
6158eb7
CI: run scripts in parallel
dubisdev Jun 1, 2022
4b152e7
chore: update babel
dubisdev Jun 2, 2022
7913392
chore: update webpack dev middleware
dubisdev Jun 2, 2022
a6658eb
chore: update cross-env
dubisdev Jun 2, 2022
9f01631
chore: update redux
dubisdev Jun 2, 2022
b1ea834
chore: update linter config
dubisdev Jun 2, 2022
1f0b6be
fix: quit app not working
dubisdev Jun 2, 2022
57d2e9e
chore: remove unused code
dubisdev Jun 2, 2022
a1c12fa
fix: remote module in background window
dubisdev Jun 3, 2022
90a7845
chore: update deps, autoinstall app deps
dubisdev Jun 18, 2022
6e0c7b6
docs: update readme
dubisdev Jun 22, 2022
ab2b039
chore: minor fixes
dubisdev Jun 27, 2022
575d52a
docs: two package.json msg + delete broken links
dubisdev Jun 27, 2022
57ba344
ci: update workflows, work when tags pushed
dubisdev Jun 27, 2022
7a70786
ci: test CI
dubisdev Jun 27, 2022
75aa040
chore: fix babel target
dubisdev Jun 27, 2022
1fa19fe
CI: test new release
dubisdev Jun 27, 2022
7761981
CI: test on release
dubisdev Jun 27, 2022
174d7d7
CI: run on gh release
dubisdev Jun 27, 2022
09788ef
Merge pull request #1 from dubisdev/testing-ci
dubisdev Jun 27, 2022
73314c8
Update build.yml
dubisdev Jun 27, 2022
7120434
Update build.yml
dubisdev Jun 27, 2022
664888a
docs: update release configuration
dubisdev Jun 27, 2022
63edcd8
docs: target info
dubisdev Jun 27, 2022
1ccc4f9
docs: how to publish a release
dubisdev Jun 27, 2022
eff722a
Merge branch 'master' into dev
dubisdev Jun 27, 2022
f648563
CI: run on git tags
dubisdev Jun 27, 2022
ef828ed
chore: move to @cerebroapp/cerebro-ui
dubisdev Jul 1, 2022
5f283c5
chore: add @cerebroapp/cerebro-ui dependency
dubisdev Jul 1, 2022
c16f0d2
feat: support @cerebroapp in plugin names
dubisdev Jul 1, 2022
3c2580d
fix: handle @cerebroapp directory
dubisdev Jul 2, 2022
70d6d04
chore: refactor promises
dubisdev Jul 2, 2022
5c3faee
chore: small refactor
dubisdev Jul 2, 2022
d1175fb
chore: fix tests script
dubisdev Jul 3, 2022
3211f24
CI: add tests to publish workflow
dubisdev Jul 3, 2022
a259ea4
chore: adjusting json package description and version
ogustavo-pereira Jul 21, 2022
065e998
chore: add new rule in eslint
ogustavo-pereira Jul 21, 2022
9e4560d
doc: update readme
ogustavo-pereira Jul 21, 2022
483ab50
feat: add template string
ogustavo-pereira Jul 21, 2022
d02044f
refactor: fix lint problems
ogustavo-pereira Jul 21, 2022
81f9b6f
chore: remove comments
ogustavo-pereira Jul 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

10 changes: 6 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"extends": "airbnb",
"env": {
"browser": true,
Expand All @@ -16,6 +16,7 @@
"no-useless-escape": 0,
"no-mixed-operators": "off",
"no-continue": "off",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"import/no-extraneous-dependencies": "off",
"import/imports-first": "off",
"import/extensions": "off",
Expand All @@ -32,7 +33,8 @@
"prefer-spread": "off",
"class-methods-use-this": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/label-has-for": "off"
"jsx-a11y/label-has-for": "off",
"linebreak-style": 0
},
"plugins": [
"jsx-a11y",
Expand All @@ -43,8 +45,8 @@
"settings": {
"import/core-modules": "electron",
"import/resolver": {
"webpack": {
"config": "../webpack.config.base.js"
"node": {
"paths": ["app"]
}
}
}
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build/release

on:
push:
tags:
- '*'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn
- run: yarn test --detectOpenHandles --forceExit

release:
needs: test
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 16

- name: Build & Release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}
release: true
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,26 @@ First, clone the repo via git:
```bash
$ git clone https://github.com/cerebroapp/cerebro.git cerebro
```
Open the project

```bash
$ cd cerebro
```

And then install dependencies:


```bash
$ cd cerebro && yarn && cd ./app && yarn && cd ../
yarn
```

### Run

```bash
$ yarn run dev
```

> Note: requires a node version >=6.x
> Note: requires a node version >=16.x

### Resolve common issues
1. `AssertionError: Current node version is not supported for development` on npm postinstall.
Expand Down Expand Up @@ -90,19 +97,26 @@ Use this command to build `.app` file:
$ yarn build
```

## For developers

### Publish a release

## Be in touch
Follow to be notified about new releases or learn some productivity tips with Cerebro:
CerebroApp is using GH actions to build the app and publish it to a release. To publish a new release follow the steps below:

* [Twitter](https://twitter.com/cerebro_app)
* [Facebook](https://www.facebook.com/cerebroapp)
* [Google+](https://plus.google.com/104292436165594177472)
* [VK.com](https://vk.com/cerebroapp) – channel in Russian
1. Update the version on both `package.json` and `app/package.json` files.
2. Create a release with from GH and publish it. 🚧 The release **tag** SHOULD NOT contain the `v` prefix (❌ `v0.1.2` → ✅`0.1.2`).
3. Complete the name with a name and a description of the release.
4. The GH action is triggered and the release is updated when executables are built.

Or [subscribe to newsletter](http://eepurl.com/coiKU9) to be notified only about big releases.
### Add dependencies

CerebroApp was created from an [old version of electron-react-boilerplate](https://github.com/cerebroapp/cerebro/commit/57b6e28c0f64beae8948cf17f099fa5d6236ae3c) and uses a two package.json file structure. If you are interested in developing a new feature, you should read about this structure in the [electron-react-boilerplate documentation](https://www.electron.build/tutorials/two-package-structure.html).


# Support

## Support
### Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/cerebro#backer)]

<a href="https://opencollective.com/cerebro/backer/0/website" target="_blank"><img src="https://opencollective.com/cerebro/backer/0/avatar.svg"></a>
Expand Down Expand Up @@ -171,4 +185,5 @@ Become a sponsor and get your logo on our README on Github with a link to your s
<a href="https://opencollective.com/cerebro/sponsor/29/website" target="_blank"><img src="https://opencollective.com/cerebro/sponsor/29/avatar.svg"></a>

## License
MIT © [Alexandr Subbotin](https://github.com/KELiON)

MIT © [Cerebro App](https://github.com/cerebroapp/cerebro/blob/master/LICENSE)
5 changes: 5 additions & 0 deletions __mocks__/@electron/remote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
app: {
getPath: jest.fn(),
}
}
8 changes: 8 additions & 0 deletions __mocks__/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
app: {
getPath: jest.fn(),
},
ipcRenderer: {
on: jest.fn(),
}
}
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = ''
3 changes: 0 additions & 3 deletions __mocks__/lib/config.js

This file was deleted.

3 changes: 0 additions & 3 deletions __mocks__/lib/plugins.js

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/plugins.js

This file was deleted.

16 changes: 8 additions & 8 deletions app/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ import ReactDOM from 'react-dom'
import plugins from 'plugins'
import { on, send } from 'lib/rpc'
import { settings as pluginSettings, modulesDirectory } from 'lib/plugins'
import fixPath from 'fix-path'

require('fix-path')()
fixPath()

global.React = React
global.ReactDOM = ReactDOM
global.isBackground = true

on('initializePluginAsync', ({ name }) => {
console.group(`Initialize async plugin ${name}`)

try {
const { initializeAsync } = plugins[name]
? plugins[name]
: window.require(`${modulesDirectory}/${name}`)

if (!initializeAsync) {
console.log('no `initializeAsync` function, skipped')
return
}

console.log('running `initializeAsync`')
initializeAsync((data) => {
console.log('Done! Sending data back to main window')
// Send message back to main window with initialization result
send('plugin.message', {
name,
data,
})
send('plugin.message', { name, data })
}, pluginSettings.getUserSettings(name))
} catch (err) {
console.log('Failed', err)
}
} catch (err) { console.log('Failed', err) }

console.groupEnd()
})

Expand Down
1 change: 1 addition & 0 deletions app/background/createWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default ({ src }) => {
contextIsolation: false
},
})

backgroundWindow.loadURL(src)
return backgroundWindow
}
4 changes: 3 additions & 1 deletion app/background/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
(function() {
const script = document.createElement('script');
script.async = true;
script.src = (process.env.HOT) ? 'http://localhost:3000/dist/background.bundle.js' : '../dist/background.bundle.js';
script.src = (process.env.HOT)
? 'http://localhost:3000/dist/background.bundle.js'
: '../dist/background.bundle.js';
document.write(script.outerHTML);
}());
</script>
Expand Down
15 changes: 8 additions & 7 deletions app/initAutoUpdater.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as os from "os";
import { dialog, } from 'electron'
import { autoUpdater } from "electron-updater";
import { autoUpdater } from 'electron-updater'

const event = 'update-downloaded'

const TEN_SECONDS = 10 * 1000
const ONE_HOUR = 60 * 60 * 1000

export default (w) => {
if (process.env.NODE_ENV === 'development' || os.platform() === "linux") {
if (process.env.NODE_ENV === 'development' || process.platform === 'linux') {
return
}

Expand All @@ -18,9 +19,9 @@ export default (w) => {

setTimeout(() => {
autoUpdater.checkForUpdates()
}, 10 * 1000)
}, TEN_SECONDS)

setInterval(() => {
autoUpdater.checkForUpdates()
}, 60 * 60 * 1000)
}
}, ONE_HOUR)
}
13 changes: 9 additions & 4 deletions app/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { app, remote, ipcRenderer } from 'electron'
import { app, ipcRenderer } from 'electron'
import fs from 'fs'
import { memoize } from 'cerebro-tools'
import { trackEvent } from './trackEvent'
import loadThemes from './loadThemes'

const remote = process.type === 'browser'
? undefined
: require('@electron/remote')

const electronApp = remote ? remote.app : app

// initiate portable mode
Expand Down Expand Up @@ -55,13 +59,13 @@ const readConfig = () => {
*/
const get = (key) => {
let config

if (!fs.existsSync(CONFIG_FILE)) {
// Save default config to local storage
config = defaultSettings()
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2))
} else {
config = readConfig()
}
} else { config = readConfig() }

return config[key]
}

Expand All @@ -87,6 +91,7 @@ const set = (key, value) => {
event: `Change ${key}`,
label: value
})

if (ipcRenderer) {
console.log('notify main process', key, value)
// Notify main process about settings changes
Expand Down
Loading