Skip to content

Commit

Permalink
feat: use root paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Sep 25, 2020
1 parent bb352a3 commit 6e572ff
Show file tree
Hide file tree
Showing 52 changed files with 524 additions and 437 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ module.exports = {
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/unbound-method': 0,
'no-warning-comments': ['warn', { terms: ['SECURITY'], location: 'anywhere' }],

'import/no-unresolved': ['error'],
'import/no-mutable-exports': ['error'],
'import/no-useless-path-segments': ['error'],
// 'import/no-cycle': ['error', { maxDepth: 2 }],
'import/first': ['error'],
'import/no-duplicates': ['error'],
'import/no-default-export': ['error'],
},
};
55 changes: 43 additions & 12 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,68 @@ name: Build/release

on: [pull_request]

env:
GITHUB_SHA: ${{ github.sha }}

jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
NPM_COMMAND: mac

- os: ubuntu-latest
NPM_COMMAND: linux

- os: windows-latest
NPM_COMMAND: win

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

- run: echo ${{ github.sha }}

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

- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
build_script_name: package-all
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.github_token }}
- name: Install package
run: yarn

- run: echo ${{ matrix.NPM_COMMAND }}

- name: Build releases
run: yarn package-${{ matrix.NPM_COMMAND }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
# release: ${{ startsWith(github.ref, 'refs/tags/v') }}
- uses: actions/upload-artifact@v2
name: Upload Windows build
if: matrix.os == 'windows-latest'
with:
name: stacks-wallet-windows
path: |
release/**/*.exe
release/**/*.msi
- uses: actions/upload-artifact@v2
name: Upload MacOS build
if: matrix.os == 'macos-latest'
with:
name: stacks-wallet-macos
path: release/**/*.dmg

- uses: actions/upload-artifact@v2
name: Upload Linux build
if: matrix.os == 'ubuntu-latest'
with:
name: my-artifact
path: release/**
name: stacks-wallet-linux
path: |
release/**/*.deb
release/**/*.rpm
7 changes: 4 additions & 3 deletions app/components/home/balance-card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { FC, useState } from 'react';
import { Box, Button, Text, ArrowIcon } from '@blockstack/ui';
import { toHumanReadableStx } from '../../utils/unit-convert';
import { safeAwait } from '../../utils/safe-await';
import { delay } from '../../utils/delay';

import { toHumanReadableStx } from '@utils/unit-convert';
import { safeAwait } from '@utils/safe-await';
import { delay } from '@utils/delay';

interface BalanceCardProps {
balance: string | null;
Expand Down
4 changes: 2 additions & 2 deletions app/components/home/stacking-promo-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { Box, Flex, Text, Button } from '@blockstack/ui';

import btcPodium from '../../assets/images/btc-podium.svg';
import { openExternalLink } from '../../utils/external-links';
import { BUY_STX_URL } from '../../constants';
import { openExternalLink } from '@utils/external-links';
import { BUY_STX_URL } from '@constants/index';

export const StackingPromoCard = () => {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/components/home/stacking-rewards-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { FC } from 'react';
import { Box, Flex, Text } from '@blockstack/ui';
import { Hr } from '../hr';
import { MovementArrow } from '../icons/movement-arrow';
import { features } from '../../constants/index';
import { features } from '@constants/index';

interface StackingRewardCardProps {
lifetime: string;
Expand Down
5 changes: 3 additions & 2 deletions app/components/home/transaction-list/transaction-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { FC } from 'react';
import { Flex, FlexProps, Spinner } from '@blockstack/ui';
import { SentArrow } from '../../icons/sent-arrow';
import { ReceivedArrow } from '../../icons/received-arrow';

import { SentArrow } from '@components/icons/sent-arrow';
import { ReceivedArrow } from '@components/icons/received-arrow';

type TransactionDirection = 'sent' | 'received';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { remote } from 'electron';
import { useClipboard } from '@blockstack/ui';
import { Transaction } from '@blockstack/stacks-blockchain-api-types';

import { hasMemo, getRecipientAddress } from '../../../utils/tx-utils';
import { hasMemo, getRecipientAddress } from '@utils/tx-utils';

export function registerHandler(el: HTMLButtonElement | null, handler: (e: Event) => void) {
if (el === null) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Text, Flex } from '@blockstack/ui';

import { useNavigatorOnline } from '../../../hooks/use-navigator-online';
import { useNavigatorOnline } from '@hooks/use-navigator-online';
import { templateTxBoxProps } from './transaction-list-item-pseudo';

export const TransactionListEmpty = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Text, Flex, BoxProps } from '@blockstack/ui';
import { Link } from 'react-router-dom';

import { templateTxBoxProps } from './transaction-list-item-pseudo';
import { StacksNode } from '../../../store/stacks-node';
import { STATUS_PAGE_URL } from '../../../constants/index';
import { openExternalLink } from '../../../utils/external-links';
import { StacksNode } from '@store/stacks-node';
import { STATUS_PAGE_URL } from '@constants/index';
import { openExternalLink } from '@utils/external-links';

const linkProps: BoxProps = {
color: 'blue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { FC, useRef, RefObject, useEffect, MutableRefObject } from 'react
import { useHover, useFocus } from 'use-events';
import { Box, Text } from '@blockstack/ui';

import { PendingTransaction } from '../../../store/pending-transaction';
import { toHumanReadableStx } from '../../../utils/unit-convert';
import { PendingTransaction } from '@store/pending-transaction';
import { toHumanReadableStx } from '@utils/unit-convert';
import { TransactionIcon } from './transaction-icon';
import { TransactionListItemContainer } from './transaction-list-item-container';

Expand Down
16 changes: 8 additions & 8 deletions app/components/home/transaction-list/transaction-list-item.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React, { FC, MutableRefObject, RefObject } from 'react';
import React, { FC, MutableRefObject, RefObject, useLayoutEffect, useRef, useEffect } from 'react';
import { useHover, useFocus } from 'use-events';
import { Box, Text, useClipboard } from '@blockstack/ui';
import { Transaction } from '@blockstack/stacks-blockchain-api-types';

import { capitalize } from '../../../utils/capitalize';
import { getStxTxDirection } from '../../../utils/get-stx-transfer-direction';
import { sumStxTxTotal } from '../../../utils/sum-stx-tx-total';
import { capitalize } from '@utils/capitalize';
import { getStxTxDirection } from '@utils/get-stx-transfer-direction';
import { sumStxTxTotal } from '@utils/sum-stx-tx-total';
import { TransactionIcon } from './transaction-icon';
import { toHumanReadableStx } from '../../../utils/unit-convert';
import { useLayoutEffect, useRef, useEffect } from 'react';
import { toHumanReadableStx } from '@utils/unit-convert';

import {
createTxListContextMenu,
registerHandler,
deregisterHandler,
} from './transaction-list-context-menu';
import { makeExplorerLink } from '../../../utils/external-links';
import { getRecipientAddress } from '../../../utils/tx-utils';
import { makeExplorerLink } from '@utils/external-links';
import { getRecipientAddress } from '@utils/tx-utils';
import { TransactionListItemContainer } from './transaction-list-item-container';

const dateOptions = {
Expand Down
3 changes: 2 additions & 1 deletion app/components/home/transaction-list/transaction-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FC } from 'react';

import { StacksNode } from '../../../store/stacks-node/stacks-node.reducer';
import { StacksNode } from '@store/stacks-node';

import { TransactionListTitle } from './transaction-list-title';
import { TransactionListEmpty } from './transaction-list-empty';
import { TransactionListLoading } from './transaction-list-loading';
Expand Down
2 changes: 1 addition & 1 deletion app/components/network-message.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { Text, Box } from '@blockstack/ui';

// import { ENV } from '../constants/index';
// import { ENV } from '@constants/index';

interface NetworkMessageProps {
textColor?: string;
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/node-select-item.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { Box, Flex, Text } from '@blockstack/ui';

import { StacksNode } from '../../store/stacks-node';
import { StacksNode } from '@store/stacks-node';

interface NodeSelectItemProps {
node: StacksNode;
Expand Down
4 changes: 2 additions & 2 deletions app/components/title-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import ReactDOM from 'react-dom';
import { useHistory, useLocation, matchPath } from 'react-router';
import { Flex, Box } from '@blockstack/ui';

import routes from '../constants/routes.json';
import { useWindowFocus } from '../hooks/use-window-focus';
import routes from '@constants/routes.json';
import { useWindowFocus } from '@hooks/use-window-focus';
import { BackContext } from '../pages/root';

import { NetworkMessage } from './network-message';
Expand Down
3 changes: 2 additions & 1 deletion app/crypto/key-generation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import crypto from 'crypto';

import { generateSalt, deriveKey } from './key-generation';

import crypto from 'crypto';
// https://stackoverflow.com/a/52612372/1141891
Object.defineProperty(global, 'crypto', {
value: {
Expand Down
2 changes: 1 addition & 1 deletion app/crypto/key-generation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memoizeWith, identity } from 'ramda';
import argon2, { ArgonType } from 'argon2-browser';

import { delay } from '../utils/delay';
import { delay } from '@utils/delay';

export async function deriveKey({ pass, salt }: { pass: string; salt: string }) {
// Without this additional delay of 1ms, an odd behaviour with the argon2 library
Expand Down
3 changes: 2 additions & 1 deletion app/hooks/use-ledger.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useRef, useEffect, useCallback, useState } from 'react';
import BlockstackApp from '@zondax/ledger-blockstack';
import type Transport from '@ledgerhq/hw-transport';
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid';

import { useInterval } from './use-interval';
import BlockstackApp from '@zondax/ledger-blockstack';

export enum LedgerConnectStep {
Disconnected,
Expand Down
1 change: 1 addition & 0 deletions app/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import log from 'electron-log';
import MenuBuilder from './menu';
import windowState from 'electron-window-state';

// eslint-disable-next-line import/no-default-export
export default class AppUpdater {
constructor() {
log.transports.file.level = 'info';
Expand Down
1 change: 1 addition & 0 deletions app/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface DarwinMenuItemConstructorOptions extends MenuItemConstructorOptions {
submenu?: DarwinMenuItemConstructorOptions[] | Menu;
}

// eslint-disable-next-line import/no-default-export
export default class MenuBuilder {
mainWindow: BrowserWindow;

Expand Down
2 changes: 1 addition & 1 deletion app/modals/receive-stx/receive-stx-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Qr from 'qrcode.react';
import { Text, Modal, Button, Flex, Box, useClipboard } from '@blockstack/ui';

import { TxModalHeader, TxModalFooter } from '../transaction/transaction-modal-layout';
import { homeActions } from '../../store/home/home.reducer';
import { homeActions } from '@store/home/home.reducer';

interface ReceiveStxModalProps {
address: string;
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 @@ -2,7 +2,7 @@ import React, { FC, useState, useRef } from 'react';
import { Modal, ButtonGroup, Button, Box } from '@blockstack/ui';
import { TxModalHeader, TxModalFooter } from '../transaction/transaction-modal-layout';
import { remote } from 'electron';
import { clearDiskStorage } from '../../utils/disk-store';
import { clearDiskStorage } from '@utils/disk-store';
import { useHotkeys } from 'react-hotkeys-hook';

interface ResetWalletModalProps {
Expand Down
4 changes: 2 additions & 2 deletions app/modals/transaction/decrypt-wallet-form.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FC } from 'react';
import { Box, Input, Text } from '@blockstack/ui';
import { ErrorLabel } from '../../components/error-label';
import { ErrorText } from '../../components/error-text';
import { ErrorLabel } from '@components/error-label';
import { ErrorText } from '@components/error-text';

interface DecryptWalletFormProps {
hasSubmitted: boolean;
Expand Down
6 changes: 3 additions & 3 deletions app/modals/transaction/sign-tx-with-ledger.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC, useEffect } from 'react';
import { LedgerConnectInstructions } from '../../components/ledger/ledger-connect-instructions';
import { LedgerConnectInstructions } from '@components/ledger/ledger-connect-instructions';
import { Box } from '@blockstack/ui';
import { useLedger } from '../../hooks/use-ledger';
import { useLedger } from '@hooks/use-ledger';
import BlockstackApp from '@zondax/ledger-blockstack';
import { delay } from '../../utils/delay';
import { delay } from '@utils/delay';

interface SignTxWithLedgerProps {
onLedgerConnect(app: BlockstackApp): void;
Expand Down
8 changes: 4 additions & 4 deletions app/modals/transaction/transaction-form.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { FC } from 'react';
import { Flex, Text, Input, Box, Button } from '@blockstack/ui';
import { ErrorLabel } from '../../components/error-label';
import { ErrorText } from '../../components/error-text';
import { ErrorLabel } from '@components/error-label';
import { ErrorText } from '@components/error-text';
import { FormikProps } from 'formik';
import { capitalize } from '../../utils/capitalize';
import { toHumanReadableStx } from '../../utils/unit-convert';
import { capitalize } from '@utils/capitalize';
import { toHumanReadableStx } from '@utils/unit-convert';

interface TxModalFormProps {
balance: string;
Expand Down
20 changes: 10 additions & 10 deletions app/modals/transaction/transaction-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ import {
} from '@blockstack/stacks-transactions';
import { useHotkeys } from 'react-hotkeys-hook';

import { RootState } from '../../store';
import routes from '../../constants/routes.json';
import { validateStacksAddress } from '../../utils/get-stx-transfer-direction';
import { RootState } from '@store/index';
import routes from '@constants/routes.json';
import { validateStacksAddress } from '@utils/get-stx-transfer-direction';

import { selectTxModalOpen, homeActions } from '../../store/home/home.reducer';
import { selectTxModalOpen, homeActions } from '@store/home/home.reducer';
import {
selectEncryptedMnemonic,
selectSalt,
decryptSoftwareWallet,
selectWalletType,
} from '../../store/keys';
} from '@store/keys';
import { validateAddressChain } from '../../crypto/validate-address-net';
import { broadcastStxTransaction, selectMostRecentlyTxError } from '../../store/transaction';
import { toHumanReadableStx, stxToMicroStx, microStxToStx } from '../../utils/unit-convert';
import { ErrorLabel } from '../../components/error-label';
import { ErrorText } from '../../components/error-text';
import { broadcastStxTransaction, selectMostRecentlyTxError } from '@store/transaction';
import { toHumanReadableStx, stxToMicroStx, microStxToStx } from '@utils/unit-convert';
import { ErrorLabel } from '@components/error-label';
import { ErrorText } from '@components/error-text';
import { stacksNetwork } from '../../environment';
import {
TxModalHeader,
Expand All @@ -43,7 +43,7 @@ import { TxModalForm } from './transaction-form';
import { DecryptWalletForm } from './decrypt-wallet-form';
import { SignTxWithLedger } from './sign-tx-with-ledger';
import BlockstackApp from '../../../../ledger-blockstack/js/src/index';
import { selectPublicKey } from '../../store/keys/keys.reducer';
import { selectPublicKey } from '@store/keys/keys.reducer';
import { FailedBroadcastError } from './failed-broadcast-error';
import { createMessageSignature } from '@blockstack/stacks-transactions/lib/authorization';

Expand Down
Loading

0 comments on commit 6e572ff

Please sign in to comment.