@holochain/hc-spin 0.100.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/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ dist
3
+ out
4
+ .gitignore
package/.eslintrc ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "parserOptions": {
5
+ "parser": "@typescript-eslint/parser",
6
+ "ecmaVersion": 2020,
7
+ "sourceType": "module"
8
+ },
9
+ "env": {
10
+ "browser": true,
11
+ "es2017": true,
12
+ "node": true
13
+ },
14
+ "extends": [
15
+ "eslint:recommended",
16
+ "prettier",
17
+ "@electron-toolkit/eslint-config-ts/recommended",
18
+ "@electron-toolkit/eslint-config-prettier"
19
+ ],
20
+ "plugins": ["@typescript-eslint", "prettier", "simple-import-sort"],
21
+ "rules": {
22
+ "prettier/prettier": "error",
23
+ "vue/attribute-hyphenation": "off",
24
+ "vue/no-multiple-template-root": "off",
25
+ "vue/multi-word-component-names": "off",
26
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
27
+ "simple-import-sort/imports": "error",
28
+ "simple-import-sort/exports": "error",
29
+ "@typescript-eslint/explicit-function-return-type": "off"
30
+ }
31
+ }
@@ -0,0 +1,6 @@
1
+ out
2
+ dist
3
+ pnpm-lock.yaml
4
+ LICENSE.md
5
+ tsconfig.json
6
+ tsconfig.*.json
@@ -0,0 +1,3 @@
1
+ singleQuote: true
2
+ semi: true
3
+ printWidth: 100
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["dbaeumer.vscode-eslint"]
3
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Debug Main Process",
6
+ "type": "node",
7
+ "request": "launch",
8
+ "cwd": "${workspaceRoot}",
9
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite",
10
+ "windows": {
11
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd"
12
+ },
13
+ "runtimeArgs": ["--sourcemap"],
14
+ "env": {
15
+ "REMOTE_DEBUGGING_PORT": "9222"
16
+ }
17
+ },
18
+ {
19
+ "name": "Debug Renderer Process",
20
+ "port": 9222,
21
+ "request": "attach",
22
+ "type": "chrome",
23
+ "webRoot": "${workspaceFolder}/src/renderer",
24
+ "timeout": 60000,
25
+ "presentation": {
26
+ "hidden": true
27
+ }
28
+ }
29
+ ],
30
+ "compounds": [
31
+ {
32
+ "name": "Debug All",
33
+ "configurations": ["Debug Main Process", "Debug Renderer Process"],
34
+ "presentation": {
35
+ "order": 1
36
+ }
37
+ }
38
+ ]
39
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "[typescript]": {
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
4
+ },
5
+ "[javascript]": {
6
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
7
+ },
8
+ "[json]": {
9
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
10
+ },
11
+ "editor.formatOnSave": true,
12
+ }
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # hc-spin
2
+
3
+ CLI to run Holochain apps in development mode.
4
+
5
+ ## Installation
6
+
7
+ To install the latest version compatible with holochain 0.1.x:
8
+
9
+ ```
10
+ npm install --save-dev @holochain/hc-spin@">=0.100.0 <0.200.0"
11
+ ```
12
+
13
+ To install the latest version compatible with holochain 0.2.x:
14
+
15
+ ```
16
+ npm install --save-dev @holochain/hc-spin@">=0.200.0 <0.300.0"
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ Usage: hc-spin [options] <path>
23
+
24
+ CLI to run Holochain aps during development.
25
+
26
+ Arguments:
27
+ path Path to .webhapp or .happ file to launch. If a .happ file is passed, either a UI path must be specified via
28
+ --ui-path or a port pointing to a localhost server via --ui-port
29
+
30
+ Options:
31
+ -V, --version output the version number
32
+ --app-id <string> Install the app with a specific app id. By default the app id is derived from the name of the .webhapp/.happ
33
+ file that you pass but this option allows you to set it explicitly
34
+ but this argument allows you to specify a custom one.
35
+ --holochain-path <path> Set the path to the holochain binary [default: holochain].
36
+ -n, --num-agents <number> How many agents to spawn the app for.
37
+ --ui-path <path> Path to the folder containing the index.html of the webhapp's UI.
38
+ --ui-port <number> Port pointing to a localhost dev server that serves your UI assets.
39
+ but this argument allows you to specify a custom one.
40
+ -h, --help display help for command
41
+ ```
42
+
43
+ ## Example Commands
44
+
45
+ Run a .happ file with 2 agents connected to the UI of your dev server running on port 8888:
46
+
47
+ ```
48
+ hc-spin -n 2 --ui-port 8888 path/to/your/happ-file.happ
49
+ ```
50
+
51
+ Run a fully packaged .webhapp for 2 agents:
52
+
53
+ ```
54
+ hc-spin -n 2 path/to/your/webhapp-file.webhapp
55
+ ```
56
+
57
+ Run a .happ file with 2 agents connected to the UI assets residing at the provided path:
58
+
59
+ ```
60
+ hc-spin -n 2 --ui-path path/to/directory/containing/ui/assets path/to/your/happ-file.happ
61
+ ```
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>com.apple.security.cs.allow-jit</key>
6
+ <true/>
7
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8
+ <true/>
9
+ <key>com.apple.security.cs.allow-dyld-environment-variables</key>
10
+ <true/>
11
+ </dict>
12
+ </plist>
Binary file
package/build/icon.ico ADDED
Binary file
package/build/icon.png ADDED
Binary file
package/cli/cli.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ let electronBinary;
7
+ let pathStr = '../node_modules/.bin/electron';
8
+ // recursively look for electron binary in node_modules folder
9
+ for (let i = 0; i < 7; i++) {
10
+ const maybeElectronBinary = path.resolve(__dirname, pathStr);
11
+ if (fs.existsSync(maybeElectronBinary)) {
12
+ electronBinary = maybeElectronBinary;
13
+ break;
14
+ } else {
15
+ pathStr = '../' + pathStr;
16
+ }
17
+ }
18
+
19
+ if (!electronBinary) {
20
+ throw new Error('Failed to locate electron binary. __dirname: ', __dirname);
21
+ }
22
+
23
+ const child = spawn(
24
+ electronBinary,
25
+ [path.resolve(__dirname, 'main/index.js'), ...process.argv.slice(2)],
26
+ {
27
+ stdio: 'inherit',
28
+ },
29
+ );
30
+
31
+ // Handle child process exit
32
+ child.on('exit', (code, _signal) => {
33
+ process.exit(code);
34
+ });
package/dist/cli.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ let electronBinary;
7
+ let pathStr = '../node_modules/.bin/electron';
8
+ // recursively look for electron binary in node_modules folder
9
+ for (let i = 0; i < 7; i++) {
10
+ const maybeElectronBinary = path.resolve(__dirname, pathStr);
11
+ if (fs.existsSync(maybeElectronBinary)) {
12
+ electronBinary = maybeElectronBinary;
13
+ break;
14
+ } else {
15
+ pathStr = '../' + pathStr;
16
+ }
17
+ }
18
+
19
+ if (!electronBinary) {
20
+ throw new Error('Failed to locate electron binary. __dirname: ', __dirname);
21
+ }
22
+
23
+ const child = spawn(
24
+ electronBinary,
25
+ [path.resolve(__dirname, 'main/index.js'), ...process.argv.slice(2)],
26
+ {
27
+ stdio: 'inherit',
28
+ },
29
+ );
30
+
31
+ // Handle child process exit
32
+ child.on('exit', (code, _signal) => {
33
+ process.exit(code);
34
+ });