@deveco-test/deveco-code 0.1.0-TD.24 → 0.1.0-TD.24.test

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 +5 -5
  2. package/postinstall.mjs +35 -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.24",
9
+ "version": "0.1.0-TD.24.test",
10
10
  "license": "MIT",
11
11
  "os": [
12
12
  "darwin",
@@ -25,9 +25,9 @@
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
- "@deveco-test/deveco-code": "0.1.0-TD.24"
28
+ "@deveco-test/deveco-code-windows-x64": "0.1.0-TD.24.test",
29
+ "@deveco-test/deveco-code-darwin-x64": "0.1.0-TD.24.test",
30
+ "@deveco-test/deveco-code-darwin-arm64": "0.1.0-TD.24.test",
31
+ "@deveco-test/deveco-code": "0.1.0-TD.24.test"
32
32
  }
33
33
  }
package/postinstall.mjs CHANGED
@@ -150,6 +150,9 @@ function copyVendor(packageDir) {
150
150
  copyDir(vendorSrc, vendorDst)
151
151
  restoreDevecoCliDeps(path.join(vendorDst, "deveco-cli"))
152
152
  restoreDevecoCliDeps(path.join(packageDir, "vendor", "deveco-cli"))
153
+ // Windows packs often drop Unix +x; force it back on macOS/Linux install.
154
+ ensureVendorExecutables(vendorDst)
155
+ ensureVendorExecutables(path.join(packageDir, "vendor"))
153
156
  }
154
157
  }
155
158
 
@@ -168,6 +171,38 @@ function restoreDevecoCliDeps(cliDir) {
168
171
  fs.unlinkSync(tarPath)
169
172
  }
170
173
 
174
+ /** Restore execute bits lost when packages are built/published from Windows. */
175
+ function ensureVendorExecutables(vendorRoot) {
176
+ if (process.platform === "win32" || !fs.existsSync(vendorRoot)) return
177
+
178
+ const stack = [vendorRoot]
179
+ while (stack.length > 0) {
180
+ const dir = stack.pop()
181
+ let entries
182
+ try {
183
+ entries = fs.readdirSync(dir, { withFileTypes: true })
184
+ } catch {
185
+ continue
186
+ }
187
+ for (const entry of entries) {
188
+ const full = path.join(dir, entry.name)
189
+ if (entry.isDirectory()) {
190
+ stack.push(full)
191
+ continue
192
+ }
193
+ if (!entry.isFile()) continue
194
+ // Top-level vendor/ripgrep/rg and nested @vscode/ripgrep*/**/rg
195
+ if (entry.name === "rg") {
196
+ try {
197
+ fs.chmodSync(full, 0o755)
198
+ } catch {
199
+ // Best-effort; ignore files we cannot chmod.
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+
171
206
  function installPackage(name) {
172
207
  const version = packageJson.optionalDependencies?.[name]
173
208
  if (!version) return