lvyjs 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/index.js +18 -9
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { fork } from 'child_process'
|
|
3
3
|
import { join, dirname, relative } from 'path'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
const args = [...process.argv.slice(2)]
|
|
@@ -11,13 +11,17 @@ if (args.includes('build')) {
|
|
|
11
11
|
const jsFile = join(currentDirPath, '../lib/index.js')
|
|
12
12
|
const jsdir = relative(process.cwd(), jsFile)
|
|
13
13
|
const argsx = args.filter(arg => arg !== 'build')
|
|
14
|
-
const msg =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const msg = fork(
|
|
15
|
+
join(currentDirPath, '../../tsx/dist/cli.mjs'),
|
|
16
|
+
[jsdir, '--lvy-build', ...argsx],
|
|
17
|
+
{
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
env: Object.assign({}, process.env, {
|
|
20
|
+
PKG_DIR: pkgFilr
|
|
21
|
+
}),
|
|
22
|
+
shell: process.platform === 'win32'
|
|
23
|
+
}
|
|
24
|
+
)
|
|
21
25
|
if (msg.error) {
|
|
22
26
|
console.error(msg.error)
|
|
23
27
|
process.exit()
|
|
@@ -26,7 +30,12 @@ if (args.includes('build')) {
|
|
|
26
30
|
const jsFile = join(currentDirPath, '../lib/index.js')
|
|
27
31
|
const jsdir = relative(process.cwd(), jsFile)
|
|
28
32
|
const argsx = args.filter(arg => arg !== 'dev')
|
|
29
|
-
const
|
|
33
|
+
const argv = [
|
|
34
|
+
...(args.includes('--no-watch') ? [] : ['watch', '--clear-screen=false']),
|
|
35
|
+
jsdir,
|
|
36
|
+
'--lvy-dev'
|
|
37
|
+
]
|
|
38
|
+
const msg = fork(join(currentDirPath, '../../tsx/dist/cli.mjs'), [...argv, ...argsx], {
|
|
30
39
|
stdio: 'inherit',
|
|
31
40
|
env: Object.assign({}, process.env, {
|
|
32
41
|
PKG_DIR: pkgFilr
|