Browse Source
Remove support for building old taker frontend
`maker-frontend` vite config supports only maker now.
new-http-api
Mariusz Klochowicz
3 years ago
No known key found for this signature in database
GPG Key ID: 470C865699C8D4D
6 changed files with
8 additions and
44 deletions
-
.github/workflows/build-release-binary.yml
-
.github/workflows/ci.yml
-
maker-frontend/dynamicApp.ts
-
maker-frontend/index.html
-
maker-frontend/vite.config.ts
-
start_all.sh
|
|
@ -89,7 +89,7 @@ jobs: |
|
|
|
run: | |
|
|
|
cd maker-frontend; |
|
|
|
yarn |
|
|
|
APP=maker yarn build |
|
|
|
yarn build |
|
|
|
|
|
|
|
# Overwrite taker frontend with our new fancy UI |
|
|
|
- name: Build taker frontend |
|
|
@ -224,7 +224,3 @@ jobs: |
|
|
|
--tag ghcr.io/${{ github.repository }}/taker:${{ github.event.release.tag_name }} \ |
|
|
|
--build-arg BINARY_PATH=taker \ |
|
|
|
. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,8 +70,8 @@ jobs: |
|
|
|
cache: 'yarn' |
|
|
|
cache-dependency-path: maker-frontend/yarn.lock |
|
|
|
- run: yarn install |
|
|
|
- run: APP=maker yarn test |
|
|
|
- run: APP=maker yarn build |
|
|
|
- run: yarn test |
|
|
|
- run: yarn build |
|
|
|
|
|
|
|
build_and_test_taker_frontend: |
|
|
|
defaults: |
|
|
|
|
|
@ -1,18 +0,0 @@ |
|
|
|
import { Plugin } from "vite"; |
|
|
|
|
|
|
|
export default function dynamicApp(app: string): Plugin { |
|
|
|
return { |
|
|
|
name: "dynamicApp", // required, will show up in warnings and errors
|
|
|
|
resolveId: (id) => { |
|
|
|
// For some reason these are different?
|
|
|
|
const productionBuildId = "src/__app__.tsx"; |
|
|
|
const devBuildId = "/src/__app__.tsx"; |
|
|
|
|
|
|
|
if (id === productionBuildId || id === devBuildId) { |
|
|
|
return `${__dirname}/src/${app}.tsx`; |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
}, |
|
|
|
}; |
|
|
|
} |
|
|
@ -7,7 +7,6 @@ |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<div id="root"></div> |
|
|
|
<script type="module" src="src/__app__.tsx"> // `__app__` is dynamically resolved by the `dynamicApp` vite plugin |
|
|
|
</script> |
|
|
|
<script type="module" src="/src/maker.tsx"></script> |
|
|
|
</body> |
|
|
|
</html> |
|
|
|
|
|
@ -1,18 +1,6 @@ |
|
|
|
import reactRefresh from "@vitejs/plugin-react-refresh"; |
|
|
|
import { resolve } from "path"; |
|
|
|
import { defineConfig } from "vite"; |
|
|
|
import dynamicApp from "./dynamicApp"; |
|
|
|
|
|
|
|
const app = process.env.APP; |
|
|
|
|
|
|
|
if (!app || (app !== "maker" && app !== "taker")) { |
|
|
|
throw new Error("APP environment variable needs to be set to `maker` `taker`"); |
|
|
|
} |
|
|
|
|
|
|
|
const backendPorts = { |
|
|
|
"taker": 8000, |
|
|
|
"maker": 8001, |
|
|
|
}; |
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({ |
|
|
@ -22,18 +10,17 @@ export default defineConfig({ |
|
|
|
? [reactRefresh()] |
|
|
|
: [] |
|
|
|
), |
|
|
|
dynamicApp(app), |
|
|
|
], |
|
|
|
build: { |
|
|
|
rollupOptions: { |
|
|
|
input: resolve(__dirname, `index.html`), |
|
|
|
}, |
|
|
|
outDir: `dist/${app}`, |
|
|
|
outDir: `dist/maker`, |
|
|
|
}, |
|
|
|
server: { |
|
|
|
proxy: { |
|
|
|
"/api": `http://localhost:${backendPorts[app]}`, |
|
|
|
"/alive": `http://localhost:${backendPorts[app]}`, |
|
|
|
"/api": `http://localhost:8001`, |
|
|
|
"/alive": `http://localhost:8001`, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
@ -5,4 +5,4 @@ export RUST_BACKTRACE=1 |
|
|
|
# A simple command to spin up the complete package, ie. both daemons and frontends. |
|
|
|
# A single 'ctrl+c' stops all processes. |
|
|
|
# The maker-id is generated from the makers seed found in daemon/util/testnet_seeds/maker_seed |
|
|
|
(trap 'kill 0' SIGINT; cargo run --bin maker -- testnet & cargo run --bin taker -- --maker-id 10d4ba2ac3f7a22da4009d813ff1bc3f404dfe2cc93a32bedf1512aa9951c95e testnet -- & APP=maker yarn --cwd=./maker-frontend dev & yarn --cwd=./taker-frontend dev) |
|
|
|
(trap 'kill 0' SIGINT; cargo run --bin maker -- testnet & cargo run --bin taker -- --maker-id 10d4ba2ac3f7a22da4009d813ff1bc3f404dfe2cc93a32bedf1512aa9951c95e testnet -- & yarn --cwd=./maker-frontend dev & yarn --cwd=./taker-frontend dev) |
|
|
|