feat: add checkout service make targets (#1311)
This commit is contained in:
@@ -187,4 +187,17 @@ describe("captureLauncher shim resolution", () => {
|
||||
expect(info.kind).toBe("homebrew");
|
||||
expect(info.shimPath).toBeUndefined();
|
||||
});
|
||||
|
||||
it("classifies a non-Cellar bundle as a local checkout install", () => {
|
||||
const cliEntry = "/Users/alice/src/kandev/dist/kandev/cli/bin/cli.js";
|
||||
process.argv = ["/path/to/node", cliEntry];
|
||||
vi.stubEnv("KANDEV_BUNDLE_DIR", "/Users/alice/src/kandev/dist/kandev");
|
||||
vi.spyOn(fs, "existsSync").mockImplementation((p) => p === cliEntry);
|
||||
vi.spyOn(fs, "realpathSync").mockReturnValue(cliEntry);
|
||||
|
||||
const info = captureLauncher();
|
||||
expect(info.kind).toBe("local");
|
||||
expect(info.bundleDir).toBe("/Users/alice/src/kandev/dist/kandev");
|
||||
expect(info.shimPath).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ export function macosSystemPlistPath(): string {
|
||||
return path.join(MACOS_SYSTEM_DAEMON_DIR, `${LAUNCHD_LABEL}.plist`);
|
||||
}
|
||||
|
||||
export type LauncherKind = "homebrew" | "npm" | "npx" | "unknown";
|
||||
export type LauncherKind = "homebrew" | "npm" | "npx" | "local" | "unknown";
|
||||
|
||||
export type LauncherInfo = {
|
||||
/** Absolute path to node executable (process.execPath at install time). */
|
||||
@@ -43,7 +43,7 @@ export type LauncherInfo = {
|
||||
cliEntry: string;
|
||||
/** Best-guess of how kandev was installed. Used to seed env vars. */
|
||||
kind: LauncherKind;
|
||||
/** KANDEV_BUNDLE_DIR if set (Homebrew sets this). */
|
||||
/** KANDEV_BUNDLE_DIR if set (Homebrew and local checkout installs set this). */
|
||||
bundleDir?: string;
|
||||
/** KANDEV_VERSION if set (Homebrew sets this). */
|
||||
version?: string;
|
||||
@@ -96,7 +96,9 @@ export function captureLauncher(): LauncherInfo {
|
||||
const bundleDir = process.env.KANDEV_BUNDLE_DIR;
|
||||
const version = process.env.KANDEV_VERSION;
|
||||
const kind: LauncherKind = bundleDir
|
||||
? "homebrew"
|
||||
? homebrewShimPath(cliEntry)
|
||||
? "homebrew"
|
||||
: "local"
|
||||
: looksLikeNpxEntry(cliEntry)
|
||||
? "npx"
|
||||
: cliEntry.includes(`${path.sep}node_modules${path.sep}`)
|
||||
|
||||
Reference in New Issue
Block a user