Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix: gh-pages deployment (#211)
Browse files Browse the repository at this point in the history
* chore: add config to mint amount

* feat: add preview gh-pages

* chore: prettify
  • Loading branch information
luizstacio authored May 25, 2022
1 parent ec40015 commit 78c73e8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "tsc && vite build && pnpm create404",
"preview": "vite preview",
"test": "jest",
"gh-preview": "sh ./scripts/gh-pages-preview.sh",
"deploy-contracts": "sh ./scripts/deploy-contracts.sh",
"build-contracts": "sh ./scripts/build-contracts.sh",
"postinstall": "sh ./scripts/postinstall.sh",
Expand Down
16 changes: 16 additions & 0 deletions packages/app/scripts/gh-pages-preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

export PUBLIC_URL="/swayswap"
export BUILD_PATH="dist"$PUBLIC_URL

# Clean dist folder
rm -rf dist

# Build folder with BASE_URL
npx tsc && npx vite build &&

# Copy to inside folder
cp $BUILD_PATH/index.html dist/404.html

# Run server and open on browser
npx http-server dist -o $PUBLIC_URL -c-1
2 changes: 1 addition & 1 deletion packages/app/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const CONTRACT_ID = import.meta.env.VITE_CONTRACT_ID!;
export const TOKEN_ID = import.meta.env.VITE_TOKEN_ID!;
export const DECIMAL_UNITS = 3;
export const FAUCET_AMOUNT = parseUnits('0.5', DECIMAL_UNITS).toBigInt();
export const MINT_AMOUNT = parseUnits('2000', DECIMAL_UNITS).toBigInt();
export const MINT_AMOUNT = 2000;
export const ONE_ASSET = parseUnits('1', DECIMAL_UNITS).toBigInt();
export const RECAPTCHA_SITE_KEY = import.meta.env.VITE_RECAPTCHA_SITE_KEY!;
export const ENABLE_FAUCET_API = import.meta.env.VITE_ENABLE_FAUCET_API === 'true';
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/pages/MintTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { Button } from "~/components/Button";
import { Card } from "~/components/Card";
import { Input } from "~/components/Input";
import { NumberInput } from "~/components/NumberInput";
import { DECIMAL_UNITS, TOKEN_ID } from "~/config";
import { DECIMAL_UNITS, MINT_AMOUNT, TOKEN_ID } from "~/config";
import { useTokenMethods } from "~/hooks/useTokensMethods";
import { sleep } from "~/lib/utils";

export default function MintTokenPage() {
const [asset, setAsset] = useState(TOKEN_ID);
const methods = useTokenMethods(TOKEN_ID);
const [amount, setAmount] = useState<string>("2000");
const [amount, setAmount] = useState<string>(`${MINT_AMOUNT}`);

const mintMutation = useMutation(
async () => {
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function MintTokenPage() {
className="px-2"
value={amount}
onChange={setAmount}
isAllowed={(values) => (values.floatValue || 0) <= 2000}
isAllowed={(values) => (values.floatValue || 0) <= MINT_AMOUNT}
/>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
base: process.env.PUBLIC_URL || '/',
build: {
target: ['es2020'],
outDir: process.env.BUILD_PATH || 'dist',
},
plugins: [react()],
define: {
Expand Down

0 comments on commit 78c73e8

Please sign in to comment.