clawport-ui 0.6.5 → 0.6.7
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/clawport.mjs +12 -5
- package/next.config.mjs +15 -1
- package/package.json +1 -1
package/bin/clawport.mjs
CHANGED
|
@@ -150,9 +150,15 @@ ${dim(`Package root: ${PKG_ROOT}`)}
|
|
|
150
150
|
`)
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
function portArgs() {
|
|
154
|
+
const hasPort = extraArgs.some((a) => a === '--port' || a.startsWith('--port=') || a === '-p')
|
|
155
|
+
if (!hasPort && process.env.PORT) return ['--port', process.env.PORT]
|
|
156
|
+
return []
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
function cmdDev() {
|
|
154
160
|
console.log(`\n ${bold('Starting ClawPort dev server...')}\n`)
|
|
155
|
-
run(NEXT_BIN, ['dev', ...extraArgs])
|
|
161
|
+
run(NEXT_BIN, ['dev', ...portArgs(), ...extraArgs])
|
|
156
162
|
}
|
|
157
163
|
|
|
158
164
|
function cmdStart() {
|
|
@@ -164,7 +170,7 @@ function cmdStart() {
|
|
|
164
170
|
})
|
|
165
171
|
build.on('close', (code) => {
|
|
166
172
|
if (code !== 0) process.exit(code)
|
|
167
|
-
run(NEXT_BIN, ['start', ...extraArgs])
|
|
173
|
+
run(NEXT_BIN, ['start', ...portArgs(), ...extraArgs])
|
|
168
174
|
})
|
|
169
175
|
}
|
|
170
176
|
|
|
@@ -286,9 +292,10 @@ async function cmdDoctor() {
|
|
|
286
292
|
}
|
|
287
293
|
check(workspaceOk, 'Workspace structure', workspaceFix)
|
|
288
294
|
|
|
289
|
-
// 7. Port
|
|
290
|
-
const
|
|
291
|
-
|
|
295
|
+
// 7. Port available
|
|
296
|
+
const port = Number(process.env.PORT) || 3000
|
|
297
|
+
const portFree = await checkPort(port)
|
|
298
|
+
check(portFree, `Port ${port} available`, `Port ${port} is in use. Use: clawport dev --port ${port + 1}`)
|
|
292
299
|
|
|
293
300
|
// Summary
|
|
294
301
|
console.log()
|
package/next.config.mjs
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { dirname } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { networkInterfaces } from "node:os";
|
|
3
4
|
|
|
4
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
6
|
|
|
7
|
+
/** Collect all local network IPs so the dev server accepts cross-origin
|
|
8
|
+
* requests from LAN, Tailscale, or any non-localhost address. */
|
|
9
|
+
function getLocalIPs() {
|
|
10
|
+
const ips = [];
|
|
11
|
+
const interfaces = networkInterfaces();
|
|
12
|
+
for (const addrs of Object.values(interfaces)) {
|
|
13
|
+
for (const addr of addrs) {
|
|
14
|
+
if (!addr.internal) ips.push(addr.address);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return ips;
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
/** @type {import('next').NextConfig} */
|
|
7
21
|
const nextConfig = {
|
|
8
22
|
turbopack: {
|
|
9
23
|
root: __dirname,
|
|
10
24
|
},
|
|
11
|
-
allowedDevOrigins: ["
|
|
25
|
+
allowedDevOrigins: ["local-origin.dev", "*.local-origin.dev", ...getLocalIPs()],
|
|
12
26
|
};
|
|
13
27
|
|
|
14
28
|
export default nextConfig;
|