Skip to content

Commit

Permalink
feat: add boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jun 15, 2019
1 parent 5b91dd0 commit 0d5ecf1
Show file tree
Hide file tree
Showing 16 changed files with 4,027 additions and 506 deletions.
33 changes: 33 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
platform:
- x64

environment:
nodejs_version: "lts"
GITHUB_TOKEN:
secure: vRv9dttH4O8vr09RzhUdKxjM0v69auQc/oXG4/V9O6p+gr09D69Ochoa1pa/2+/I

cache:
- '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron'
- node_modules

branches:
only:
- master
- /^v\d+\.\d+\.\d+/

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- set PATH=%APPDATA%\npm;%PATH%
- npm install
- npm update

test_script:
- node --version
- npm --version
- npm run lint
- if %APPVEYOR_REPO_TAG% EQU false npm run make

build_script:
- IF %APPVEYOR_REPO_TAG% EQU true npm version %APPVEYOR_REPO_TAG_NAME% --no-git-tag-version
- IF %APPVEYOR_REPO_TAG% EQU true npm run publish
10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
extends: 'eslint-config-airbnb',
rules: {
'import/extensions': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': [2, {ignore: ['electron']}],
'linebreak-style': ['error', 'unix'],
'object-curly-spacing': ['error', 'never'],
'import/prefer-default-export': 0,
'react/prefer-stateless-function': 0,
},
};
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
out
.eslintcache
.eslintcache
.DS_Store
yarn-error.log
7 changes: 7 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
arrowParens: "avoid"
bracketSpacing: false
jsxBracketSameLine: false
semi: true
singleQuote: true
tabWidth: 2
trailingComma: "all"
47 changes: 47 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
language: node_js
node_js:
- node

os:
- linux
- osx

dist: trusty
osx_image: xcode8.3
sudo: false

notifications:
email: false

cache:
yarn: true
directories:
- node_modules
- $HOME/.cache/electron

addons:
apt:
packages:
- fakeroot
- rpm

branches:
only:
- master
- /^v\d+\.\d+\.\d+/

install:
- npm install
- npm update

script:
- npm run lint
- if [ -z $TRAVIS_TAG ]; then
if [ $TRAVIS_OS_NAME = linux ]; then
npx semantic-release;
fi;
npm run make;
else
npm version $TRAVIS_TAG --no-git-tag-version;
npm run publish;
fi
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[![Travis build status][travis-image]][travis-url]
[![Appveyor build status][appveyor-image]][appveyor-url]

[travis-image]: https://travis-ci.org/solana-labs/solminer.svg?branch=master
[travis-url]: https://travis-ci.org/solana-labs/solminer
[appveyor-image]: https://ci.appveyor.com/api/projects/status/tcu6rndl1cf8klqn/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/solana-labs/solminer/history

## Solminer
Cross-platform Solana Replicator UI
27 changes: 27 additions & 0 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
make_targets: {
win32: ['squirrel'],
darwin: ['dmg'],
linux: ['deb', 'rpm'],
},
electronPackagerConfig: {
packageManager: 'yarn',
icon: 'src/images/icon/solminer',
},
electronWinstallerConfig: {
name: 'solminer',
},
electronInstallerDMG: {
icon: 'src/images/icon/solminer.icns',
},
electronInstallerDebian: {},
electronInstallerRedhat: {},
github_repository: {
owner: 'solana-labs',
name: 'solminer',
},
windowsStoreConfig: {
packageName: '',
name: 'solminer',
},
};
63 changes: 23 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,70 +1,53 @@
{
"name": "solminer",
"productName": "solminer",
"version": "1.0.0",
"description": "My Electron application description",
"version": "0.0.0-development",
"description": "Solana Replicator Miner",
"repository": "solana-labs/solminer",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --cache --color --ext .jsx,.js src"
"eslint": "eslint --cache --color --ext .jsx,.js .",
"lint": "npm-run-all --serial pretty eslint",
"pretty": "prettier --write **/*.jsx **/*.js *.js .*.js"
},
"keywords": [],
"author": "mvines",
"author": "Solana Maintainers <[email protected]>",
"license": "MIT",
"config": {
"forge": {
"make_targets": {
"win32": [
"squirrel"
],
"darwin": [
"zip"
],
"linux": [
"deb",
"rpm"
]
},
"electronPackagerConfig": {
"packageManager": "yarn"
},
"electronWinstallerConfig": {
"name": "solminer"
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {},
"github_repository": {
"owner": "",
"name": ""
},
"windowsStoreConfig": {
"packageName": "",
"name": "solminer"
}
}
"forge": "./forge.config.js"
},
"dependencies": {
"@solana/web3.js": "^0.16.2",
"electron-compile": "^6.4.4",
"electron-devtools-installer": "^2.1.0",
"electron-squirrel-startup": "^1.0.0",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"react-hot-loader": "^3.0.0-beta.6"
"npm-run-all": "^4.1.5",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.11.0",
"update-electron-app": "^1.4.2"
},
"devDependencies": {
"@semantic-release/github": "^5.4.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "4.0.0",
"eslint": "^3",
"eslint": "^4",
"eslint-config-airbnb": "^15",
"eslint-plugin-import": "^2",
"eslint-plugin-jsx-a11y": "^5",
"eslint-plugin-react": "^7"
"eslint-plugin-react": "^7",
"prettier": "^1.18.2",
"semantic-release": "^15.13.16"
},
"optionalDependencies": {
"appdmg": "^0.6.0"
}
}
}
12 changes: 12 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/github',
{
assets: [],
},
],
],
};
41 changes: 38 additions & 3 deletions src/app.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
/* eslint no-console: "off" */
import React from 'react';
import {Connection} from '@solana/web3.js';
import {url} from './url';

const connection = new Connection(url);
console.log('connection:', url);

export default class App extends React.Component {
constructor() {
super();
this.state = {
transactionCount: null,
};
}

componentDidMount() {
this.id = setInterval(() => this.updateTransactionCount(), 1000);
}

componentWillUnmount() {
clearInterval(this.id);
}

async updateTransactionCount() {
try {
const transactionCount = await connection.getTransactionCount();
this.setState({transactionCount});
} catch (err) {
console.log('updateTransactionCount failed', err);
}
}

render() {
return (<div>
<h2>Welcome to React!</h2>
</div>);
return (
<div style={{textAlign: 'center'}}>
<br />
<h2>Coming soon...</h2>
<p />
Transaction count: {this.state.transactionCount}
</div>
);
}
}
Binary file added src/images/icon/solminer.icns
Binary file not shown.
Binary file added src/images/icon/solminer.ico
Binary file not shown.
15 changes: 11 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { app, BrowserWindow } from 'electron';
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import { enableLiveReload } from 'electron-compile';
import {app, BrowserWindow} from 'electron';
import installExtension, {
REACT_DEVELOPER_TOOLS,
} from 'electron-devtools-installer';
import {enableLiveReload} from 'electron-compile';

/*
import updateElectronApp from 'update-electron-app';
updateElectronApp();
*/

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

const isDevMode = process.execPath.match(/[\\/]electron/);

if (isDevMode) enableLiveReload({ strategy: 'react-hmr' });
if (isDevMode) enableLiveReload({strategy: 'react-hmr'});

const createWindow = async () => {
// Create the browser window.
Expand Down
7 changes: 7 additions & 0 deletions src/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @noflow

import {testnetChannelEndpoint} from '@solana/web3.js';

export const url = !process.env.LOCAL
? testnetChannelEndpoint(process.env.CHANNEL || 'stable')
: 'http://localhost:8899';
Loading

0 comments on commit 0d5ecf1

Please sign in to comment.