diff --git a/.github/workflows/pull-request-integration-test.yml b/.github/workflows/pull-request-integration-test.yml index 9a0cc236..10e6fe5e 100644 --- a/.github/workflows/pull-request-integration-test.yml +++ b/.github/workflows/pull-request-integration-test.yml @@ -20,5 +20,4 @@ jobs: - name: Run react unit tests run: | - cd react yarn test diff --git a/.gitignore b/.gitignore index 314a9e81..7979f116 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules dist .env.local paybutton/dev/demo/paybutton.js -react/coverage \ No newline at end of file +react/coverage +paybutton-config.json diff --git a/react/lib/config.json b/example-config.json similarity index 100% rename from react/lib/config.json rename to example-config.json diff --git a/package.json b/package.json index 08dec8ae..aeeb7ae8 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,9 @@ "license": "MIT", "scripts": { "dev": "cd paybutton && yarn dev", + "predev": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", + "prebuild": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", + "pretest": "[ -f ./paybutton-config.json ] || cp ./example-config.json ./paybutton-config.json", "build:dev": "yarn build:react && yarn dev", "test": "cd react && yarn test", "test:coverage": "cd react && yarn test:coverage", diff --git a/react/lib/altpayment/index.ts b/react/lib/altpayment/index.ts index d687a3c1..aef982ff 100644 --- a/react/lib/altpayment/index.ts +++ b/react/lib/altpayment/index.ts @@ -1,6 +1,6 @@ import { MockedPaymentClient } from "./mocked" import { SideshiftClient, SideshiftCoin, SideshiftError, SideshiftPair, SideshiftQuote, SideshiftShift } from "./sideshift" -import config from '../config.json' +import config from '../../../paybutton-config.json' export const MINIMUM_ALTPAYMENT_DOLLAR_AMOUNT = 10 diff --git a/react/lib/altpayment/mocked.ts b/react/lib/altpayment/mocked.ts index 3d3a114c..31ba3086 100644 --- a/react/lib/altpayment/mocked.ts +++ b/react/lib/altpayment/mocked.ts @@ -1,5 +1,5 @@ import { AltpaymentClient, AltpaymentShift } from "."; -import config from '../config.json' +import config from '../../../paybutton-config.json' export class MockedPaymentClient implements AltpaymentClient { public async getPaymentStatus (_id: string): Promise { diff --git a/react/lib/components/Widget/Widget.tsx b/react/lib/components/Widget/Widget.tsx index a4051285..f31f008e 100644 --- a/react/lib/components/Widget/Widget.tsx +++ b/react/lib/components/Widget/Widget.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import copy from 'copy-to-clipboard'; import QRCode, { BaseQRCodeProps } from 'qrcode.react'; import io, { Socket } from 'socket.io-client'; -import config from '../../config.json'; +import config from '../../../../paybutton-config.json'; import { Theme, ThemeName, ThemeProvider, useTheme } from '../../themes'; import { Button, animation } from '../Button/Button'; import BarChart from '../BarChart/BarChart'; @@ -475,7 +475,7 @@ export const Widget: React.FunctionComponent = props => { setLoading(false); } } else { - if (hasPrice) { + if (hasPrice) { const receivedVal: number = totalReceived * price; const receivedText: string = formatPrice( receivedVal, diff --git a/react/lib/util/api-client.ts b/react/lib/util/api-client.ts index 80664108..e762f0e7 100644 --- a/react/lib/util/api-client.ts +++ b/react/lib/util/api-client.ts @@ -1,6 +1,6 @@ import axios from 'axios'; import _ from 'lodash'; -import config from '../config.json' +import config from '../../../paybutton-config.json' import { isValidCashAddress, isValidXecAddress } from './address'; import { Transaction,