@antigenic-oss/paint 0.2.1 → 0.2.2
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/bridge-server.js +4 -2
- package/bin/paint.js +25 -10
- package/package.json +1 -1
package/bin/bridge-server.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require('node:path')
|
|
4
|
+
const fs = require('node:fs')
|
|
4
5
|
const { spawn, spawnSync } = require('node:child_process')
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const ENTRY_REAL_PATH = fs.realpathSync(__filename)
|
|
8
|
+
const APP_ROOT = path.resolve(path.dirname(ENTRY_REAL_PATH), '..')
|
|
7
9
|
const TSX_CLI = path.join(APP_ROOT, 'node_modules', 'tsx', 'dist', 'cli.mjs')
|
|
8
10
|
|
|
9
11
|
const nodeCheck = spawnSync(process.execPath, ['--version'], {
|
|
@@ -14,7 +16,7 @@ if (nodeCheck.status !== 0) {
|
|
|
14
16
|
process.exit(1)
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
if (!
|
|
19
|
+
if (!fs.existsSync(TSX_CLI)) {
|
|
18
20
|
console.error(
|
|
19
21
|
'Missing runtime dependency: tsx. Reinstall @antigenic-oss/paint.',
|
|
20
22
|
)
|
package/bin/paint.js
CHANGED
|
@@ -7,7 +7,8 @@ const http = require('node:http')
|
|
|
7
7
|
const https = require('node:https')
|
|
8
8
|
const { spawn, spawnSync } = require('node:child_process')
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const ENTRY_REAL_PATH = fs.realpathSync(__filename)
|
|
11
|
+
const APP_ROOT = path.resolve(path.dirname(ENTRY_REAL_PATH), '..')
|
|
11
12
|
const STATE_DIR = path.join(os.homedir(), '.paint')
|
|
12
13
|
|
|
13
14
|
const APP_STATE_FILE = path.join(STATE_DIR, 'server.json')
|
|
@@ -18,14 +19,27 @@ const WEB_LOG_FILE = path.join(STATE_DIR, 'web.log')
|
|
|
18
19
|
const TERMINAL_LOG_FILE = path.join(STATE_DIR, 'terminal.log')
|
|
19
20
|
const BRIDGE_LOG_FILE = path.join(STATE_DIR, 'bridge.log')
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
function resolveNextBin() {
|
|
23
|
+
const directPath = path.join(
|
|
24
|
+
APP_ROOT,
|
|
25
|
+
'node_modules',
|
|
26
|
+
'next',
|
|
27
|
+
'dist',
|
|
28
|
+
'bin',
|
|
29
|
+
'next',
|
|
30
|
+
)
|
|
31
|
+
if (fs.existsSync(directPath)) {
|
|
32
|
+
return directPath
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
return require.resolve('next/dist/bin/next', { paths: [APP_ROOT] })
|
|
37
|
+
} catch {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const NEXT_BIN = resolveNextBin()
|
|
29
43
|
const TERMINAL_SERVER_BIN = path.join(APP_ROOT, 'bin', 'terminal-server.js')
|
|
30
44
|
const BRIDGE_SERVER_BIN = path.join(APP_ROOT, 'bin', 'bridge-server.js')
|
|
31
45
|
|
|
@@ -236,10 +250,11 @@ async function waitForHttp(url, timeoutMs = 30000, validator) {
|
|
|
236
250
|
}
|
|
237
251
|
|
|
238
252
|
function ensureNextInstalled() {
|
|
239
|
-
if (!fs.existsSync(NEXT_BIN)) {
|
|
253
|
+
if (!NEXT_BIN || !fs.existsSync(NEXT_BIN)) {
|
|
240
254
|
console.error(
|
|
241
255
|
'pAInt runtime is missing Next.js binaries. Reinstall the package.',
|
|
242
256
|
)
|
|
257
|
+
console.error(`Resolved app root: ${APP_ROOT}`)
|
|
243
258
|
process.exit(1)
|
|
244
259
|
}
|
|
245
260
|
}
|
package/package.json
CHANGED