@holochain/hc-spin 0.100.2 → 0.100.3
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/dist/main/index.js +51 -12
- package/package.json +2 -2
- package/src/main/index.ts +5 -2
- package/src/main/menu.ts +51 -0
- package/src/main/windows.ts +0 -12
package/dist/main/index.js
CHANGED
|
@@ -129,17 +129,6 @@ electron.contextBridge.exposeInMainWorld("__HC_LAUNCHER_ENV__", {
|
|
|
129
129
|
});
|
|
130
130
|
if (openDevtools)
|
|
131
131
|
happWindow.webContents.openDevTools();
|
|
132
|
-
happWindow.webContents.on("before-input-event", (e, input) => {
|
|
133
|
-
if (input.code === "F12") {
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
if (happWindow.webContents.isDevToolsOpened()) {
|
|
136
|
-
happWindow.webContents.closeDevTools();
|
|
137
|
-
} else {
|
|
138
|
-
happWindow.webContents.openDevTools();
|
|
139
|
-
happWindow.webContents.focus();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
132
|
if (uiSource.type === "port") {
|
|
144
133
|
try {
|
|
145
134
|
await electron.net.fetch(`http://127.0.0.1:${uiSource.port}/index.html`);
|
|
@@ -11752,9 +11741,58 @@ function validateCliArgs(cliArgs, cliOpts, appDataRootDir) {
|
|
|
11752
11741
|
openDevtools: cliOpts.openDevtools ? true : false
|
|
11753
11742
|
};
|
|
11754
11743
|
}
|
|
11744
|
+
const menu = electron.Menu.buildFromTemplate([
|
|
11745
|
+
{
|
|
11746
|
+
label: "Options",
|
|
11747
|
+
submenu: [
|
|
11748
|
+
{
|
|
11749
|
+
label: "toggle dev tools (F12)",
|
|
11750
|
+
click: () => {
|
|
11751
|
+
const focusedWindow = electron.BrowserWindow.getFocusedWindow();
|
|
11752
|
+
if (focusedWindow) {
|
|
11753
|
+
focusedWindow.webContents.toggleDevTools();
|
|
11754
|
+
}
|
|
11755
|
+
},
|
|
11756
|
+
accelerator: "F12"
|
|
11757
|
+
},
|
|
11758
|
+
{
|
|
11759
|
+
label: "toggle dev tools (Ctrl+Shift+I)",
|
|
11760
|
+
click: () => {
|
|
11761
|
+
const focusedWindow = electron.BrowserWindow.getFocusedWindow();
|
|
11762
|
+
if (focusedWindow) {
|
|
11763
|
+
focusedWindow.webContents.toggleDevTools();
|
|
11764
|
+
}
|
|
11765
|
+
},
|
|
11766
|
+
visible: false,
|
|
11767
|
+
accelerator: "CommandOrControl+Shift+I"
|
|
11768
|
+
},
|
|
11769
|
+
{
|
|
11770
|
+
label: "Reload (F5)",
|
|
11771
|
+
click: () => {
|
|
11772
|
+
const focusedWindow = electron.BrowserWindow.getFocusedWindow();
|
|
11773
|
+
if (focusedWindow) {
|
|
11774
|
+
focusedWindow.webContents.reload();
|
|
11775
|
+
}
|
|
11776
|
+
},
|
|
11777
|
+
accelerator: "F5"
|
|
11778
|
+
},
|
|
11779
|
+
{
|
|
11780
|
+
label: "Reload (Ctrl+R)",
|
|
11781
|
+
click: () => {
|
|
11782
|
+
const focusedWindow = electron.BrowserWindow.getFocusedWindow();
|
|
11783
|
+
if (focusedWindow) {
|
|
11784
|
+
focusedWindow.webContents.reload();
|
|
11785
|
+
}
|
|
11786
|
+
},
|
|
11787
|
+
visible: false,
|
|
11788
|
+
accelerator: "CommandOrControl+R"
|
|
11789
|
+
}
|
|
11790
|
+
]
|
|
11791
|
+
}
|
|
11792
|
+
]);
|
|
11755
11793
|
const rustUtils = require("@holochain/hc-spin-rust-utils");
|
|
11756
11794
|
const cli = new commander.Command();
|
|
11757
|
-
cli.name("hc-spin").description("CLI to run Holochain apps during development.").version(`0.100.
|
|
11795
|
+
cli.name("hc-spin").description("CLI to run Holochain apps during development.").version(`0.100.3 (for holochain 0.1.x)`).argument(
|
|
11758
11796
|
"<path>",
|
|
11759
11797
|
"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"
|
|
11760
11798
|
).option(
|
|
@@ -11790,6 +11828,7 @@ for (const folder of hcSpinFolders) {
|
|
|
11790
11828
|
}
|
|
11791
11829
|
const DATA_ROOT_DIR = path.join(electron.app.getPath("temp"), `hc-spin-${nanoid(8)}`);
|
|
11792
11830
|
electron.app.setPath("userData", path.join(DATA_ROOT_DIR, "electron"));
|
|
11831
|
+
electron.Menu.setApplicationMenu(menu);
|
|
11793
11832
|
const CLI_OPTS = validateCliArgs(cli.args, cli.opts(), DATA_ROOT_DIR);
|
|
11794
11833
|
const SANDBOX_PROCESSES = [];
|
|
11795
11834
|
const WINDOW_INFO_MAP = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/hc-spin",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.3",
|
|
4
4
|
"description": "CLI to run Holochain aps during development.",
|
|
5
5
|
"author": "matthme",
|
|
6
6
|
"homepage": "https://developer.holochain.org",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@electron-toolkit/preload": "^3.0.0",
|
|
24
24
|
"@electron-toolkit/utils": "^3.0.0",
|
|
25
25
|
"@holochain/client": "^0.16.3",
|
|
26
|
-
"@holochain/hc-spin-rust-utils": "0.100.
|
|
26
|
+
"@holochain/hc-spin-rust-utils": "^0.100.2",
|
|
27
27
|
"@msgpack/msgpack": "^2.8.0",
|
|
28
28
|
"commander": "11.1.0",
|
|
29
29
|
"electron": "^28.1.1",
|
package/src/main/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { app, IpcMainInvokeEvent, ipcMain, protocol } from 'electron';
|
|
1
|
+
import { app, IpcMainInvokeEvent, ipcMain, protocol, Menu } from 'electron';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { nanoid } from 'nanoid';
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
randomNonce,
|
|
20
20
|
} from '@holochain/client';
|
|
21
21
|
import { validateCliArgs } from './validateArgs';
|
|
22
|
+
import { menu } from './menu';
|
|
22
23
|
|
|
23
24
|
const rustUtils = require('@holochain/hc-spin-rust-utils');
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ const cli = new Command();
|
|
|
27
28
|
cli
|
|
28
29
|
.name('hc-spin')
|
|
29
30
|
.description('CLI to run Holochain apps during development.')
|
|
30
|
-
.version(`0.100.
|
|
31
|
+
.version(`0.100.3 (for holochain 0.1.x)`)
|
|
31
32
|
.argument(
|
|
32
33
|
'<path>',
|
|
33
34
|
'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',
|
|
@@ -84,6 +85,8 @@ const DATA_ROOT_DIR = path.join(app.getPath('temp'), `hc-spin-${nanoid(8)}`);
|
|
|
84
85
|
|
|
85
86
|
app.setPath('userData', path.join(DATA_ROOT_DIR, 'electron'));
|
|
86
87
|
|
|
88
|
+
Menu.setApplicationMenu(menu);
|
|
89
|
+
|
|
87
90
|
const CLI_OPTS = validateCliArgs(cli.args, cli.opts(), DATA_ROOT_DIR);
|
|
88
91
|
|
|
89
92
|
// const SANDBOX_DIRECTORIES: Array<string> = [];
|
package/src/main/menu.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BrowserWindow, Menu } from 'electron';
|
|
2
|
+
|
|
3
|
+
export const menu = Menu.buildFromTemplate([
|
|
4
|
+
{
|
|
5
|
+
label: 'Options',
|
|
6
|
+
submenu: [
|
|
7
|
+
{
|
|
8
|
+
label: 'toggle dev tools (F12)',
|
|
9
|
+
click: () => {
|
|
10
|
+
const focusedWindow = BrowserWindow.getFocusedWindow();
|
|
11
|
+
if (focusedWindow) {
|
|
12
|
+
focusedWindow.webContents.toggleDevTools();
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
accelerator: 'F12',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'toggle dev tools (Ctrl+Shift+I)',
|
|
19
|
+
click: () => {
|
|
20
|
+
const focusedWindow = BrowserWindow.getFocusedWindow();
|
|
21
|
+
if (focusedWindow) {
|
|
22
|
+
focusedWindow.webContents.toggleDevTools();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
visible: false,
|
|
26
|
+
accelerator: 'CommandOrControl+Shift+I',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'Reload (F5)',
|
|
30
|
+
click: () => {
|
|
31
|
+
const focusedWindow = BrowserWindow.getFocusedWindow();
|
|
32
|
+
if (focusedWindow) {
|
|
33
|
+
focusedWindow.webContents.reload();
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
accelerator: 'F5',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Reload (Ctrl+R)',
|
|
40
|
+
click: () => {
|
|
41
|
+
const focusedWindow = BrowserWindow.getFocusedWindow();
|
|
42
|
+
if (focusedWindow) {
|
|
43
|
+
focusedWindow.webContents.reload();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
visible: false,
|
|
47
|
+
accelerator: 'CommandOrControl+R',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
]);
|
package/src/main/windows.ts
CHANGED
|
@@ -107,18 +107,6 @@ electron.contextBridge.exposeInMainWorld("__HC_LAUNCHER_ENV__", {
|
|
|
107
107
|
|
|
108
108
|
if (openDevtools) happWindow.webContents.openDevTools();
|
|
109
109
|
|
|
110
|
-
happWindow.webContents.on('before-input-event', (e, input) => {
|
|
111
|
-
if (input.code === 'F12') {
|
|
112
|
-
e.preventDefault();
|
|
113
|
-
if (happWindow.webContents.isDevToolsOpened()) {
|
|
114
|
-
happWindow.webContents.closeDevTools();
|
|
115
|
-
} else {
|
|
116
|
-
happWindow.webContents.openDevTools();
|
|
117
|
-
happWindow.webContents.focus();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
110
|
if (uiSource.type === 'port') {
|
|
123
111
|
try {
|
|
124
112
|
// Check whether dev server is responsive and index.html exists
|