solid-chat 0.0.4 → 0.0.6
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/cli.js +20 -5
- package/package.json +2 -4
package/bin/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ const MIME_TYPES = {
|
|
|
26
26
|
'.ttf': 'font/ttf'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
let port = parseInt(process.argv[2]) || 3333
|
|
30
30
|
|
|
31
31
|
const server = createServer((req, res) => {
|
|
32
32
|
let filePath = join(ROOT, req.url === '/' ? 'index.html' : req.url)
|
|
@@ -61,9 +61,10 @@ const server = createServer((req, res) => {
|
|
|
61
61
|
}
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
function startServer(p) {
|
|
65
|
+
server.listen(p, () => {
|
|
66
|
+
const url = `http://localhost:${p}`
|
|
67
|
+
console.log(`
|
|
67
68
|
╭─────────────────────────────────────╮
|
|
68
69
|
│ │
|
|
69
70
|
│ Solid Chat running at: │
|
|
@@ -73,5 +74,19 @@ server.listen(port, () => {
|
|
|
73
74
|
│ │
|
|
74
75
|
╰─────────────────────────────────────╯
|
|
75
76
|
`)
|
|
76
|
-
|
|
77
|
+
open(url)
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
server.on('error', (err) => {
|
|
82
|
+
if (err.code === 'EADDRINUSE') {
|
|
83
|
+
console.log(`Port ${port} in use, trying ${port + 1}...`)
|
|
84
|
+
port++
|
|
85
|
+
startServer(port)
|
|
86
|
+
} else {
|
|
87
|
+
console.error('Server error:', err.message)
|
|
88
|
+
process.exit(1)
|
|
89
|
+
}
|
|
77
90
|
})
|
|
91
|
+
|
|
92
|
+
startServer(port)
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-chat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Modern chat panes for Solid pods - longChatPane and chatListPane",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
|
-
"bin":
|
|
9
|
-
"solid-chat": "./bin/cli.js"
|
|
10
|
-
},
|
|
8
|
+
"bin": "bin/cli.js",
|
|
11
9
|
"exports": {
|
|
12
10
|
".": "./src/index.js",
|
|
13
11
|
"./longChatPane": "./src/longChatPane.js",
|