@deveco-test/deveco-code 1.0.0 → 1.0.1
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 +8 -6
- package/postinstall.mjs +28 -2
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"os": [
|
|
12
12
|
"darwin",
|
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
"CHANGELOG.md"
|
|
27
27
|
],
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@deveco-test/deveco-
|
|
30
|
-
"@deveco-test/deveco-
|
|
31
|
-
"@deveco-test/deveco-darwin-
|
|
32
|
-
"@deveco-test/deveco-
|
|
33
|
-
|
|
29
|
+
"@deveco-test/deveco-windows-x64": "1.0.1",
|
|
30
|
+
"@deveco-test/deveco-darwin-x64": "1.0.1",
|
|
31
|
+
"@deveco-test/deveco-darwin-arm64": "1.0.1",
|
|
32
|
+
"@deveco-test/deveco-code-openharmony-arm64": "1.0.1"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@deveco/deveco-cli": "1.3.4"
|
|
34
36
|
}
|
|
35
37
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -156,14 +156,40 @@ function verifyBinary() {
|
|
|
156
156
|
)
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
// DevEco fork (v1 parity): the bundled devecocli shim resolves its CLI entry through an
|
|
160
|
+
// absolute marker written at install time; the @deveco/deveco-cli dependency provides it.
|
|
161
|
+
function writeDevecoCliEntryMarker() {
|
|
162
|
+
try {
|
|
163
|
+
const cliRoot = path.dirname(require.resolve("@deveco/deveco-cli/package.json"))
|
|
164
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(cliRoot, "package.json"), "utf8"))
|
|
165
|
+
const declared = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.devecocli
|
|
166
|
+
const candidates = [declared && path.join(cliRoot, declared), path.join(cliRoot, "dist", "cli.js")].filter(
|
|
167
|
+
(file) => file,
|
|
168
|
+
)
|
|
169
|
+
const entry = candidates.find((file) => fs.existsSync(file))
|
|
170
|
+
if (!entry) return
|
|
171
|
+
const vendorDir = path.join(directory, "vendor")
|
|
172
|
+
fs.mkdirSync(vendorDir, { recursive: true })
|
|
173
|
+
fs.writeFileSync(path.join(vendorDir, ".deveco-cli-entry"), `${path.resolve(entry)}\n`)
|
|
174
|
+
} catch {
|
|
175
|
+
// Best-effort: without the marker the shim falls back to the other resolution layouts.
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
159
179
|
function main() {
|
|
160
180
|
const names = packageNames()
|
|
161
181
|
for (const name of names) {
|
|
162
182
|
try {
|
|
163
183
|
copyBinary(resolveBinary(name))
|
|
164
|
-
if (verifyBinary())
|
|
184
|
+
if (verifyBinary()) {
|
|
185
|
+
writeDevecoCliEntryMarker()
|
|
186
|
+
return
|
|
187
|
+
}
|
|
165
188
|
} catch {
|
|
166
|
-
if (installPackage(name) && verifyBinary())
|
|
189
|
+
if (installPackage(name) && verifyBinary()) {
|
|
190
|
+
writeDevecoCliEntryMarker()
|
|
191
|
+
return
|
|
192
|
+
}
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
|