@deveco-test/deveco-code 0.1.0-TD.22 → 0.1.0-TD.23.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.
Files changed (2) hide show
  1. package/package.json +4 -5
  2. package/postinstall.mjs +16 -0
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.22",
9
+ "version": "0.1.0-TD.23.5",
10
10
  "license": "MIT",
11
11
  "os": [
12
12
  "darwin",
@@ -25,9 +25,8 @@
25
25
  "assets/**/*"
26
26
  ],
27
27
  "optionalDependencies": {
28
- "@deveco-test/deveco-code-windows-x64": "0.1.0-TD.22",
29
- "@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.22",
30
- "@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.22",
31
- "@deveco-test/deveco-code": "0.1.0-TD.22"
28
+ "@deveco-test/deveco-code-windows-x64": "0.1.0-TD.23.5",
29
+ "@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.23.5",
30
+ "@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.23.5"
32
31
  }
33
32
  }
package/postinstall.mjs CHANGED
@@ -145,9 +145,25 @@ function copyVendor(packageDir) {
145
145
  const vendorDst = path.join(__dirname, "vendor")
146
146
  if (fs.existsSync(vendorSrc)) {
147
147
  copyDir(vendorSrc, vendorDst)
148
+ restoreDevecoCliDeps(path.join(vendorDst, "deveco-cli"))
148
149
  }
149
150
  }
150
151
 
152
+ function restoreDevecoCliDeps(cliDir) {
153
+ const tarPath = path.join(cliDir, "deps.tar.gz")
154
+ if (!fs.existsSync(tarPath)) return
155
+ const result = childProcess.spawnSync("tar", ["-xzf", tarPath, "-C", cliDir], {
156
+ stdio: "inherit",
157
+ windowsHide: true,
158
+ shell: true,
159
+ })
160
+ if (result.status !== 0) {
161
+ console.warn("Warning: failed to restore deveco-cli dependencies")
162
+ return
163
+ }
164
+ fs.unlinkSync(tarPath)
165
+ }
166
+
151
167
  function installPackage(name) {
152
168
  const version = packageJson.optionalDependencies?.[name]
153
169
  if (!version) return