From 59b337450b989c87a96339c00698410dcd2a90a7 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 1 Aug 2023 20:12:19 -0700 Subject: [PATCH 1/3] fix: use empty list of dependencies instead of null dependencies in dna manifest to avoid devhub bug (see https://github.com/holochain/devhub-gui/issues/31) --- dnas/mewsfeed/workdir/dna.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnas/mewsfeed/workdir/dna.yaml b/dnas/mewsfeed/workdir/dna.yaml index 0fa1fe79..f03367da 100644 --- a/dnas/mewsfeed/workdir/dna.yaml +++ b/dnas/mewsfeed/workdir/dna.yaml @@ -59,4 +59,4 @@ coordinator: - name: ping hash: ~ bundled: "../../../target/wasm32-unknown-unknown/release/ping.wasm" - dependencies: ~ + dependencies: [] From aa3f3fd6f7b463b7f498c35515143a1326d2c5ba Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 1 Aug 2023 20:13:05 -0700 Subject: [PATCH 2/3] fix(ui): specify if ui is published for launcher via env variable IS_LAUNCHER -- allow for replacement of websocket address if so --- package.json | 5 +++-- ui/src/env.d.ts | 1 + ui/src/utils/client.ts | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a02c1f47..aeefb2a3 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,14 @@ "network": "npm run build:happ && UI_PORT=8888 concurrently \"npm run playground\" \"npm run local-services\" \"npm run start:agent\" \"npm run start:agent\"", "start:agent": "HC_PORT=$(port) HC_ADMIN_PORT=$(port) concurrently \"npm run launch:happ\" \"npm run start:browser -w ui\"", "launch:happ": "hc s clean && echo pass | RUST_LOG=warn hc s --piped -f=$HC_ADMIN_PORT generate ./workdir/mewsfeed.happ --run=$HC_PORT -a mewsfeed network -b http://127.0.0.1:54000 webrtc ws://127.0.0.1:55000", - "start:launcher": "AGENTS=2 npm run network:launcher", + "start:launcher": "VITE_IS_LAUNCHER=true AGENTS=2 npm run network:launcher", "network:launcher": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm run local-services\" \"npm start -w ui\" \"npm run launch:happ:launcher\" \"holochain-playground\"", "launch:happ:launcher": "echo \"pass\" | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/mewsfeed.happ --ui-port $UI_PORT network -b http://127.0.0.1:54000 webrtc ws://127.0.0.1:55000", "test": "npm run build:happ && npm t -w tests", "test:watch": "cargo watch --clear -- npm test", - "package": "npm run build:happ && npm run package:ui && hc web-app pack workdir", + "package": "npm run build:happ && VITE_IS_LAUNCHER=true npm run package:ui && hc web-app pack workdir", "package:ui": "npm run build -w ui && cd ui/dist && bestzip ../dist.zip *", + "package:holo": "npm run build:happ && npm run package:ui && hc web-app pack workdir", "build:happ": "rm -f dnas/**/workdir/*.dna && npm run build:dnas && hc app pack ./workdir", "build:dnas": "npm run build:zomes && hc dna pack ./dnas/mewsfeed/workdir", "build:zomes": "CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown", diff --git a/ui/src/env.d.ts b/ui/src/env.d.ts index 5733dcba..10aeb85c 100644 --- a/ui/src/env.d.ts +++ b/ui/src/env.d.ts @@ -15,5 +15,6 @@ interface ImportMetaEnv { readonly VITE_HC_PORT: number; readonly VITE_HC_ADMIN_PORT: number; readonly VITE_IS_HOLO_HOSTED: boolean; + readonly VITE_IS_LAUNCHER: boolean; readonly VITE_CHAPERONE_SERVER_URL: string; } diff --git a/ui/src/utils/client.ts b/ui/src/utils/client.ts index dafbc758..0794c143 100644 --- a/ui/src/utils/client.ts +++ b/ui/src/utils/client.ts @@ -7,10 +7,8 @@ import { import WebSdkApi from "@holo-host/web-sdk"; export const HOLOCHAIN_APP_ID = "mewsfeed"; -export const HOLOCHAIN_URL = new URL( - `ws://localhost:${import.meta.env.VITE_HC_PORT}` -); -export const IS_HOLO_HOSTED = Boolean(import.meta.env.VITE_IS_HOLO_HOSTED); +export const IS_LAUNCHER = import.meta.env.VITE_IS_LAUNCHER; +export const IS_HOLO_HOSTED = import.meta.env.VITE_IS_HOLO_HOSTED; export const HOLO_CHAPERONE_URL = import.meta.env.VITE_CHAPERONE_SERVER_URL ? import.meta.env.VITE_CHAPERONE_SERVER_URL @@ -19,7 +17,11 @@ export const HOLO_CHAPERONE_URL = import.meta.env.VITE_CHAPERONE_SERVER_URL export const setupHolochain = async () => { try { const client = await AppAgentWebsocket.connect( - HOLOCHAIN_URL, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + //@ts-ignore + IS_LAUNCHER + ? "" + : new URL(`ws://localhost:${import.meta.env.VITE_HC_PORT}`), HOLOCHAIN_APP_ID, 60000 ); From de8078ffd763c517076216878adf74de25122b1a Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Wed, 2 Aug 2023 11:03:31 -0700 Subject: [PATCH 3/3] fix: avoid type error for launcher websocket --- ui/src/utils/client.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/src/utils/client.ts b/ui/src/utils/client.ts index 0794c143..d7141b49 100644 --- a/ui/src/utils/client.ts +++ b/ui/src/utils/client.ts @@ -17,10 +17,8 @@ export const HOLO_CHAPERONE_URL = import.meta.env.VITE_CHAPERONE_SERVER_URL export const setupHolochain = async () => { try { const client = await AppAgentWebsocket.connect( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - //@ts-ignore IS_LAUNCHER - ? "" + ? new URL(`ws://UNUSED`) : new URL(`ws://localhost:${import.meta.env.VITE_HC_PORT}`), HOLOCHAIN_APP_ID, 60000