haoshoku 2.1.1 → 2.2.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 2.2.0 - 2025-12-12
4
+ - Remove Dashy provisioning from Debian server setup script.
5
+ - Remove Dashy service template from the repository.
6
+
7
+
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.2.0");
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.2.0",
4
4
  "module": "haoshoku.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,7 @@ import prompts from "prompts";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
5
  import { homedir } from "os";
6
- import net from "net";
6
+ import { fileURLToPath } from "url";
7
7
 
8
8
  // --- Constants ---
9
9
  const HOME = homedir();
@@ -11,7 +11,9 @@ const FISH_CONFIG_DIR = path.join(HOME, ".config", "fish");
11
11
  const STARSHIP_CONFIG_PATH = path.join(HOME, ".config", "starship.toml");
12
12
 
13
13
  // Project paths
14
- const PROJECT_ROOT = process.cwd();
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ const PROJECT_ROOT = path.resolve(__dirname, "..", "..");
15
17
  const CONFIGS_DIR = path.join(PROJECT_ROOT, "configs");
16
18
  const CUSTOM_FISH_CONFIG_PATH = path.join(CONFIGS_DIR, "fish", "config.fish");
17
19
 
@@ -33,7 +35,10 @@ async function installEssentials() {
33
35
  // Split installation to ensure core tools are installed even if optional ones fail
34
36
  await runCommand("sudo apt install -y curl wget git vim ufw fail2ban");
35
37
  // 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 });
38
+ const spcResult = await runCommand("sudo apt install -y software-properties-common", { check: false });
39
+ if (!spcResult) {
40
+ log.warning("Could not install software-properties-common. Some PPAs might not work.");
41
+ }
37
42
  }
38
43
 
39
44
  async function setupSsh() {
@@ -60,10 +65,12 @@ async function setupSsh() {
60
65
  async function configureFishShell() {
61
66
  if (!(await commandExists("fish"))) {
62
67
  log.info("Installing Fish shell...");
63
- // Only try adding PPA if software-properties-common was installed successfully
68
+ // Only try adding PPA if add-apt-repository is available
64
69
  if (await commandExists("add-apt-repository")) {
65
70
  await runCommand("sudo apt-add-repository -y ppa:fish-shell/release-3");
66
71
  await runCommand("sudo apt update");
72
+ } else {
73
+ log.warning("add-apt-repository not found. Installing fish from default repositories (might be older version).");
67
74
  }
68
75
  await runCommand("sudo apt install -y fish");
69
76
  }
@@ -144,90 +151,11 @@ async function setupFirewall() {
144
151
  }
145
152
  }
146
153
 
147
- function checkPortAvailability(port) {
148
- return new Promise((resolve) => {
149
- const server = net.createServer();
150
- server.once("error", (err) => {
151
- resolve(false);
152
- });
153
- server.once("listening", () => {
154
- server.close();
155
- resolve(true);
156
- });
157
- server.listen(port);
158
- });
159
- }
160
-
161
- async function installDashy() {
162
- if (await promptUser("Install Dashy (Personal Dashboard)?", true)) {
163
- const servicesDir = path.join(HOME, "services");
164
- const dashyDir = path.join(servicesDir, "dashy");
165
- const sourceDir = path.join(PROJECT_ROOT, "services", "dashy");
166
-
167
- if (!fs.existsSync(sourceDir)) {
168
- log.error(`Dashy source not found at ${sourceDir}`);
169
- return;
170
- }
171
-
172
- // Port selection
173
- let port = 8080;
174
- let isAvailable = await checkPortAvailability(port);
175
-
176
- if (!isAvailable) {
177
- log.warning(`Port ${port} is already in use.`);
178
- const response = await prompts({
179
- type: "number",
180
- name: "port",
181
- message: "Enter a different port for Dashy:",
182
- initial: 8081,
183
- validate: async (p) => (await checkPortAvailability(p)) ? true : "Port is still in use",
184
- });
185
- port = response.port;
186
- }
187
-
188
- log.info(`Installing Dashy on port ${port}...`);
189
-
190
- // Copy files
191
- if (!fs.existsSync(servicesDir)) {
192
- fs.mkdirSync(servicesDir, { recursive: true });
193
- }
194
-
195
- // Using cp -r for simplicity and preserving permissions
196
- await runCommand(`cp -r ${sourceDir} ${servicesDir}`);
197
-
198
- // Update port in docker-compose.yml if changed
199
- if (port !== 8080) {
200
- const composePath = path.join(dashyDir, "docker-compose.yml");
201
- if (fs.existsSync(composePath)) {
202
- let content = fs.readFileSync(composePath, "utf-8");
203
- content = content.replace("8080:80", `${port}:80`);
204
- fs.writeFileSync(composePath, content);
205
- log.info(`Updated Dashy port to ${port} in docker-compose.yml`);
206
- }
207
- }
208
-
209
- // Start service
210
- log.info("Starting Dashy...");
211
- // We need to run docker compose in the dashy directory
212
- // runCommand doesn't support cwd option directly based on usage seen,
213
- // so we construct the command to change dir or use -f and -p?
214
- // Actually runCommand implementation in utils.js likely supports options or we can chain cd.
215
- // Let's check utils.js or just chain.
216
- // Assuming runCommand takes options based on standard exec wrappers, but looking at previous file view,
217
- // I don't see the definition of runCommand.
218
- // Let's assume `cd ... && ...` works for shell commands.
219
- await runCommand(`cd ${dashyDir} && docker compose up -d`);
220
-
221
- log.success(`Dashy installed! Access it at http://localhost:${port}`);
222
- }
223
- }
224
-
225
154
  export async function runDebianServerSetup() {
226
155
  await installEssentials();
227
156
  await setupSsh();
228
157
  await configureFishShell();
229
158
  await installDocker();
230
- await installDashy();
231
159
  await setupFirewall();
232
160
 
233
161
  log.success("Debian Server setup finished.");
@@ -1,21 +0,0 @@
1
- # Dashy Service
2
-
3
- This directory contains the Docker setup for [Dashy](https://dashy.to/), a self-hosted personal dashboard.
4
-
5
- ## Prerequisites
6
-
7
- - Docker
8
- - Docker Compose
9
-
10
- ## Usage
11
-
12
- 1. Start the service:
13
- ```bash
14
- docker compose up -d
15
- ```
16
-
17
- 2. Access the dashboard at `http://localhost:8080`.
18
-
19
- ## Configuration
20
-
21
- Edit `conf.yml` to customize your dashboard. See [Dashy Documentation](https://dashy.to/docs/configuring) for more details.
@@ -1,12 +0,0 @@
1
- pageTitle: My Dashboard
2
- sections:
3
- - name: Getting Started
4
- items:
5
- - title: GitHub
6
- description: Dashy source code
7
- url: https://github.com/Lissy93/dashy
8
- icon: fab fa-github
9
- - title: Documentation
10
- description: Dashy docs
11
- url: https://dashy.to/docs
12
- icon: fas fa-book
@@ -1,12 +0,0 @@
1
- version: '3.8'
2
- services:
3
- dashy:
4
- image: lissy93/dashy:latest
5
- container_name: dashy
6
- volumes:
7
- - ./conf.yml:/app/public/conf.yml
8
- ports:
9
- - 8080:80
10
- restart: unless-stopped
11
- environment:
12
- - NODE_ENV=production