@deveco-test/deveco-code 0.1.0-TD.43.1 → 0.1.0-TD.52
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 -6
- package/postinstall.mjs +24 -0
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.0-TD.
|
|
9
|
+
"version": "0.1.0-TD.52",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/**/*",
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
"CHANGELOG.md"
|
|
17
17
|
],
|
|
18
18
|
"optionalDependencies": {
|
|
19
|
-
"@deveco-test/deveco-code-
|
|
20
|
-
"@deveco-test/deveco-code-windows-x64-baseline": "0.1.0-TD.
|
|
21
|
-
"@deveco-test/deveco-code-darwin-
|
|
22
|
-
"@deveco-test/deveco-code-
|
|
19
|
+
"@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.52",
|
|
20
|
+
"@deveco-test/deveco-code-windows-x64-baseline": "0.1.0-TD.52",
|
|
21
|
+
"@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.52",
|
|
22
|
+
"@deveco-test/deveco-code-windows-x64": "0.1.0-TD.52"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@deveco/deveco-cli": "1.3.4"
|
|
25
|
+
"@deveco/deveco-cli": "1.3.4",
|
|
26
|
+
"homegraph": "latest"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -29,6 +29,8 @@ 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
31
|
const devecoCliPackageName = "@deveco/deveco-cli"
|
|
32
|
+
const homegraphPackageName = "homegraph"
|
|
33
|
+
const HOMEGRAPH_ENTRY_REL = path.join("dist", "bin", "homegraph.js")
|
|
32
34
|
|
|
33
35
|
function resolveLocalDevecoCliEntry() {
|
|
34
36
|
const packageJsonPath = require.resolve(`${devecoCliPackageName}/package.json`)
|
|
@@ -45,6 +47,23 @@ function writeDevecoCliEntryMarker(installRoot) {
|
|
|
45
47
|
fs.writeFileSync(marker, `${resolveLocalDevecoCliEntry()}\n`, "utf8")
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
function resolveLocalHomegraphEntry() {
|
|
51
|
+
const packageJsonPath = require.resolve(`${homegraphPackageName}/package.json`)
|
|
52
|
+
const entry = path.join(path.dirname(packageJsonPath), HOMEGRAPH_ENTRY_REL)
|
|
53
|
+
if (fs.existsSync(entry)) return entry
|
|
54
|
+
throw new Error(`Local dependency "${homegraphPackageName}" has no entry at ${entry}.`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function writeHomegraphEntryMarker(installRoot) {
|
|
58
|
+
try {
|
|
59
|
+
const marker = path.join(installRoot, "vendor", ".homegraph-entry")
|
|
60
|
+
fs.mkdirSync(path.dirname(marker), { recursive: true })
|
|
61
|
+
fs.writeFileSync(marker, `${resolveLocalHomegraphEntry()}\n`, "utf8")
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.warn(`[homegraph] postinstall: ${error instanceof Error ? error.message : String(error)}`)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
48
67
|
function supportsAvx2() {
|
|
49
68
|
if (arch !== "x64") return false
|
|
50
69
|
|
|
@@ -218,6 +237,9 @@ function installPackage(name) {
|
|
|
218
237
|
const packageDir = path.join(temp, "node_modules", name)
|
|
219
238
|
copyBinary(path.join(packageDir, "bin", sourceBinary), targetBinary)
|
|
220
239
|
copyVendor(packageDir)
|
|
240
|
+
writeDevecoCliEntryMarker(packageDir)
|
|
241
|
+
writeHomegraphEntryMarker(packageDir)
|
|
242
|
+
writeHomegraphEntryMarker(__dirname)
|
|
221
243
|
return true
|
|
222
244
|
} finally {
|
|
223
245
|
fs.rmSync(temp, { recursive: true, force: true })
|
|
@@ -247,6 +269,7 @@ function verifyBinary() {
|
|
|
247
269
|
|
|
248
270
|
function main() {
|
|
249
271
|
writeDevecoCliEntryMarker(__dirname)
|
|
272
|
+
writeHomegraphEntryMarker(__dirname)
|
|
250
273
|
|
|
251
274
|
for (const name of packageNames()) {
|
|
252
275
|
try {
|
|
@@ -254,6 +277,7 @@ function main() {
|
|
|
254
277
|
copyBinary(resolveBinary(name), targetBinary)
|
|
255
278
|
copyVendor(packageDir)
|
|
256
279
|
writeDevecoCliEntryMarker(packageDir)
|
|
280
|
+
writeHomegraphEntryMarker(packageDir)
|
|
257
281
|
if (verifyBinary()) return
|
|
258
282
|
} catch {
|
|
259
283
|
if (installPackage(name) && verifyBinary()) return
|