Lines 14-54javascript
14 for (let key of __getOwnPropNames(from))
15 if (!__hasOwnProp.call(to, key) && key !== except)
16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21 // If the importer is in node compatibility mode or this is not an ESM
22 // file that has been converted to a CommonJS file using a Babel-
23 // compatible transform (i.e. "__esModule" has not been set), then set
24 // "default" to the CommonJS "module.exports" for node compatibility.
25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30var os = __toESM(require("os"), 1);
31var path = __toESM(require("path"), 1);
32var fs = __toESM(require("fs"), 1);
33var APP_DIR_NAME = "devswitch";
34function getDataDir() {
35 const override = process.env.DEVSWITCH_DATA_DIR;
36 if (override && override.trim()) {
37 return override.trim();
39 const platform2 = os.platform();
40 const home = os.homedir();
41 if (platform2 === "win32") {
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
bin/devswitch.cjsView on unpkg · L34 42 const appData = process.env.APPDATA || path.join(home, "AppData", "Roaming");
43 return path.join(appData, APP_DIR_NAME);
45 if (platform2 === "darwin") {
46 return path.join(home, "Library", "Application Support", APP_DIR_NAME);
48 const xdg = process.env.XDG_CONFIG_HOME;
49 const base = xdg && xdg.trim() ? xdg.trim() : path.join(home, ".config");
50 return path.join(base, APP_DIR_NAME);
52function ensureDataDir() {
53 const dir = getDataDir();
54 if (!fs.existsSync(dir)) {