@deveco-test/deveco-code 0.1.0-TD.24 → 0.1.0-TD.24.test2
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/package.json +7 -5
- package/postinstall.mjs +54 -14
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.1.0-TD.24",
|
|
9
|
+
"version": "0.1.0-TD.24.test2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"os": [
|
|
12
12
|
"darwin",
|
|
@@ -25,9 +25,11 @@
|
|
|
25
25
|
"assets/**/*"
|
|
26
26
|
],
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"@deveco-test/deveco-code-windows-x64": "0.1.0-TD.24",
|
|
29
|
-
"@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.24",
|
|
30
|
-
"@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.24"
|
|
31
|
-
|
|
28
|
+
"@deveco-test/deveco-code-windows-x64": "0.1.0-TD.24.test2",
|
|
29
|
+
"@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.24.test2",
|
|
30
|
+
"@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.24.test2"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@deveco/deveco-cli": "1.2.1"
|
|
32
34
|
}
|
|
33
35
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -27,6 +27,26 @@ const arch = archMap[os.arch()] ?? os.arch()
|
|
|
27
27
|
const base = `@deveco-test/deveco-code-${platform}-${arch}`
|
|
28
28
|
const sourceBinary = platform === "windows" ? "deveco.exe" : "deveco"
|
|
29
29
|
const targetBinary = path.join(__dirname, "bin", "deveco.exe")
|
|
30
|
+
const devecoCliEntryMarker = path.join(__dirname, "vendor", ".deveco-cli-entry")
|
|
31
|
+
|
|
32
|
+
function resolveLocalDevecoCliEntry() {
|
|
33
|
+
const roots = [
|
|
34
|
+
path.join(__dirname, "node_modules", "@deveco", "deveco-cli"),
|
|
35
|
+
path.join(__dirname, "..", "deveco-cli"),
|
|
36
|
+
]
|
|
37
|
+
for (const root of roots) {
|
|
38
|
+
const entry = path.join(root, "dist", "cli.js")
|
|
39
|
+
if (fs.existsSync(entry)) return entry
|
|
40
|
+
}
|
|
41
|
+
throw new Error(
|
|
42
|
+
'Local dependency "@deveco/deveco-cli" was not installed. Reinstall @deveco/deveco-code without omitting dependencies.',
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function writeDevecoCliEntryMarker() {
|
|
47
|
+
fs.mkdirSync(path.dirname(devecoCliEntryMarker), { recursive: true })
|
|
48
|
+
fs.writeFileSync(devecoCliEntryMarker, `${resolveLocalDevecoCliEntry()}\n`, "utf8")
|
|
49
|
+
}
|
|
30
50
|
|
|
31
51
|
function supportsAvx2() {
|
|
32
52
|
if (arch !== "x64") return false
|
|
@@ -148,24 +168,42 @@ function copyVendor(packageDir) {
|
|
|
148
168
|
const vendorDst = path.join(__dirname, "vendor")
|
|
149
169
|
if (fs.existsSync(vendorSrc)) {
|
|
150
170
|
copyDir(vendorSrc, vendorDst)
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
// Windows packs often drop Unix +x; force it back on macOS/Linux install.
|
|
172
|
+
ensureVendorExecutables(vendorDst)
|
|
173
|
+
ensureVendorExecutables(path.join(packageDir, "vendor"))
|
|
153
174
|
}
|
|
154
175
|
}
|
|
155
176
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (!fs.existsSync(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
/** Restore execute bits lost when packages are built/published from Windows. */
|
|
178
|
+
function ensureVendorExecutables(vendorRoot) {
|
|
179
|
+
if (process.platform === "win32" || !fs.existsSync(vendorRoot)) return
|
|
180
|
+
|
|
181
|
+
const stack = [vendorRoot]
|
|
182
|
+
while (stack.length > 0) {
|
|
183
|
+
const dir = stack.pop()
|
|
184
|
+
let entries
|
|
185
|
+
try {
|
|
186
|
+
entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
187
|
+
} catch {
|
|
188
|
+
continue
|
|
189
|
+
}
|
|
190
|
+
for (const entry of entries) {
|
|
191
|
+
const full = path.join(dir, entry.name)
|
|
192
|
+
if (entry.isDirectory()) {
|
|
193
|
+
stack.push(full)
|
|
194
|
+
continue
|
|
195
|
+
}
|
|
196
|
+
if (!entry.isFile()) continue
|
|
197
|
+
// Top-level vendor/ripgrep/rg and nested @vscode/ripgrep*/**/rg
|
|
198
|
+
if (entry.name === "rg") {
|
|
199
|
+
try {
|
|
200
|
+
fs.chmodSync(full, 0o755)
|
|
201
|
+
} catch {
|
|
202
|
+
// Best-effort; ignore files we cannot chmod.
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
167
206
|
}
|
|
168
|
-
fs.unlinkSync(tarPath)
|
|
169
207
|
}
|
|
170
208
|
|
|
171
209
|
function installPackage(name) {
|
|
@@ -211,6 +249,8 @@ function verifyBinary() {
|
|
|
211
249
|
}
|
|
212
250
|
|
|
213
251
|
function main() {
|
|
252
|
+
writeDevecoCliEntryMarker()
|
|
253
|
+
|
|
214
254
|
for (const name of packageNames()) {
|
|
215
255
|
try {
|
|
216
256
|
copyBinary(resolveBinary(name), targetBinary)
|