Skip to content

Commit

Permalink
feat: add new STX icon, closes #247
Browse files Browse the repository at this point in the history
feat: add metadata for linux installers, closes #263

feat: update eslint/prettier config to stacks

feat: split electron configs

feat: add stx network matrix for debug

fix: windows buildgap

feat: test something else

feat: use the alternate config

feat: debug windows

fix: testnet/mainnet loading from same config

fix: linux icons

fix: settimeout errors
  • Loading branch information
kyranjamie committed Dec 30, 2020
1 parent 9c4f56a commit 492ad88
Show file tree
Hide file tree
Showing 28 changed files with 1,294 additions and 532 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
extends: ['@blockstack/eslint-config', 'plugin:react-hooks/recommended'],
extends: ['@stacks/eslint-config', 'plugin:react-hooks/recommended'],
plugins: ['react'],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/debug-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
stx_network: [testnet, mainnet]
include:
- os: macos-latest
NPM_COMMAND: mac
Expand All @@ -20,18 +21,6 @@ jobs:
NPM_COMMAND: win

steps:
- uses: lucasmotta/pull-request-sticky-header@1.0.0
# Only update it once per build
if: matrix.os == 'ubuntu-latest'
with:
header: '> _Currently building new release, please wait for the latest_&nbsp; <img src="https://user-images.githubusercontent.com/1618764/97873036-51dfb200-1d17-11eb-89f5-0a922dc3ac92.gif" width="12" />'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

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

Expand All @@ -58,10 +47,20 @@ jobs:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 10

#
# Windows build breaks when using the package.json script to install `app/` packages
# using separate run to install those packages separately
- name: Install packages
run: yarn
run: yarn --frozen-lockfile --ignore-scripts
env:
STX_NETWORK: ${{ matrix.stx_network }}

- name: Install `app/` packages
run: cd app && yarn --frozen-lockfile --ignore-scripts
env:
STX_NETWORK: ${{ matrix.stx_network }}

- name: Build releases
run: ./node_modules/.bin/cross-env DEBUG_PROD=true yarn package-${{ matrix.NPM_COMMAND }}
Expand All @@ -70,27 +69,30 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST: ${{ steps.vars.outputs.pull_request_id }}
BRANCH_NAME: ${{ steps.vars.outputs.branch_name }}
STX_NETWORK: ${{ matrix.stx_network }}

- run: ls -R release

- uses: actions/upload-artifact@v2
name: Upload Windows build
name: Upload Windows builds
if: matrix.os == 'windows-latest'
with:
name: stacks-wallet-${{ steps.vars.outputs.version }}-windows
name: stacks-wallet-${{ steps.vars.outputs.version }}-${{ matrix.stx_network }}-windows
path: |
release/**/*.exe
release/**/*.msi
- uses: actions/upload-artifact@v2
name: Upload MacOS build
name: Upload MacOS builds
if: matrix.os == 'macos-latest'
with:
name: stacks-wallet-${{ steps.vars.outputs.version }}-macos
name: stacks-wallet-${{ steps.vars.outputs.version }}-${{ matrix.stx_network }}-macos
path: release/**/*.dmg

- uses: actions/upload-artifact@v2
name: Upload Linux build
name: Upload Linux builds
if: matrix.os == 'ubuntu-latest'
with:
name: stacks-wallet-${{ steps.vars.outputs.version }}-linux
name: stacks-wallet-${{ steps.vars.outputs.version }}-${{ matrix.stx_network }}-linux
path: |
release/**/*.deb
release/**/*.rpm
Expand Down
40 changes: 19 additions & 21 deletions .github/workflows/stacks-wallet.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: stacks-wallet
name: Wallet Release

on:
push:
Expand All @@ -15,24 +15,6 @@ on:
workflow_dispatch:

jobs:
notify-start:
runs-on: ubuntu-latest
# Only run on non-PR events or only PRs that aren't from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository

steps:
# - name: Discord notification
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed.'

- uses: lucasmotta/pull-request-sticky-header@1.0.0
with:
header: '> _Currently building new release, please wait for the latest_&nbsp; <img src="https://user-images.githubusercontent.com/1618764/97873036-51dfb200-1d17-11eb-89f5-0a922dc3ac92.gif" width="12" />'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -60,6 +42,8 @@ jobs:
run: |
yarn
yarn add -ED @actions/core
env:
STX_NETWORK: testnet

- name: Lint eslint
run: yarn lint:eslint
Expand Down Expand Up @@ -90,9 +74,13 @@ jobs:
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
env:
STX_NETWORK: testnet

- name: Build prod
run: yarn build
env:
STX_NETWORK: testnet

- name: Run jest
run: yarn test
Expand Down Expand Up @@ -136,8 +124,18 @@ jobs:
with:
node-version: 10

#
# Windows build breaks when using the package.json script to install `app/` packages
# using separate run to install those packages separately
- name: Install packages
run: yarn
run: yarn --frozen-lockfile --ignore-scripts
env:
STX_NETWORK: testnet

- name: Install `app/` packages
run: cd app && yarn --frozen-lockfile --ignore-scripts
env:
STX_NETWORK: testnet

- name: Build releases
run: ./node_modules/.bin/cross-env yarn package-${{ matrix.NPM_COMMAND }}
Expand All @@ -146,6 +144,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST: ${{ steps.vars.outputs.pull_request_id }}
BRANCH_NAME: ${{ steps.vars.outputs.branch_name }}
STX_NETWORK: testnet

- uses: actions/upload-artifact@v2
name: Windows upload
Expand Down Expand Up @@ -209,7 +208,6 @@ jobs:
notify-end:
runs-on: ubuntu-latest
needs:
- notify-start
- lint
- test
- build
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:

- name: Install dependencies
run: yarn
env:
STX_NETWORK: testnet

- name: Build
run: yarn tsc
2 changes: 1 addition & 1 deletion app/api/watch-contract-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ export function watchContractExecution(args: WatchContractExecutionArgs) {
return resolve(true);
}
};
const interval: number = setInterval(() => void fetchTx(interval), pollingInterval);
const interval: number = window.setInterval(() => void fetchTx(interval), pollingInterval);
});
}
4 changes: 3 additions & 1 deletion app/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const createWindow = async () => {
defaultHeight: 728,
});

console.log(path.join(__dirname, '../resources/icon-512x512.png'));

mainWindow = new BrowserWindow({
show: false,
x: mainWindowState.x,
Expand All @@ -79,7 +81,7 @@ const createWindow = async () => {
height: mainWindowState.height,
frame: process.platform !== 'darwin',
titleBarStyle: process.platform === 'darwin' ? 'hidden' : 'default',
icon: path.join(__dirname, '../resources/icon-no-padding-512x512.png'),
icon: path.join(__dirname, '../resources/icon-512x512.png'),
webPreferences: {
disableBlinkFeatures: 'Auxclick',
webSecurity: true,
Expand Down
2 changes: 1 addition & 1 deletion app/modals/reset-wallet/reset-wallet-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ResetWalletModal: FC<ResetWalletModalProps> = ({ isOpen, onClose })
// Focusing cancel btn ensures any key press of: enter, space, esc
// will cancel the pending operation
cancelBtnRef.current?.focus();
timer.current = setTimeout(() => {
timer.current = window.setTimeout(() => {
void clearDiskStorage();
void api.reloadApp();
}, PANIC_CANCEL_TIME);
Expand Down
3 changes: 1 addition & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "stacks-wallet",
"productName": "Stacks Wallet",
"version": "4.0.0-beta.8",
"description": "",
"description": "Stacks Wallet v4 — Participate in Stacking to earn bitcoin rewards",
"main": "./main.prod.js",
"author": {
"email": "info@blockstack.com",
Expand Down
97 changes: 97 additions & 0 deletions electron-builder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const deepMerge = require('deepmerge');

const network = process.env.STX_NETWORK;

console.log('----------------------------------------------------');
console.log(network);
console.log('----------------------------------------------------');

if (!network) throw new Error('Must define STX_NETWORK environment variable');

if (!['mainnet', 'testnet'].includes(network))
throw new Error(`Unknown STX_NETWORK type of: ${String(network)}`);

const baseConfig = {
files: ['dist/', 'node_modules/', 'app.html', 'main.prod.js', 'main.prod.js.map', 'package.json'],
dmg: {
contents: [
{
x: 130,
y: 220,
},
{
x: 410,
y: 220,
type: 'link',
path: '/Applications',
},
],
},
win: {
target: ['nsis', 'msi'],
},
mac: {
hardenedRuntime: false,
category: 'public.app-category.finance',
},
linux: {
target: ['deb', 'rpm', 'AppImage'],
category: 'Development',
},
directories: {
buildResources: 'resources',
output: 'release',
},
publish: {
provider: 'github',
owner: 'blockstack',
repo: 'blockstack',
private: false,
},
// protocols: {
// name: 'stacks-wallet',
// schemes: ['stacks-wallet'],
// },
};

const networkConfigs = {
testnet: {
productName: 'Stacks Wallet Testnet',
appId: 'so.hiro.StacksWalletTestnet',
artifactName: 'stacks-wallet.testnet.${ext}',
mac: {
icon: 'icon.testnet.icns',
appId: 'so.hiro.StacksWalletTestnet',
},
linux: {
icon: './icons',
},
// macos `Application Support` dir name
extraMetadata: {
productName: 'StacksWalletTestnet',
},
},
mainnet: {
productName: 'Stacks Wallet',
appId: 'so.hiro.StacksWallet',
icon: 'icon-512x512.png',
artifactName: 'stacks-wallet.${ext}',
mac: {
icon: 'icon.icns',
appId: 'so.hiro.StacksWallet',
},
linux: {
icon: 'icon-512x512.png',
},
extraMetadata: {
productName: 'StacksWallet',
},
},
};

const mergedConfig = deepMerge(baseConfig, networkConfigs[network]);

console.log(JSON.stringify(mergedConfig, null, 2));

module.exports = mergedConfig;
Loading

0 comments on commit 492ad88

Please sign in to comment.