@deveco/deveco-code 0.1.7 → 0.1.8-rc.0
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 +0 -1
- package/package.json +8 -5
- package/postinstall.mjs +54 -0
package/README.md
CHANGED
|
@@ -241,7 +241,6 @@ DevEco Code 集成了常用 HarmonyOS 开发工具能力:
|
|
|
241
241
|
| `hdc_log` | 收集/清理设备日志/查看连接模拟器 |
|
|
242
242
|
| `verify_ui` | 执行 UI 操作验证功能是否正确 |
|
|
243
243
|
| `arkts_check` | ArkTS 静态语法检查 |
|
|
244
|
-
| `arkts_knowledge_search` | HarmonyOS 知识搜索 |
|
|
245
244
|
| `switch_cwd` | 切换构建项目路径 |
|
|
246
245
|
|
|
247
246
|
常见场景包括:从零到一创建 HarmonyOS 工程、增量开发页面、修复编译报错、真机调试。
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.8-rc.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/**/*",
|
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
"CHANGELOG.md"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"@deveco/deveco-code-darwin-
|
|
20
|
-
"@deveco/deveco-code-darwin-
|
|
21
|
-
"@deveco/deveco-code-windows-x64
|
|
22
|
-
"@deveco/deveco-code-windows-x64": "0.1.
|
|
19
|
+
"@deveco/deveco-code-darwin-arm64": "0.1.8-rc.0",
|
|
20
|
+
"@deveco/deveco-code-darwin-x64": "0.1.8-rc.0",
|
|
21
|
+
"@deveco/deveco-code-windows-x64": "0.1.8-rc.0",
|
|
22
|
+
"@deveco/deveco-code-windows-x64-baseline": "0.1.8-rc.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@deveco/deveco-cli": "1.2.2"
|
|
23
26
|
}
|
|
24
27
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -28,6 +28,20 @@ const scope = packageJson.name && packageJson.name.includes("/") ? packageJson.n
|
|
|
28
28
|
const base = `${scope}/deveco-code-${platform}-${arch}`
|
|
29
29
|
const sourceBinary = platform === "windows" ? "deveco.exe" : "deveco"
|
|
30
30
|
const targetBinary = path.join(__dirname, "bin", "deveco.exe")
|
|
31
|
+
const devecoCliEntryMarker = path.join(__dirname, "vendor", ".deveco-cli-entry")
|
|
32
|
+
const devecoCliPackageName = "@deveco/deveco-cli"
|
|
33
|
+
|
|
34
|
+
function resolveLocalDevecoCliEntry() {
|
|
35
|
+
const packageJsonPath = require.resolve(`${devecoCliPackageName}/package.json`)
|
|
36
|
+
const entry = path.join(path.dirname(packageJsonPath), "dist", "cli.js")
|
|
37
|
+
if (fs.existsSync(entry)) return entry
|
|
38
|
+
throw new Error(`Local dependency "${devecoCliPackageName}" has no CLI entry at ${entry}.`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function writeDevecoCliEntryMarker() {
|
|
42
|
+
fs.mkdirSync(path.dirname(devecoCliEntryMarker), { recursive: true })
|
|
43
|
+
fs.writeFileSync(devecoCliEntryMarker, `${resolveLocalDevecoCliEntry()}\n`, "utf8")
|
|
44
|
+
}
|
|
31
45
|
|
|
32
46
|
function supportsAvx2() {
|
|
33
47
|
if (arch !== "x64") return false
|
|
@@ -137,6 +151,9 @@ function copyDir(src, dst) {
|
|
|
137
151
|
copyDir(srcPath, dstPath)
|
|
138
152
|
} else {
|
|
139
153
|
fs.copyFileSync(srcPath, dstPath)
|
|
154
|
+
if (process.platform !== "win32") {
|
|
155
|
+
fs.chmodSync(dstPath, fs.statSync(srcPath).mode)
|
|
156
|
+
}
|
|
140
157
|
}
|
|
141
158
|
}
|
|
142
159
|
}
|
|
@@ -146,6 +163,41 @@ function copyVendor(packageDir) {
|
|
|
146
163
|
const vendorDst = path.join(__dirname, "vendor")
|
|
147
164
|
if (fs.existsSync(vendorSrc)) {
|
|
148
165
|
copyDir(vendorSrc, vendorDst)
|
|
166
|
+
// Windows packs often drop Unix +x; force it back on macOS/Linux install.
|
|
167
|
+
ensureVendorExecutables(vendorDst)
|
|
168
|
+
ensureVendorExecutables(path.join(packageDir, "vendor"))
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Restore execute bits lost when packages are built/published from Windows. */
|
|
173
|
+
function ensureVendorExecutables(vendorRoot) {
|
|
174
|
+
if (process.platform === "win32" || !fs.existsSync(vendorRoot)) return
|
|
175
|
+
|
|
176
|
+
const stack = [vendorRoot]
|
|
177
|
+
while (stack.length > 0) {
|
|
178
|
+
const dir = stack.pop()
|
|
179
|
+
let entries
|
|
180
|
+
try {
|
|
181
|
+
entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
182
|
+
} catch {
|
|
183
|
+
continue
|
|
184
|
+
}
|
|
185
|
+
for (const entry of entries) {
|
|
186
|
+
const full = path.join(dir, entry.name)
|
|
187
|
+
if (entry.isDirectory()) {
|
|
188
|
+
stack.push(full)
|
|
189
|
+
continue
|
|
190
|
+
}
|
|
191
|
+
if (!entry.isFile()) continue
|
|
192
|
+
// Top-level vendor/ripgrep/rg and nested @vscode/ripgrep*/**/rg
|
|
193
|
+
if (entry.name === "rg") {
|
|
194
|
+
try {
|
|
195
|
+
fs.chmodSync(full, 0o755)
|
|
196
|
+
} catch {
|
|
197
|
+
// Best-effort; ignore files we cannot chmod.
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
149
201
|
}
|
|
150
202
|
}
|
|
151
203
|
|
|
@@ -192,6 +244,8 @@ function verifyBinary() {
|
|
|
192
244
|
}
|
|
193
245
|
|
|
194
246
|
function main() {
|
|
247
|
+
writeDevecoCliEntryMarker()
|
|
248
|
+
|
|
195
249
|
for (const name of packageNames()) {
|
|
196
250
|
try {
|
|
197
251
|
copyBinary(resolveBinary(name), targetBinary)
|