History

fix bun global executor installs

Rhys Sullivan committed 7 months agov1.4.0-beta.2

Commit efc1e6b1 parent 1bdf9904 files · +36 −5Browse files

Unified · Split

4 files
  1. .changeset/pre.json +1 −0
  2. apps/cli/package.json +1 −1
  3. apps/cli/src/build.ts +32 −3
  4. bun.lock +2 −1
.changeset/pre.json+1−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
26 "@executor/ui": "1.4.0-beta.0"26 "@executor/ui": "1.4.0-beta.0"
27 },27 },
28 "changesets": [28 "changesets": [
29 "funny-buses-count",
29 "ripe-yaks-sniff"30 "ripe-yaks-sniff"
30 ]31 ]
31}32}
apps/cli/package.json+1−1
@@ -1,6 +1,6 @@
1{1{
2 "name": "executor",2 "name": "executor",
3 "version": "1.4.0-beta.1",3 "version": "1.4.0-beta.2",
4 "private": true,4 "private": true,
5 "type": "module",5 "type": "module",
6 "bin": {6 "bin": {
apps/cli/src/build.ts+32−3
@@ -203,7 +203,7 @@ const buildWrapperPackage = async (binaries: Record<string, string>) => { · 202 unmodified lines
203 await chmod(join(binDir, "executor"), 0o755);203 await chmod(join(binDir, "executor"), 0o755);
204 204
205 // Postinstall downloads the matching release asset from GitHub Releases205 // Postinstall downloads the matching release asset from GitHub Releases
206 await writeFile(join(wrapperDir, "postinstall.mjs"), POSTINSTALL_SCRIPT);206 await writeFile(join(wrapperDir, "postinstall.cjs"), POSTINSTALL_SCRIPT);
207 207
208 // Package.json208 // Package.json
209 await writeFile(209 await writeFile(
@@ -220,7 +220,7 @@ const buildWrapperPackage = async (binaries: Record<string, string>) => { · 10 unmodified lines
220 license: meta.license,220 license: meta.license,
221 bin: { executor: "bin/executor" },221 bin: { executor: "bin/executor" },
222 scripts: {222 scripts: {
223 postinstall: "node ./postinstall.mjs",223 postinstall: "node ./postinstall.cjs",
224 },224 },
225 engines: {225 engines: {
226 node: ">=20",226 node: ">=20",
@@ -339,7 +339,36 @@ if (process.env.EXECUTOR_BIN_PATH) run(process.env.EXECUTOR_BIN_PATH); · 112 unmodified lines
339 339
340const scriptDir = path.dirname(fs.realpathSync(__filename));340const scriptDir = path.dirname(fs.realpathSync(__filename));
341const cached = path.join(scriptDir, process.platform === "win32" ? ".executor.exe" : ".executor");341const cached = path.join(scriptDir, process.platform === "win32" ? ".executor.exe" : ".executor");
342if (!fs.existsSync(cached)) {342
343const installIfNeeded = () => {
344 if (fs.existsSync(cached)) {
345 return true;
346 }
347
348 const installer = path.resolve(scriptDir, "..", "postinstall.cjs");
349 if (!fs.existsSync(installer)) {
350 return false;
351 }
352
353 console.error("executor binary is missing; downloading release asset...");
354 const result = childProcess.spawnSync(process.execPath, [installer], {
355 stdio: "inherit",
356 env: process.env,
357 });
358
359 if (result.error) {
360 console.error(result.error.message);
361 process.exit(1);
362 }
363
364 if (typeof result.status === "number" && result.status !== 0) {
365 process.exit(result.status);
366 }
367
368 return fs.existsSync(cached);
369};
370
371if (!installIfNeeded()) {
343 console.error("executor binary is missing. Reinstall the package or run 'npm rebuild executor'.");372 console.error("executor binary is missing. Reinstall the package or run 'npm rebuild executor'.");
344 process.exit(1);373 process.exit(1);
345}374}
bun.lock+2−1
@@ -1,5 +1,6 @@
1{1{
2 "lockfileVersion": 1,2 "lockfileVersion": 1,
3 "configVersion": 0,
3 "workspaces": {4 "workspaces": {
4 "": {5 "": {
5 "name": "v4-executor",6 "name": "v4-executor",
@@ -17,7 +18,7 @@ · 11 unmodified lines
17 },18 },
18 "apps/cli": {19 "apps/cli": {
19 "name": "executor",20 "name": "executor",
20 "version": "1.4.0-beta.1",21 "version": "1.4.0-beta.2",
21 "bin": {22 "bin": {
22 "executor": "./bin/executor.ts",23 "executor": "./bin/executor.ts",
23 },24 },