Skip to content

Commit

Permalink
add support for we development
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Dec 18, 2023
1 parent 26b8e39 commit b65402f
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 8 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"start": "AGENTS=2 BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) npm run network",
"dev": "VITE_ADMIN_PORT=$(port) VITE_APP_PORT=$(port) SIGNAL_PORT=$(port) BOOTSTRAP_PORT=$(port) UI_PORT=8888 npm run x",
"x": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run start:happ\" \"hc run-local-services -b $BOOTSTRAP_PORT -s $SIGNAL_PORT\"",
"applet-dev": " UI_PORT=8888 npm run applet-devx",
"applet-devx": "BPORT=46263 SPORT=46262; concurrently \"hc run-local-services -b $BPORT -s $SPORT\" \"npm start -w ui\" \"./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 1 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\" \"sleep 10 && ./we_dev/we.AppImage --dev-config we_dev/config.json --agent-num 2 -b http://127.0.0.1:$BPORT -s ws://127.0.0.1:$SPORT\"",
"network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"",
"test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests",
"launch:happ": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/kando.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"",
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@holochain-open-dev/utils": "^0.16.3",
"@holochain-syn/core": "^0.10.0",
"@holochain/client": "^0.16.7",
"@lightningrodlabs/we-applet": "^0.12.1",
"@lightningrodlabs/we-applet": "^0.12.2",
"@mdi/js": "^7.1.96",
"@ts-stack/markdown": "^1.4.0",
"lodash": "^4.17.21",
Expand Down
9 changes: 8 additions & 1 deletion ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Controller from './Controller.svelte'
import { AppAgentWebsocket, AdminWebsocket } from '@holochain/client';
import '@shoelace-style/shoelace/dist/themes/light.css';
import { WeClient, isWeContext } from '@lightningrodlabs/we-applet';
import { WeClient, isWeContext, initializeHotReload } from '@lightningrodlabs/we-applet';
import { ProfilesClient, ProfilesStore } from '@holochain-open-dev/profiles';
import "@holochain-open-dev/profiles/dist/elements/profiles-context.js";
import "@holochain-open-dev/profiles/dist/elements/profile-prompt.js";
Expand All @@ -23,6 +23,13 @@
async function initialize() : Promise<void> {
let profilesClient
if ((import.meta as any).env.DEV) {
try {
await initializeHotReload();
} catch (e) {
console.warn("Could not initialize applet hot-reloading. This is only expected to work in a We context in dev mode.")
}
}
if (!isWeContext()) {
console.log("adminPort is", adminPort)
if (adminPort) {
Expand Down
3 changes: 1 addition & 2 deletions ui/src/svgIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export const svgIcons = {
faFileExport: `<svg xmlns="http://www.w3.org/2000/svg" height="16" width="18" viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V288H216c-13.3 0-24 10.7-24 24s10.7 24 24 24H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM384 336V288H494.1l-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39H384zm0-208H256V0L384 128z"/></svg>`,
faClose: `<svg xmlns="http://www.w3.org/2000/svg" height="16" width="12" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>`,
faBug: `<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M256 0c53 0 96 43 96 96v3.6c0 15.7-12.7 28.4-28.4 28.4H188.4c-15.7 0-28.4-12.7-28.4-28.4V96c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7 .7 1.3 1.4 1.9 2.1c14.2-7.3 30.4-11.4 47.5-11.4H312c17.1 0 33.2 4.1 47.5 11.4c.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7 .7-1.4 1.3-2.1 1.9c6.2 12 10.1 25.3 11.1 39.5H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H416c0 24.6-5.5 47.8-15.4 68.6c2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6V240c0-8.8-7.2-16-16-16s-16 7.2-16 16V479.2c-34.5-3.4-65.8-17.8-90.3-39.6L86.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H96.3c1.1-14.1 5-27.5 11.1-39.5c-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3z"/></svg>`,
faBars: `<svg xmlns="http://www.w3.org/2000/svg" height="16" width="14" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`

faBars: `<svg xmlns="http://www.w3.org/2000/svg" height="16" width="14" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`
}
1 change: 1 addition & 0 deletions we_dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
we.AppImage
77 changes: 77 additions & 0 deletions we_dev/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"groups": [
{
"name": "Lightning Rod Labs",
"networkSeed": "098rc1m-09384u-crm-29384u-cmkj",
"icon": {
"type": "filesystem",
"path": "./we_dev/lrl-icon.png"
},
"creatingAgent": {
"agentNum": 1,
"agentProfile": {
"nickname": "Zippy",
"avatar": {
"type": "filesystem",
"path": "./we_dev/zippy.jpg"
}
}
},
"joiningAgents": [
{
"agentNum": 2,
"agentProfile": {
"nickname": "Zerbina",
"avatar": {
"type": "filesystem",
"path": "./we_dev/zerbina.jpg"
}
}
}
],
"applets": [
{
"name": "KanDo Hot Reload",
"instanceName": "KanDo Hot Reload",
"registeringAgent": 1,
"joiningAgents": [2]
},
{
"name": "notebooks",
"instanceName": "notebooks",
"registeringAgent": 1,
"joiningAgents": [2]
}
]
}
],
"applets": [
{
"name": "KanDo Hot Reload",
"subtitle": "Real-tiem stickies boards",
"description": "Let's do it!",
"icon": {
"type": "filesystem",
"path": "./we_dev/kando_icon.png"
},
"source": {
"type": "localhost",
"happPath": "./workdir/kando.happ",
"uiPort": 8888
}
},
{
"name": "notebooks",
"subtitle": "Collaborative note taking",
"description": "Real-time notetaking based on syn",
"icon": {
"type": "https",
"url": "https://lightningrodlabs.org/projects/notebooks.png"
},
"source": {
"type": "https",
"url": "https://github.com/lightningrodlabs/notebooks/releases/download/v0.0.8/notebooks.webhapp"
}
}
]
}
Binary file added we_dev/kando_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added we_dev/lrl-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added we_dev/zerbina.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added we_dev/zippy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b65402f

Please sign in to comment.