@apexacc/cli 1.2.4 → 1.2.5
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/apex +22 -20
- package/package.json +1 -1
package/bin/apex
CHANGED
|
@@ -66,6 +66,27 @@ async function verifySha256(filePath, hashUrl) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
async function ensureVerify() {
|
|
70
|
+
// Windows: download apex-verify
|
|
71
|
+
if (isWin) {
|
|
72
|
+
const verifyPath = join(os.homedir(), '.apex', 'apex-verify.exe')
|
|
73
|
+
const verifyVersionPath = join(os.homedir(), '.apex', '.verify-version')
|
|
74
|
+
let needsUpdate = !existsSync(verifyPath)
|
|
75
|
+
if (!needsUpdate) {
|
|
76
|
+
try {
|
|
77
|
+
const savedVersion = require('fs').readFileSync(verifyVersionPath, 'utf8').trim()
|
|
78
|
+
if (savedVersion !== VERSION) needsUpdate = true
|
|
79
|
+
} catch { needsUpdate = true }
|
|
80
|
+
}
|
|
81
|
+
if (needsUpdate) {
|
|
82
|
+
mkdirSync(join(os.homedir(), '.apex'), { recursive: true })
|
|
83
|
+
await download(`https://github.com/${REPO}/releases/download/v${VERSION}/apex-verify-windows.exe`, verifyPath)
|
|
84
|
+
await verifySha256(verifyPath, `https://github.com/${REPO}/releases/download/v${VERSION}/apex-verify-windows.exe.sha256`)
|
|
85
|
+
require('fs').writeFileSync(verifyVersionPath, VERSION)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
69
90
|
async function ensureBinary() {
|
|
70
91
|
if (existsSync(BIN_PATH)) return
|
|
71
92
|
console.log('Downloading Apex Copilot (~150MB), please wait...')
|
|
@@ -90,25 +111,6 @@ async function ensureBinary() {
|
|
|
90
111
|
}
|
|
91
112
|
}
|
|
92
113
|
|
|
93
|
-
// Windows: download apex-verify
|
|
94
|
-
if (isWin) {
|
|
95
|
-
const verifyPath = join(os.homedir(), '.apex', 'apex-verify.exe')
|
|
96
|
-
const verifyVersionPath = join(os.homedir(), '.apex', '.verify-version')
|
|
97
|
-
let needsUpdate = !existsSync(verifyPath)
|
|
98
|
-
if (!needsUpdate) {
|
|
99
|
-
try {
|
|
100
|
-
const savedVersion = require('fs').readFileSync(verifyVersionPath, 'utf8').trim()
|
|
101
|
-
if (savedVersion !== VERSION) needsUpdate = true
|
|
102
|
-
} catch { needsUpdate = true }
|
|
103
|
-
}
|
|
104
|
-
if (needsUpdate) {
|
|
105
|
-
mkdirSync(join(os.homedir(), '.apex'), { recursive: true })
|
|
106
|
-
await download(`https://github.com/${REPO}/releases/download/v${VERSION}/apex-verify-windows.exe`, verifyPath)
|
|
107
|
-
await verifySha256(verifyPath, `https://github.com/${REPO}/releases/download/v${VERSION}/apex-verify-windows.exe.sha256`)
|
|
108
|
-
require('fs').writeFileSync(verifyVersionPath, VERSION)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
114
|
// Mac: download apex-verify
|
|
113
115
|
if (process.platform === 'darwin') {
|
|
114
116
|
const verifyPath = join(os.homedir(), '.apex', 'apex-verify')
|
|
@@ -132,7 +134,7 @@ async function ensureBinary() {
|
|
|
132
134
|
console.log('Done!')
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
ensureBinary().then(() => {
|
|
137
|
+
ensureVerify().then(() => ensureBinary()).then(() => {
|
|
136
138
|
const result = spawnSync(BIN_PATH, process.argv.slice(2), {
|
|
137
139
|
stdio: 'inherit', env: process.env
|
|
138
140
|
})
|