sandymount 0.0.2 → 0.0.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/bin/sandymount.js +38 -31
- package/package.json +1 -1
package/bin/sandymount.js
CHANGED
|
@@ -6,18 +6,17 @@
|
|
|
6
6
|
* SAND Stack: Solid + ActivityPub + Nostr + DID
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* sandymount
|
|
10
|
-
* sandymount help
|
|
9
|
+
* sandymount [options] Start the SAND server (default)
|
|
10
|
+
* sandymount help Show help
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { spawn } from 'child_process';
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
|
-
import { dirname, join } from 'path';
|
|
16
14
|
|
|
17
15
|
const args = process.argv.slice(2);
|
|
18
16
|
const command = args[0];
|
|
19
17
|
|
|
20
|
-
const VERSION = '0.0.
|
|
18
|
+
const VERSION = '0.0.3';
|
|
19
|
+
const DEFAULT_PORT = 5420;
|
|
21
20
|
|
|
22
21
|
function showHelp() {
|
|
23
22
|
console.log(`
|
|
@@ -26,22 +25,23 @@ function showHelp() {
|
|
|
26
25
|
SAND Stack: Solid + ActivityPub + Nostr + DID
|
|
27
26
|
|
|
28
27
|
Usage:
|
|
29
|
-
sandymount
|
|
30
|
-
sandymount help
|
|
31
|
-
sandymount version
|
|
28
|
+
sandymount [options] Start the server (default)
|
|
29
|
+
sandymount help Show this help
|
|
30
|
+
sandymount version Show version
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
--port <n> Port to listen on (default:
|
|
32
|
+
Options:
|
|
33
|
+
--port <n> Port to listen on (default: ${DEFAULT_PORT})
|
|
35
34
|
--root <path> Data directory (default: ./data)
|
|
36
|
-
--nostr
|
|
37
|
-
--git
|
|
35
|
+
--no-nostr Disable Nostr relay
|
|
36
|
+
--no-git Disable Git HTTP backend
|
|
38
37
|
--idp Enable identity provider
|
|
39
38
|
--quiet Suppress logs
|
|
40
39
|
|
|
41
40
|
Examples:
|
|
42
|
-
sandymount
|
|
43
|
-
sandymount
|
|
44
|
-
|
|
41
|
+
npx sandymount
|
|
42
|
+
sandymount
|
|
43
|
+
sandymount --port 3000
|
|
44
|
+
sand --idp
|
|
45
45
|
|
|
46
46
|
Website: https://sandy-mount.com
|
|
47
47
|
`);
|
|
@@ -51,18 +51,25 @@ function showVersion() {
|
|
|
51
51
|
console.log(`sandymount v${VERSION}`);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function startServer() {
|
|
55
|
-
|
|
56
|
-
const jssArgs = ['start', ...args.slice(1)];
|
|
54
|
+
function startServer(startArgs) {
|
|
55
|
+
const jssArgs = ['start'];
|
|
57
56
|
|
|
58
|
-
// Add
|
|
59
|
-
if (!
|
|
57
|
+
// Add default port if not specified
|
|
58
|
+
if (!startArgs.includes('--port') && !startArgs.includes('-p')) {
|
|
59
|
+
jssArgs.push('--port', String(DEFAULT_PORT));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Add defaults: nostr and git ON unless disabled
|
|
63
|
+
if (!startArgs.includes('--nostr') && !startArgs.includes('--no-nostr')) {
|
|
60
64
|
jssArgs.push('--nostr');
|
|
61
65
|
}
|
|
62
|
-
if (!
|
|
66
|
+
if (!startArgs.includes('--git') && !startArgs.includes('--no-git')) {
|
|
63
67
|
jssArgs.push('--git');
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
// Pass through all other args
|
|
71
|
+
jssArgs.push(...startArgs);
|
|
72
|
+
|
|
66
73
|
console.log('');
|
|
67
74
|
console.log('🏖️ Starting Sandymount...');
|
|
68
75
|
console.log('');
|
|
@@ -87,22 +94,22 @@ function startServer() {
|
|
|
87
94
|
|
|
88
95
|
// Main
|
|
89
96
|
switch (command) {
|
|
90
|
-
case '
|
|
91
|
-
|
|
97
|
+
case 'help':
|
|
98
|
+
case '--help':
|
|
99
|
+
case '-h':
|
|
100
|
+
showHelp();
|
|
92
101
|
break;
|
|
93
102
|
case 'version':
|
|
94
103
|
case '--version':
|
|
95
104
|
case '-v':
|
|
96
105
|
showVersion();
|
|
97
106
|
break;
|
|
98
|
-
case '
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
case undefined:
|
|
102
|
-
showHelp();
|
|
107
|
+
case 'start':
|
|
108
|
+
// Explicit start, pass args after 'start'
|
|
109
|
+
startServer(args.slice(1));
|
|
103
110
|
break;
|
|
104
111
|
default:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
// No command or unknown = start server, pass all args
|
|
113
|
+
startServer(args);
|
|
114
|
+
break;
|
|
108
115
|
}
|