@holochain/hc-spin 0.600.0-dev.0 → 0.600.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test.yaml +8 -2
- package/CHANGELOG.md +11 -0
- package/dist/main/index.js +309 -295
- package/docs/DEVSETUP.md +12 -21
- package/electron.vite.config.ts +6 -0
- package/flake.lock +234 -0
- package/flake.nix +31 -0
- package/package.json +7 -6
- package/src/main/index.ts +30 -20
- package/src/main/menu.ts +23 -23
- package/src/main/validateArgs.ts +16 -1
- package/src/main/vite-env.d.ts +3 -0
- package/src/main/windows.ts +6 -5
- package/tsconfig.node.json +3 -2
package/docs/DEVSETUP.md
CHANGED
|
@@ -2,35 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
To setup the development environment to develop on the CLI itself:
|
|
4
4
|
|
|
5
|
-
1.
|
|
5
|
+
1. Enter the nix shell:
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
nix develop
|
|
7
9
|
```
|
|
8
|
-
yarn
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
2. Build Rust node add-ons (requires Rust + Go installed)
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
yarn setup
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
3. Run the CLI in development mode
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
yarn dev -- -- [your CLI arguments here]
|
|
11
|
+
2. Install dependencies:
|
|
21
12
|
|
|
13
|
+
```bash
|
|
14
|
+
yarn
|
|
22
15
|
```
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
3. Build the CLI:
|
|
25
18
|
|
|
26
|
-
```
|
|
27
|
-
yarn
|
|
19
|
+
```bash
|
|
20
|
+
yarn build
|
|
28
21
|
```
|
|
29
22
|
|
|
30
|
-
|
|
23
|
+
4. Run the CLI:
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
yarn build
|
|
25
|
+
```bash
|
|
26
|
+
yarn start <path to .webhapp file>
|
|
36
27
|
```
|
package/electron.vite.config.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
+
import packageJson from './package.json';
|
|
5
|
+
|
|
4
6
|
export default defineConfig({
|
|
5
7
|
main: {
|
|
6
8
|
plugins: [externalizeDepsPlugin({ exclude: ['@holochain/client', 'nanoid', 'get-port'] })],
|
|
9
|
+
define: {
|
|
10
|
+
__PACKAGE_VERSION__: JSON.stringify(packageJson.version),
|
|
11
|
+
__HOLOCHAIN_VERSION__: JSON.stringify(packageJson.holochainVersion),
|
|
12
|
+
},
|
|
7
13
|
},
|
|
8
14
|
preload: {
|
|
9
15
|
plugins: [externalizeDepsPlugin()],
|
package/flake.lock
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodes": {
|
|
3
|
+
"crane": {
|
|
4
|
+
"locked": {
|
|
5
|
+
"lastModified": 1762189950,
|
|
6
|
+
"narHash": "sha256-aotggLUXjlDGqKWibGPQcMZJGgdr79S21ISrv1Wz6RI=",
|
|
7
|
+
"owner": "ipetkov",
|
|
8
|
+
"repo": "crane",
|
|
9
|
+
"rev": "50700219af884287ad7c85507e2f163b23a027a9",
|
|
10
|
+
"type": "github"
|
|
11
|
+
},
|
|
12
|
+
"original": {
|
|
13
|
+
"owner": "ipetkov",
|
|
14
|
+
"repo": "crane",
|
|
15
|
+
"type": "github"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"flake-parts": {
|
|
19
|
+
"inputs": {
|
|
20
|
+
"nixpkgs-lib": "nixpkgs-lib"
|
|
21
|
+
},
|
|
22
|
+
"locked": {
|
|
23
|
+
"lastModified": 1762040540,
|
|
24
|
+
"narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=",
|
|
25
|
+
"owner": "hercules-ci",
|
|
26
|
+
"repo": "flake-parts",
|
|
27
|
+
"rev": "0010412d62a25d959151790968765a70c436598b",
|
|
28
|
+
"type": "github"
|
|
29
|
+
},
|
|
30
|
+
"original": {
|
|
31
|
+
"owner": "hercules-ci",
|
|
32
|
+
"repo": "flake-parts",
|
|
33
|
+
"type": "github"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"hc-launch": {
|
|
37
|
+
"flake": false,
|
|
38
|
+
"locked": {
|
|
39
|
+
"lastModified": 1752056054,
|
|
40
|
+
"narHash": "sha256-iLHhGQXrSfgAibzLSx+mdOQnnTzq4mrRXto7+a+MDLM=",
|
|
41
|
+
"owner": "holochain",
|
|
42
|
+
"repo": "hc-launch",
|
|
43
|
+
"rev": "612aa244ceb4d2136e5adbf181ff0cc123daff65",
|
|
44
|
+
"type": "github"
|
|
45
|
+
},
|
|
46
|
+
"original": {
|
|
47
|
+
"owner": "holochain",
|
|
48
|
+
"ref": "holochain-weekly",
|
|
49
|
+
"repo": "hc-launch",
|
|
50
|
+
"type": "github"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"hc-scaffold": {
|
|
54
|
+
"flake": false,
|
|
55
|
+
"locked": {
|
|
56
|
+
"lastModified": 1760566803,
|
|
57
|
+
"narHash": "sha256-fWflEEb2JQyVHfGglbx6dCR6X+4ECGM9pbxQYrKSZtQ=",
|
|
58
|
+
"owner": "holochain",
|
|
59
|
+
"repo": "scaffolding",
|
|
60
|
+
"rev": "751a16e98ddb35db5763cbf4b882a849b642e7e7",
|
|
61
|
+
"type": "github"
|
|
62
|
+
},
|
|
63
|
+
"original": {
|
|
64
|
+
"owner": "holochain",
|
|
65
|
+
"ref": "0.600.0-dev.0",
|
|
66
|
+
"repo": "scaffolding",
|
|
67
|
+
"type": "github"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"holochain": {
|
|
71
|
+
"flake": false,
|
|
72
|
+
"locked": {
|
|
73
|
+
"lastModified": 1762372467,
|
|
74
|
+
"narHash": "sha256-8LoKyzjkAoHOlJ0+8hUrwc0LTX7/2TdVODoLwMZMNVA=",
|
|
75
|
+
"owner": "holochain",
|
|
76
|
+
"repo": "holochain",
|
|
77
|
+
"rev": "90f56b5bf15b572cd9fdbd63d5a40a288143ff5f",
|
|
78
|
+
"type": "github"
|
|
79
|
+
},
|
|
80
|
+
"original": {
|
|
81
|
+
"owner": "holochain",
|
|
82
|
+
"ref": "holochain-0.6.0-rc.0",
|
|
83
|
+
"repo": "holochain",
|
|
84
|
+
"type": "github"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"holonix": {
|
|
88
|
+
"inputs": {
|
|
89
|
+
"crane": "crane",
|
|
90
|
+
"flake-parts": "flake-parts",
|
|
91
|
+
"hc-launch": "hc-launch",
|
|
92
|
+
"hc-scaffold": "hc-scaffold",
|
|
93
|
+
"holochain": "holochain",
|
|
94
|
+
"kitsune2": "kitsune2",
|
|
95
|
+
"lair-keystore": "lair-keystore",
|
|
96
|
+
"nixpkgs": "nixpkgs",
|
|
97
|
+
"playground": "playground",
|
|
98
|
+
"rust-overlay": "rust-overlay"
|
|
99
|
+
},
|
|
100
|
+
"locked": {
|
|
101
|
+
"lastModified": 1762431364,
|
|
102
|
+
"narHash": "sha256-769gbrsWU5SejCYcvoTPkVakU8nj5qYUw6cDlMRIgDs=",
|
|
103
|
+
"owner": "holochain",
|
|
104
|
+
"repo": "holonix",
|
|
105
|
+
"rev": "2682fec89ecb743c13453a65ee775147076f1919",
|
|
106
|
+
"type": "github"
|
|
107
|
+
},
|
|
108
|
+
"original": {
|
|
109
|
+
"owner": "holochain",
|
|
110
|
+
"ref": "main",
|
|
111
|
+
"repo": "holonix",
|
|
112
|
+
"type": "github"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"kitsune2": {
|
|
116
|
+
"flake": false,
|
|
117
|
+
"locked": {
|
|
118
|
+
"lastModified": 1762303720,
|
|
119
|
+
"narHash": "sha256-tC2k+1kPxpVYRYJLWYXQPvFlUwgfF4cKoFKbkak0vxU=",
|
|
120
|
+
"owner": "holochain",
|
|
121
|
+
"repo": "kitsune2",
|
|
122
|
+
"rev": "112099b30381ea0d23b8b3af21f5b5bb81ced6c5",
|
|
123
|
+
"type": "github"
|
|
124
|
+
},
|
|
125
|
+
"original": {
|
|
126
|
+
"owner": "holochain",
|
|
127
|
+
"ref": "v0.3.0",
|
|
128
|
+
"repo": "kitsune2",
|
|
129
|
+
"type": "github"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"lair-keystore": {
|
|
133
|
+
"flake": false,
|
|
134
|
+
"locked": {
|
|
135
|
+
"lastModified": 1759147598,
|
|
136
|
+
"narHash": "sha256-K8TkVlKAwS7uuSZC46oSHddtZTM2XGWUTNnjjYdC1bE=",
|
|
137
|
+
"owner": "holochain",
|
|
138
|
+
"repo": "lair",
|
|
139
|
+
"rev": "8aa9ab1468e82a8bfb9bf1e65762efc51659d306",
|
|
140
|
+
"type": "github"
|
|
141
|
+
},
|
|
142
|
+
"original": {
|
|
143
|
+
"owner": "holochain",
|
|
144
|
+
"ref": "v0.6.3",
|
|
145
|
+
"repo": "lair",
|
|
146
|
+
"type": "github"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"nixpkgs": {
|
|
150
|
+
"locked": {
|
|
151
|
+
"lastModified": 1762233356,
|
|
152
|
+
"narHash": "sha256-cGS3lLTYusbEP/IJIWGgnkzIl+FA5xDvtiHyjalGr4k=",
|
|
153
|
+
"owner": "nixos",
|
|
154
|
+
"repo": "nixpkgs",
|
|
155
|
+
"rev": "ca534a76c4afb2bdc07b681dbc11b453bab21af8",
|
|
156
|
+
"type": "github"
|
|
157
|
+
},
|
|
158
|
+
"original": {
|
|
159
|
+
"owner": "nixos",
|
|
160
|
+
"ref": "nixos-25.05",
|
|
161
|
+
"repo": "nixpkgs",
|
|
162
|
+
"type": "github"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"nixpkgs-lib": {
|
|
166
|
+
"locked": {
|
|
167
|
+
"lastModified": 1761765539,
|
|
168
|
+
"narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
|
|
169
|
+
"owner": "nix-community",
|
|
170
|
+
"repo": "nixpkgs.lib",
|
|
171
|
+
"rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
|
|
172
|
+
"type": "github"
|
|
173
|
+
},
|
|
174
|
+
"original": {
|
|
175
|
+
"owner": "nix-community",
|
|
176
|
+
"repo": "nixpkgs.lib",
|
|
177
|
+
"type": "github"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"playground": {
|
|
181
|
+
"flake": false,
|
|
182
|
+
"locked": {
|
|
183
|
+
"lastModified": 1756729856,
|
|
184
|
+
"narHash": "sha256-xJnIfcIyLRTXsf+N8OOMnqzRkx2gT/DSta7qCm8yU7Y=",
|
|
185
|
+
"owner": "darksoil-studio",
|
|
186
|
+
"repo": "holochain-playground",
|
|
187
|
+
"rev": "5e858641de8ac6113cfa6b47ea1350762a629a61",
|
|
188
|
+
"type": "github"
|
|
189
|
+
},
|
|
190
|
+
"original": {
|
|
191
|
+
"owner": "darksoil-studio",
|
|
192
|
+
"ref": "main",
|
|
193
|
+
"repo": "holochain-playground",
|
|
194
|
+
"type": "github"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"root": {
|
|
198
|
+
"inputs": {
|
|
199
|
+
"flake-parts": [
|
|
200
|
+
"holonix",
|
|
201
|
+
"flake-parts"
|
|
202
|
+
],
|
|
203
|
+
"holonix": "holonix",
|
|
204
|
+
"nixpkgs": [
|
|
205
|
+
"holonix",
|
|
206
|
+
"nixpkgs"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"rust-overlay": {
|
|
211
|
+
"inputs": {
|
|
212
|
+
"nixpkgs": [
|
|
213
|
+
"holonix",
|
|
214
|
+
"nixpkgs"
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
"locked": {
|
|
218
|
+
"lastModified": 1762396738,
|
|
219
|
+
"narHash": "sha256-BarSecuxtzp1boERdABLkkoxQTi6s/V33lJwUbWLrLY=",
|
|
220
|
+
"owner": "oxalica",
|
|
221
|
+
"repo": "rust-overlay",
|
|
222
|
+
"rev": "c63598992afd54d215d54f2b764adc0484c2b159",
|
|
223
|
+
"type": "github"
|
|
224
|
+
},
|
|
225
|
+
"original": {
|
|
226
|
+
"owner": "oxalica",
|
|
227
|
+
"repo": "rust-overlay",
|
|
228
|
+
"type": "github"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"root": "root",
|
|
233
|
+
"version": 7
|
|
234
|
+
}
|
package/flake.nix
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
description = "Flake for Holochain app development";
|
|
3
|
+
|
|
4
|
+
inputs = {
|
|
5
|
+
holonix.url = "github:holochain/holonix?ref=main";
|
|
6
|
+
|
|
7
|
+
nixpkgs.follows = "holonix/nixpkgs";
|
|
8
|
+
flake-parts.follows = "holonix/flake-parts";
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
outputs = inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
|
|
12
|
+
systems = builtins.attrNames inputs.holonix.devShells;
|
|
13
|
+
perSystem = { inputs', pkgs, ... }: {
|
|
14
|
+
formatter = pkgs.nixpkgs-fmt;
|
|
15
|
+
|
|
16
|
+
devShells.default = pkgs.mkShell {
|
|
17
|
+
inputsFrom = [ inputs'.holonix.devShells.default ];
|
|
18
|
+
|
|
19
|
+
packages = (with pkgs; [
|
|
20
|
+
nodejs_22
|
|
21
|
+
binaryen
|
|
22
|
+
yarn
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
shellHook = ''
|
|
26
|
+
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] '
|
|
27
|
+
'';
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/hc-spin",
|
|
3
|
-
"version": "0.600.0-
|
|
4
|
-
"holochainVersion": "0.6.0-
|
|
3
|
+
"version": "0.600.0-rc.0",
|
|
4
|
+
"holochainVersion": "0.6.0-rc.0",
|
|
5
5
|
"description": "CLI to run Holochain apps during development.",
|
|
6
6
|
"author": "matthme",
|
|
7
7
|
"homepage": "https://developer.holochain.org",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"format": "prettier --write .",
|
|
27
27
|
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
|
|
28
|
+
"lint:check": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
|
|
28
29
|
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
|
29
30
|
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
|
30
|
-
"typecheck": "
|
|
31
|
-
"start": "
|
|
32
|
-
"
|
|
33
|
-
"build": "rimraf dist && npm run typecheck && electron-vite build && mv ./out ./dist && cp ./cli/cli.js ./dist/cli.js && node ./scripts/replace-electron-version.js"
|
|
31
|
+
"typecheck": "yarn run typecheck:node && yarn run typecheck:web",
|
|
32
|
+
"start": "node dist/cli.js",
|
|
33
|
+
"build": "rimraf dist && yarn run typecheck && electron-vite build && mv ./out ./dist && cp ./cli/cli.js ./dist/cli.js && node ./scripts/replace-electron-version.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@electron-toolkit/preload": "^3.0.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"electron-builder": "^24.9.1",
|
|
56
56
|
"electron-vite": "2.3.0",
|
|
57
57
|
"eslint": "^8.56.0",
|
|
58
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
58
59
|
"prettier": "^3.1.1",
|
|
59
60
|
"rimraf": "5.0.5",
|
|
60
61
|
"typescript": "^5.3.3",
|
package/src/main/index.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import { app, IpcMainInvokeEvent, ipcMain, protocol, Menu, BrowserWindow } from 'electron';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { nanoid } from 'nanoid';
|
|
5
|
-
import { Command, Option } from 'commander';
|
|
6
|
-
import contextMenu from 'electron-context-menu';
|
|
7
|
-
import split from 'split';
|
|
8
|
-
import * as childProcess from 'child_process';
|
|
9
|
-
import { ZomeCallSigner } from '@holochain/hc-spin-rust-utils';
|
|
10
|
-
import { createHappWindow, loadHappWindow } from './windows';
|
|
11
|
-
import getPort from 'get-port';
|
|
12
1
|
import {
|
|
13
2
|
AdminWebsocket,
|
|
14
3
|
AgentPubKey,
|
|
@@ -18,22 +7,31 @@ import {
|
|
|
18
7
|
getNonceExpiration,
|
|
19
8
|
randomNonce,
|
|
20
9
|
} from '@holochain/client';
|
|
21
|
-
import {
|
|
10
|
+
import { ZomeCallSigner } from '@holochain/hc-spin-rust-utils';
|
|
22
11
|
import { encode } from '@msgpack/msgpack';
|
|
23
|
-
import
|
|
12
|
+
import * as childProcess from 'child_process';
|
|
13
|
+
import { Command, Option } from 'commander';
|
|
14
|
+
import { app, BrowserWindow, ipcMain, IpcMainInvokeEvent, Menu, protocol } from 'electron';
|
|
15
|
+
import contextMenu from 'electron-context-menu';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import getPort from 'get-port';
|
|
24
18
|
import { sha512 } from 'js-sha512';
|
|
19
|
+
import { nanoid } from 'nanoid';
|
|
20
|
+
import path from 'path';
|
|
21
|
+
import split from 'split';
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
import { menu } from './menu';
|
|
24
|
+
import { validateCliArgs } from './validateArgs';
|
|
25
|
+
import { createHappWindow, loadHappWindow } from './windows';
|
|
27
26
|
|
|
28
|
-
const
|
|
29
|
-
const cliPackageJson = require(cliPackageJsonPath);
|
|
27
|
+
const rustUtils = require('@holochain/hc-spin-rust-utils');
|
|
30
28
|
|
|
31
29
|
const cli = new Command();
|
|
32
30
|
|
|
33
31
|
cli
|
|
34
32
|
.name('hc-spin')
|
|
35
33
|
.description('CLI to run Holochain apps during development.')
|
|
36
|
-
.version(`${
|
|
34
|
+
.version(`${__PACKAGE_VERSION__} (built for holochain ${__HOLOCHAIN_VERSION__})`)
|
|
37
35
|
.argument(
|
|
38
36
|
'<path>',
|
|
39
37
|
'Path to .webhapp or .happ file to launch. If a .happ file is passed, either a UI path must be specified via --ui-path or a port pointing to a localhost server via --ui-port',
|
|
@@ -53,6 +51,12 @@ cli
|
|
|
53
51
|
),
|
|
54
52
|
)
|
|
55
53
|
.option('--network-seed <string>', 'Install the app with a specific network seed.')
|
|
54
|
+
.addOption(
|
|
55
|
+
new Option(
|
|
56
|
+
'-t, --target-arc-factor <number>',
|
|
57
|
+
'Set the target arc factor for all conductors. In normal operation, leave this as the default 1. For leacher/zero-arc nodes that do not contribute to gossip, set to 0.',
|
|
58
|
+
).argParser(parseInt),
|
|
59
|
+
)
|
|
56
60
|
.option('--ui-path <path>', "Path to the folder containing the index.html of the webhapp's UI.")
|
|
57
61
|
.option(
|
|
58
62
|
'--ui-port <number>',
|
|
@@ -206,6 +210,7 @@ async function spawnSandboxes(
|
|
|
206
210
|
signalUrl: string,
|
|
207
211
|
appId: string,
|
|
208
212
|
networkSeed?: string,
|
|
213
|
+
targetArcFactor?: number,
|
|
209
214
|
): Promise<
|
|
210
215
|
[childProcess.ChildProcessWithoutNullStreams, Array<string>, Record<number, PortsInfo>]
|
|
211
216
|
> {
|
|
@@ -220,7 +225,7 @@ async function spawnSandboxes(
|
|
|
220
225
|
'--run',
|
|
221
226
|
];
|
|
222
227
|
let appPorts = '';
|
|
223
|
-
for (
|
|
228
|
+
for (let i = 1; i <= nAgents; i++) {
|
|
224
229
|
const appPort = await getPort();
|
|
225
230
|
appPorts += `${appPort},`;
|
|
226
231
|
}
|
|
@@ -230,7 +235,11 @@ async function spawnSandboxes(
|
|
|
230
235
|
generateArgs.push('--network-seed');
|
|
231
236
|
generateArgs.push(networkSeed);
|
|
232
237
|
}
|
|
233
|
-
generateArgs.push(happPath, 'network'
|
|
238
|
+
generateArgs.push(happPath, 'network');
|
|
239
|
+
if (targetArcFactor !== undefined) {
|
|
240
|
+
generateArgs.push('--target-arc-factor', targetArcFactor.toString());
|
|
241
|
+
}
|
|
242
|
+
generateArgs.push('--bootstrap', bootStrapUrl, 'webrtc', signalUrl);
|
|
234
243
|
// console.log('GENERATE ARGS: ', generateArgs);
|
|
235
244
|
|
|
236
245
|
let readyConductors = 0;
|
|
@@ -302,6 +311,7 @@ app.whenReady().then(async () => {
|
|
|
302
311
|
CLI_OPTS.singalingUrl ? CLI_OPTS.singalingUrl : signalingUrl,
|
|
303
312
|
CLI_OPTS.appId,
|
|
304
313
|
CLI_OPTS.networkSeed,
|
|
314
|
+
CLI_OPTS.targetArcFactor,
|
|
305
315
|
);
|
|
306
316
|
|
|
307
317
|
const lairUrls: string[] = [];
|
|
@@ -324,7 +334,7 @@ app.whenReady().then(async () => {
|
|
|
324
334
|
|
|
325
335
|
// open browser window for each sandbox
|
|
326
336
|
//
|
|
327
|
-
for (
|
|
337
|
+
for (let i = 0; i < CLI_OPTS.numAgents; i++) {
|
|
328
338
|
const zomeCallSigner = await rustUtils.ZomeCallSigner.connect(lairUrls[i], 'pass');
|
|
329
339
|
|
|
330
340
|
const adminPort = portsInfo[i].admin_port;
|
package/src/main/menu.ts
CHANGED
|
@@ -49,41 +49,41 @@ export const menu = Menu.buildFromTemplate([
|
|
|
49
49
|
],
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
label:
|
|
52
|
+
label: 'Edit',
|
|
53
53
|
submenu: [
|
|
54
54
|
{
|
|
55
|
-
label:
|
|
56
|
-
role:
|
|
57
|
-
accelerator:
|
|
55
|
+
label: 'Undo',
|
|
56
|
+
role: 'undo',
|
|
57
|
+
accelerator: 'CommandOrControl+Z',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
label:
|
|
61
|
-
role:
|
|
62
|
-
accelerator:
|
|
60
|
+
label: 'Redo',
|
|
61
|
+
role: 'redo',
|
|
62
|
+
accelerator: 'CommandOrControl+Shift+Z',
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
type:
|
|
65
|
+
type: 'separator',
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
|
-
label:
|
|
69
|
-
role:
|
|
70
|
-
accelerator:
|
|
68
|
+
label: 'Cut',
|
|
69
|
+
role: 'cut',
|
|
70
|
+
accelerator: 'CommandOrControl+X',
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
label:
|
|
74
|
-
role:
|
|
75
|
-
accelerator:
|
|
73
|
+
label: 'Copy',
|
|
74
|
+
role: 'copy',
|
|
75
|
+
accelerator: 'CommandOrControl+C',
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
label:
|
|
79
|
-
role:
|
|
80
|
-
accelerator:
|
|
78
|
+
label: 'Paste',
|
|
79
|
+
role: 'paste',
|
|
80
|
+
accelerator: 'CommandOrControl+V',
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
label:
|
|
84
|
-
role:
|
|
85
|
-
accelerator:
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
}
|
|
83
|
+
label: 'Select All',
|
|
84
|
+
role: 'selectAll',
|
|
85
|
+
accelerator: 'CommandOrControl+A',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
89
|
]);
|
package/src/main/validateArgs.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
|
|
3
4
|
import { UISource } from './windows';
|
|
4
5
|
|
|
5
6
|
export type CliOpts = {
|
|
@@ -7,6 +8,7 @@ export type CliOpts = {
|
|
|
7
8
|
holochainPath?: string;
|
|
8
9
|
numAgents?: number;
|
|
9
10
|
networkSeed?: string;
|
|
11
|
+
targetArcFactor?: number;
|
|
10
12
|
uiPath?: string;
|
|
11
13
|
uiPort?: number;
|
|
12
14
|
signalingUrl?: string;
|
|
@@ -19,6 +21,7 @@ export type CliOptsValidated = {
|
|
|
19
21
|
holochainPath: string | undefined;
|
|
20
22
|
numAgents: number;
|
|
21
23
|
networkSeed: string | undefined;
|
|
24
|
+
targetArcFactor: number | undefined;
|
|
22
25
|
uiSource: UISource;
|
|
23
26
|
singalingUrl: string | undefined;
|
|
24
27
|
bootstrapUrl: string | undefined;
|
|
@@ -52,11 +55,22 @@ export function validateCliArgs(
|
|
|
52
55
|
`Path to .happ or .webhapp file passed as argument does not exist: ${happOrWebhappPath}`,
|
|
53
56
|
);
|
|
54
57
|
}
|
|
55
|
-
if (
|
|
58
|
+
if (
|
|
59
|
+
cliOpts.numAgents !== undefined &&
|
|
60
|
+
(typeof cliOpts.numAgents !== 'number' || Number.isNaN(cliOpts.numAgents))
|
|
61
|
+
) {
|
|
56
62
|
throw new Error(
|
|
57
63
|
`The --num-agents (-n) option must be of type number but got: ${cliOpts.numAgents}`,
|
|
58
64
|
);
|
|
59
65
|
}
|
|
66
|
+
if (
|
|
67
|
+
cliOpts.targetArcFactor !== undefined &&
|
|
68
|
+
(typeof cliOpts.targetArcFactor !== 'number' || Number.isNaN(cliOpts.targetArcFactor))
|
|
69
|
+
) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`The --target-arc-factor (-t) option must be a valid number but got: ${cliOpts.targetArcFactor}`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
60
74
|
const isHapp = happOrWebhappPath.endsWith('.happ');
|
|
61
75
|
if (isHapp && !cliOpts.uiPath && !cliOpts.uiPort) {
|
|
62
76
|
throw new Error(
|
|
@@ -78,6 +92,7 @@ export function validateCliArgs(
|
|
|
78
92
|
holochainPath,
|
|
79
93
|
numAgents,
|
|
80
94
|
networkSeed: cliOpts.networkSeed,
|
|
95
|
+
targetArcFactor: cliOpts.targetArcFactor,
|
|
81
96
|
uiSource: cliOpts.uiPath
|
|
82
97
|
? { type: 'path', path: cliOpts.uiPath }
|
|
83
98
|
: cliOpts.uiPort
|
package/src/main/windows.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import url from 'url';
|
|
1
|
+
import { is } from '@electron-toolkit/utils';
|
|
4
2
|
import { AppAuthenticationToken, InstalledAppId } from '@holochain/client';
|
|
5
3
|
import { BrowserWindow, NativeImage, nativeImage, net, session, shell } from 'electron';
|
|
6
|
-
import
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import url from 'url';
|
|
7
|
+
|
|
7
8
|
import { HappOrWebhappPath } from './validateArgs';
|
|
8
9
|
|
|
9
10
|
export type UISource =
|
|
@@ -146,7 +147,7 @@ export async function loadHappWindow(
|
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
148
149
|
} else {
|
|
149
|
-
throw new Error(
|
|
150
|
+
throw new Error(`Unsupported uiSource: ${JSON.stringify(uiSource)}`);
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
happWindow.show();
|
package/tsconfig.node.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@electron-toolkit/tsconfig/tsconfig.node.json",
|
|
3
|
-
"include": ["electron.vite.config.*", "src/main/*", "src/preload/*"],
|
|
3
|
+
"include": ["electron.vite.config.*", "src/main/*", "src/preload/*", "package.json"],
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"composite": true,
|
|
6
|
-
"types": ["electron-vite/node"]
|
|
6
|
+
"types": ["electron-vite/node"],
|
|
7
|
+
"resolveJsonModule": true
|
|
7
8
|
}
|
|
8
9
|
}
|