@axerity/cli 0.1.0 → 0.1.1
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/axerity.js +10 -2
- package/package.json +1 -1
package/bin/axerity.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
3
4
|
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import {
|
|
5
6
|
cpSync,
|
|
@@ -20,6 +21,14 @@ const isEngineRepo = userRoot === engineRoot;
|
|
|
20
21
|
|
|
21
22
|
const symlinkType = process.platform === 'win32' ? 'junction' : 'dir';
|
|
22
23
|
|
|
24
|
+
const require = createRequire(import.meta.url);
|
|
25
|
+
function viteBin() {
|
|
26
|
+
const pkgPath = require.resolve('vite/package.json');
|
|
27
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
28
|
+
const rel = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin.vite;
|
|
29
|
+
return resolve(dirname(pkgPath), rel);
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
// The engine runs in place, from its own install with its real node_modules. The
|
|
24
33
|
// user's project is mounted into a handful of gitignored paths for a single run,
|
|
25
34
|
// so nothing the engine tracks is ever touched — clean exit, Ctrl-C, or crash.
|
|
@@ -152,8 +161,7 @@ function streamBuild(child) {
|
|
|
152
161
|
}
|
|
153
162
|
|
|
154
163
|
function runEngine(sub, extra, { mounted, onSuccess }) {
|
|
155
|
-
const
|
|
156
|
-
const child = spawn(process.execPath, [viteEntry, sub, ...extra], {
|
|
164
|
+
const child = spawn(process.execPath, [viteBin(), sub, ...extra], {
|
|
157
165
|
cwd: engineRoot,
|
|
158
166
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
159
167
|
env: {
|