@wyxos/zephyr 0.2.21 → 0.2.22
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/README.md +144 -144
- package/bin/zephyr.mjs +29 -29
- package/package.json +58 -58
- package/src/config/project.mjs +118 -118
- package/src/config/servers.mjs +57 -57
- package/src/dependency-scanner.mjs +412 -433
- package/src/deploy/local-repo.mjs +215 -215
- package/src/deploy/locks.mjs +171 -171
- package/src/deploy/preflight.mjs +117 -117
- package/src/deploy/remote-exec.mjs +99 -99
- package/src/deploy/snapshots.mjs +35 -35
- package/src/index.mjs +91 -91
- package/src/main.mjs +677 -652
- package/src/project/bootstrap.mjs +147 -147
- package/src/runtime/local-command.mjs +18 -18
- package/src/runtime/prompt.mjs +14 -14
- package/src/runtime/ssh-client.mjs +14 -14
- package/src/ssh/index.mjs +8 -8
- package/src/ssh/keys.mjs +146 -146
- package/src/ssh/ssh.mjs +134 -134
- package/src/utils/command.mjs +92 -92
- package/src/utils/config-flow.mjs +284 -284
- package/src/utils/git.mjs +91 -91
- package/src/utils/id.mjs +6 -6
- package/src/utils/log-file.mjs +76 -76
- package/src/utils/output.mjs +29 -29
- package/src/utils/paths.mjs +28 -28
- package/src/utils/php-version.mjs +137 -0
- package/src/utils/remote-path.mjs +23 -23
- package/src/utils/task-planner.mjs +99 -96
- package/src/version-checker.mjs +162 -162
package/src/utils/command.mjs
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
|
|
4
|
-
const DEFAULT_IS_WINDOWS = process.platform === 'win32'
|
|
5
|
-
|
|
6
|
-
export function resolveCommandForPlatform(command, { isWindows = DEFAULT_IS_WINDOWS } = {}) {
|
|
7
|
-
if (!isWindows) {
|
|
8
|
-
return command
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// On Windows, these are typically shimmed as *.cmd on PATH
|
|
12
|
-
if (command === 'npm' || command === 'npx' || command === 'pnpm' || command === 'yarn') {
|
|
13
|
-
return `${command}.cmd`
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return command
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function isWindowsShellShim(command) {
|
|
20
|
-
return DEFAULT_IS_WINDOWS && typeof command === 'string' && /\.(cmd|bat)$/i.test(command)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function quoteForCmd(arg) {
|
|
24
|
-
const value = arg == null ? '' : String(arg)
|
|
25
|
-
if (value.length === 0) {
|
|
26
|
-
return '""'
|
|
27
|
-
}
|
|
28
|
-
if (/[ \t"]/g.test(value)) {
|
|
29
|
-
return `"${value.replace(/"/g, '\\"')}"`
|
|
30
|
-
}
|
|
31
|
-
return value
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function runCommand(command, args, { cwd = process.cwd(), stdio = 'inherit' } = {}) {
|
|
35
|
-
const resolvedCommand = resolveCommandForPlatform(command)
|
|
36
|
-
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const child = isWindowsShellShim(resolvedCommand)
|
|
39
|
-
? spawn([resolvedCommand, ...(args ?? []).map(quoteForCmd)].join(' '), { cwd, stdio, shell: true })
|
|
40
|
-
: spawn(resolvedCommand, args, { cwd, stdio })
|
|
41
|
-
|
|
42
|
-
child.on('error', reject)
|
|
43
|
-
child.on('close', (code) => {
|
|
44
|
-
if (code === 0) {
|
|
45
|
-
resolve()
|
|
46
|
-
} else {
|
|
47
|
-
const error = new Error(`${resolvedCommand} exited with code ${code}`)
|
|
48
|
-
error.exitCode = code
|
|
49
|
-
reject(error)
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export async function runCommandCapture(command, args, { cwd = process.cwd() } = {}) {
|
|
56
|
-
const resolvedCommand = resolveCommandForPlatform(command)
|
|
57
|
-
|
|
58
|
-
return new Promise((resolve, reject) => {
|
|
59
|
-
let stdout = ''
|
|
60
|
-
let stderr = ''
|
|
61
|
-
|
|
62
|
-
const child = isWindowsShellShim(resolvedCommand)
|
|
63
|
-
? spawn([resolvedCommand, ...(args ?? []).map(quoteForCmd)].join(' '), {
|
|
64
|
-
cwd,
|
|
65
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
66
|
-
shell: true
|
|
67
|
-
})
|
|
68
|
-
: spawn(resolvedCommand, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
69
|
-
|
|
70
|
-
child.stdout.on('data', (chunk) => {
|
|
71
|
-
stdout += chunk
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
child.stderr.on('data', (chunk) => {
|
|
75
|
-
stderr += chunk
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
child.on('error', reject)
|
|
79
|
-
child.on('close', (code) => {
|
|
80
|
-
if (code === 0) {
|
|
81
|
-
resolve({ stdout, stderr })
|
|
82
|
-
} else {
|
|
83
|
-
const error = new Error(`${resolvedCommand} exited with code ${code}: ${stderr.trim()}`)
|
|
84
|
-
error.exitCode = code
|
|
85
|
-
error.stdout = stdout
|
|
86
|
-
error.stderr = stderr
|
|
87
|
-
reject(error)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
|
|
4
|
+
const DEFAULT_IS_WINDOWS = process.platform === 'win32'
|
|
5
|
+
|
|
6
|
+
export function resolveCommandForPlatform(command, { isWindows = DEFAULT_IS_WINDOWS } = {}) {
|
|
7
|
+
if (!isWindows) {
|
|
8
|
+
return command
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// On Windows, these are typically shimmed as *.cmd on PATH
|
|
12
|
+
if (command === 'npm' || command === 'npx' || command === 'pnpm' || command === 'yarn') {
|
|
13
|
+
return `${command}.cmd`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return command
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isWindowsShellShim(command) {
|
|
20
|
+
return DEFAULT_IS_WINDOWS && typeof command === 'string' && /\.(cmd|bat)$/i.test(command)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function quoteForCmd(arg) {
|
|
24
|
+
const value = arg == null ? '' : String(arg)
|
|
25
|
+
if (value.length === 0) {
|
|
26
|
+
return '""'
|
|
27
|
+
}
|
|
28
|
+
if (/[ \t"]/g.test(value)) {
|
|
29
|
+
return `"${value.replace(/"/g, '\\"')}"`
|
|
30
|
+
}
|
|
31
|
+
return value
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function runCommand(command, args, { cwd = process.cwd(), stdio = 'inherit' } = {}) {
|
|
35
|
+
const resolvedCommand = resolveCommandForPlatform(command)
|
|
36
|
+
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const child = isWindowsShellShim(resolvedCommand)
|
|
39
|
+
? spawn([resolvedCommand, ...(args ?? []).map(quoteForCmd)].join(' '), { cwd, stdio, shell: true })
|
|
40
|
+
: spawn(resolvedCommand, args, { cwd, stdio })
|
|
41
|
+
|
|
42
|
+
child.on('error', reject)
|
|
43
|
+
child.on('close', (code) => {
|
|
44
|
+
if (code === 0) {
|
|
45
|
+
resolve()
|
|
46
|
+
} else {
|
|
47
|
+
const error = new Error(`${resolvedCommand} exited with code ${code}`)
|
|
48
|
+
error.exitCode = code
|
|
49
|
+
reject(error)
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function runCommandCapture(command, args, { cwd = process.cwd() } = {}) {
|
|
56
|
+
const resolvedCommand = resolveCommandForPlatform(command)
|
|
57
|
+
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
let stdout = ''
|
|
60
|
+
let stderr = ''
|
|
61
|
+
|
|
62
|
+
const child = isWindowsShellShim(resolvedCommand)
|
|
63
|
+
? spawn([resolvedCommand, ...(args ?? []).map(quoteForCmd)].join(' '), {
|
|
64
|
+
cwd,
|
|
65
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
66
|
+
shell: true
|
|
67
|
+
})
|
|
68
|
+
: spawn(resolvedCommand, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
69
|
+
|
|
70
|
+
child.stdout.on('data', (chunk) => {
|
|
71
|
+
stdout += chunk
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
child.stderr.on('data', (chunk) => {
|
|
75
|
+
stderr += chunk
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
child.on('error', reject)
|
|
79
|
+
child.on('close', (code) => {
|
|
80
|
+
if (code === 0) {
|
|
81
|
+
resolve({ stdout, stderr })
|
|
82
|
+
} else {
|
|
83
|
+
const error = new Error(`${resolvedCommand} exited with code ${code}: ${stderr.trim()}`)
|
|
84
|
+
error.exitCode = code
|
|
85
|
+
error.stdout = stdout
|
|
86
|
+
error.stderr = stderr
|
|
87
|
+
reject(error)
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|