@prmichaelsen/acp-visualizer 0.1.2 → 0.1.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/visualize.mjs +22 -1
- package/package.json +1 -1
package/bin/visualize.mjs
CHANGED
|
@@ -60,8 +60,29 @@ console.log(`\n ACP Progress Visualizer`)
|
|
|
60
60
|
console.log(` Loading: ${progressPath}`)
|
|
61
61
|
console.log(` Port: ${port}\n`)
|
|
62
62
|
|
|
63
|
+
// Resolve vite binary — check package's own node_modules first,
|
|
64
|
+
// then walk up (npx hoists deps to a shared node_modules)
|
|
65
|
+
function findViteBin() {
|
|
66
|
+
// Local development: package has its own node_modules
|
|
67
|
+
const local = resolve(packageRoot, 'node_modules', '.bin', 'vite')
|
|
68
|
+
if (existsSync(local)) return local
|
|
69
|
+
|
|
70
|
+
// npx: deps hoisted — walk up from package root to find node_modules/.bin
|
|
71
|
+
let dir = packageRoot
|
|
72
|
+
while (dir !== '/') {
|
|
73
|
+
const candidate = resolve(dir, 'node_modules', '.bin', 'vite')
|
|
74
|
+
if (existsSync(candidate)) return candidate
|
|
75
|
+
dir = resolve(dir, '..')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Fallback: hope it's on PATH
|
|
79
|
+
return 'vite'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const viteBin = findViteBin()
|
|
83
|
+
|
|
63
84
|
// Start vite dev server from the package directory
|
|
64
|
-
const child = spawn(
|
|
85
|
+
const child = spawn(viteBin, ['dev', '--port', port, '--host'], {
|
|
65
86
|
cwd: packageRoot,
|
|
66
87
|
stdio: 'inherit',
|
|
67
88
|
env: {
|