haoshoku 2.1.1 → 2.1.2

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/haoshoku.js CHANGED
@@ -12,7 +12,7 @@ const program = new Command();
12
12
  program
13
13
  .name("haoshoku")
14
14
  .description("Haoshoku: Color of the Supreme King. Dominate your setup.")
15
- .version("2.1.1");
15
+ .version("2.1.2");
16
16
 
17
17
  function detectOS() {
18
18
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haoshoku",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "module": "haoshoku.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,6 +4,7 @@ import path from "path";
4
4
  import fs from "fs";
5
5
  import { homedir } from "os";
6
6
  import net from "net";
7
+ import { fileURLToPath } from "url";
7
8
 
8
9
  // --- Constants ---
9
10
  const HOME = homedir();
@@ -11,7 +12,9 @@ const FISH_CONFIG_DIR = path.join(HOME, ".config", "fish");
11
12
  const STARSHIP_CONFIG_PATH = path.join(HOME, ".config", "starship.toml");
12
13
 
13
14
  // Project paths
14
- const PROJECT_ROOT = process.cwd();
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const PROJECT_ROOT = path.resolve(__dirname, "..", "..");
15
18
  const CONFIGS_DIR = path.join(PROJECT_ROOT, "configs");
16
19
  const CUSTOM_FISH_CONFIG_PATH = path.join(CONFIGS_DIR, "fish", "config.fish");
17
20
 
@@ -33,7 +36,10 @@ async function installEssentials() {
33
36
  // Split installation to ensure core tools are installed even if optional ones fail
34
37
  await runCommand("sudo apt install -y curl wget git vim ufw fail2ban");
35
38
  // Try installing software-properties-common separately as it might not be available on all minimal images
36
- await runCommand("sudo apt install -y software-properties-common", { check: false });
39
+ const spcResult = await runCommand("sudo apt install -y software-properties-common", { check: false });
40
+ if (!spcResult) {
41
+ log.warning("Could not install software-properties-common. Some PPAs might not work.");
42
+ }
37
43
  }
38
44
 
39
45
  async function setupSsh() {
@@ -60,10 +66,12 @@ async function setupSsh() {
60
66
  async function configureFishShell() {
61
67
  if (!(await commandExists("fish"))) {
62
68
  log.info("Installing Fish shell...");
63
- // Only try adding PPA if software-properties-common was installed successfully
69
+ // Only try adding PPA if add-apt-repository is available
64
70
  if (await commandExists("add-apt-repository")) {
65
71
  await runCommand("sudo apt-add-repository -y ppa:fish-shell/release-3");
66
72
  await runCommand("sudo apt update");
73
+ } else {
74
+ log.warning("add-apt-repository not found. Installing fish from default repositories (might be older version).");
67
75
  }
68
76
  await runCommand("sudo apt install -y fish");
69
77
  }