bx-mac 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/dist/bx.js +16 -16
- package/package.json +1 -1
package/dist/bx.js
CHANGED
|
@@ -3,8 +3,8 @@ import { accessSync, constants, cpSync, existsSync, globSync, mkdirSync, mkdtemp
|
|
|
3
3
|
import { basename, dirname, join, resolve } from "node:path";
|
|
4
4
|
import { execFileSync, spawn } from "node:child_process";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
6
|
import process$1 from "node:process";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
8
|
//#region node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/error.js
|
|
9
9
|
/*!
|
|
10
10
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -1219,17 +1219,22 @@ async function checkAppAlreadyRunning(mode, apps) {
|
|
|
1219
1219
|
if (BUILTIN_MODES.includes(mode)) return;
|
|
1220
1220
|
const app = apps[mode];
|
|
1221
1221
|
if (!app?.bundle) return;
|
|
1222
|
-
let
|
|
1222
|
+
let appName = mode;
|
|
1223
1223
|
try {
|
|
1224
|
-
|
|
1224
|
+
const list = execFileSync("lsappinfo", ["list"], {
|
|
1225
1225
|
encoding: "utf-8",
|
|
1226
1226
|
timeout: 3e3
|
|
1227
|
-
})
|
|
1227
|
+
});
|
|
1228
|
+
if (!list.includes(`bundleID="${app.bundle}"`)) return;
|
|
1229
|
+
const idx = list.indexOf(`bundleID="${app.bundle}"`);
|
|
1230
|
+
const bundleLine = list.lastIndexOf("\n", idx);
|
|
1231
|
+
const prevLine = list.lastIndexOf("\n", bundleLine - 1);
|
|
1232
|
+
const nameMatch = list.slice(prevLine === -1 ? 0 : prevLine, bundleLine).match(/"([^"]+)"/);
|
|
1233
|
+
if (nameMatch) appName = nameMatch[1];
|
|
1228
1234
|
} catch {
|
|
1229
1235
|
return;
|
|
1230
1236
|
}
|
|
1231
|
-
|
|
1232
|
-
console.error(`\n${fmt.warn(`"${mode}" is already running`)}`);
|
|
1237
|
+
console.error(`\n${fmt.warn(`"${appName}" is already running`)}`);
|
|
1233
1238
|
console.error(fmt.detail("the workspace will open in the EXISTING instance — sandbox will NOT apply"));
|
|
1234
1239
|
if (mode === "code") console.error(fmt.detail("quit the app first, or use --profile-sandbox for an isolated instance"));
|
|
1235
1240
|
else console.error(fmt.detail("quit the app first to ensure sandbox protection"));
|
|
@@ -1238,7 +1243,7 @@ async function checkAppAlreadyRunning(mode, apps) {
|
|
|
1238
1243
|
output: process$1.stderr
|
|
1239
1244
|
});
|
|
1240
1245
|
const answer = await new Promise((res) => {
|
|
1241
|
-
rl.question(` continue
|
|
1246
|
+
rl.question(` continue with existing instance? [y/N]`, res);
|
|
1242
1247
|
});
|
|
1243
1248
|
rl.close();
|
|
1244
1249
|
if (!answer.match(/^y(es)?$/i)) process$1.exit(0);
|
|
@@ -1573,12 +1578,9 @@ function printDryRunTree({ home, blockedDirs, ignoredPaths, readOnlyDirs, workDi
|
|
|
1573
1578
|
console.log(`\n${RED}✖${RESET} = denied ${YELLOW}◉${RESET} = read-only ${GREEN}✔${RESET} = read-write\n`);
|
|
1574
1579
|
}
|
|
1575
1580
|
//#endregion
|
|
1576
|
-
//#region package.json
|
|
1577
|
-
var version = "1.0.0";
|
|
1578
|
-
//#endregion
|
|
1579
1581
|
//#region src/index.ts
|
|
1582
|
+
const VERSION = "1.0.1";
|
|
1580
1583
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1581
|
-
const VERSION = version;
|
|
1582
1584
|
if (process$1.argv.includes("--version") || process$1.argv.includes("-v")) {
|
|
1583
1585
|
console.log(`bx ${VERSION}`);
|
|
1584
1586
|
process$1.exit(0);
|
|
@@ -1593,6 +1595,8 @@ if (!process$1.env.HOME) {
|
|
|
1593
1595
|
}
|
|
1594
1596
|
const HOME = process$1.env.HOME;
|
|
1595
1597
|
async function main() {
|
|
1598
|
+
checkOwnSandbox();
|
|
1599
|
+
checkExternalSandbox();
|
|
1596
1600
|
const apps = getAvailableApps(loadConfig(HOME));
|
|
1597
1601
|
const { mode, workArgs, verbose, dry, profileSandbox, background: backgroundFlag, appArgs, implicit } = parseArgs(getValidModes(apps));
|
|
1598
1602
|
const app = apps[mode];
|
|
@@ -1608,11 +1612,7 @@ async function main() {
|
|
|
1608
1612
|
}
|
|
1609
1613
|
if (!dry) await confirmLaunch(workDirs[0], mode);
|
|
1610
1614
|
}
|
|
1611
|
-
if (!dry)
|
|
1612
|
-
checkOwnSandbox();
|
|
1613
|
-
checkVSCodeTerminal();
|
|
1614
|
-
checkExternalSandbox();
|
|
1615
|
-
}
|
|
1615
|
+
if (!dry) checkVSCodeTerminal();
|
|
1616
1616
|
checkWorkDirs(workDirs, HOME);
|
|
1617
1617
|
await checkAppAlreadyRunning(mode, apps);
|
|
1618
1618
|
if (mode === "code" && profileSandbox) setupVSCodeProfile(HOME);
|