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
parent
commit
40cbc7cdb6
No known key found for this signature in database GPG Key ID: 470C865699C8D4D
  1. 6
      .github/workflows/build-release-binary.yml
  2. 4
      .github/workflows/ci.yml
  3. 18
      maker-frontend/dynamicApp.ts
  4. 3
      maker-frontend/index.html
  5. 19
      maker-frontend/vite.config.ts
  6. 2
      start_all.sh

6
.github/workflows/build-release-binary.yml

@ -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 \
.

4
.github/workflows/ci.yml

@ -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:

18
maker-frontend/dynamicApp.ts

@ -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;
},
};
}

3
maker-frontend/index.html

@ -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>

19
maker-frontend/vite.config.ts

@ -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`,
},
},
});

2
start_all.sh

@ -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)

Loading…
Cancel
Save