forked from amilajack/popcorn-time-desktop
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from TriPSs/improvements
Improvements
- Loading branch information
Showing
96 changed files
with
1,367 additions
and
787 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,6 @@ | ||
## Pull Requests | ||
The branch to be PR'd against depends on what the feature is. If the PR is adding functionality that is related to the current release, it should be made towards the latest `release-x.x.x` branch. Otherwise, it should be made towards `dev-master`. | ||
# Contributing | ||
|
||
## Setup: | ||
This project has **VERY** strict eslint rules. Adding eslint support to your text-editor will make contributing a lot easier. | ||
We love pull requests from everyone. By participating in this project, you | ||
agree to abide by the thoughtbot [code of conduct]. | ||
|
||
## Editor Configuration | ||
### Atom | ||
Recommended Development Packages: | ||
```bash | ||
apm install editorconfig es6-javascript javascript-snippets linter linter-eslint language-babel autocomplete-flow | ||
``` | ||
|
||
### Sublime | ||
* https://github.com/sindresorhus/editorconfig-sublime#readme | ||
* https://github.com/SublimeLinter/SublimeLinter3 | ||
* https://github.com/roadhump/SublimeLinter-eslint | ||
* https://github.com/babel/babel-sublime | ||
|
||
## FAQ | ||
* `CALL_AND_RETRY_LAST Allocation failed`: If your node process's heap runs out of memory (`CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory`), kill close the electron app and restart the electron process. A proper solution hasn't been found for this yet. | ||
* Build Fails: If your build fails, make sure you're using the latest node and npm versions and try running the following steps: | ||
```console | ||
npm cache clean | ||
rm -rf node_modules | ||
npm i | ||
npm rb | ||
``` | ||
If you have cloned this project and haven't pulled changes incrementally, delete the entire project directory and start from scratch | ||
If that fails, try [reinstalling xcode](https://github.com/chentsulin/electron-react-boilerplate/issues/383#issuecomment-246428151) | ||
|
||
### Others | ||
* [Editorconfig](http://editorconfig.org/#download) | ||
* [ESLint](http://eslint.org/docs/user-guide/integrations#editors) | ||
* Babel Syntax Plugin | ||
|
||
## Development Tooling | ||
The Redux devtools are hidden by default and can be shown with `ctrl + h` | ||
|
||
## Dependencies | ||
* All dependencies are `devDependencies`. | ||
|
||
## Code Conventions | ||
* Code style: | ||
* Imports must have at least two lines after them | ||
* All function declarations and expressions must include parameter type annotations. Callbacks should not be annotated | ||
* All destructured imports should be broken down into new lines. | ||
* Functional Programming | ||
* Use **pure functions** when possible | ||
* Use Array `.map`, `.reduce`, and `.filter` instead of for loops | ||
* Avoid all mutation, use the ES6 spread instead | ||
* React | ||
* Use Higher Order Components when possible | ||
* Avoid `setState` as much as possible! Use **Redux** to update the state. | ||
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const DISCLAIMER = 'disclaimer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Datastore from 'nedb' | ||
|
||
export default class { | ||
|
||
db: Datastore | ||
|
||
constructor(dbLocation: string) { | ||
this.db = new Datastore({ | ||
filename: `${dbLocation}/data/settings.db`, | ||
autoload: true, | ||
}) | ||
|
||
this.db.ensureIndex({ | ||
fieldName: 'key', | ||
unique : true, | ||
}) | ||
} | ||
|
||
add = (key: string, value: string) => new Promise(resolve => this.db.insert({ key, value }, resolve)) | ||
|
||
get = (key: string) => new Promise(resolve => this.db.find({ key }, (error, docs) => { | ||
if (error) { | ||
return resolve({ error, docs }) | ||
} | ||
|
||
if (!docs.length) { | ||
return resolve({ error, docs: false }) | ||
} | ||
|
||
if (docs.length && docs.length === 1) { | ||
return resolve({ error, docs: docs[0] }) | ||
} | ||
|
||
return resolve({ error, docs }) | ||
|
||
})) | ||
|
||
getAll = () => new Promise(resolve => this.db.find({}, (error, docs) => | ||
resolve({ error, docs }), | ||
)) | ||
|
||
update = (key: string, value: string) => new Promise(resolve => this.db.update({ key, value }, resolve)) | ||
|
||
remove = (key: string) => new Promise(resolve => this.db.remove({ key }, resolve)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import SettingsDB from './SettingsDB' | ||
|
||
export default SettingsDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export default from './Database' | ||
import Database from './Database' | ||
|
||
export default Database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.