@involvex/syncstuff-cli 0.0.2 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@involvex/syncstuff-cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "homepage": "https://syncstuff-web.involvex.workers.dev/",
6
6
  "sponsor": {
@@ -10,7 +10,7 @@
10
10
  "name": "involvex"
11
11
  },
12
12
  "bin": {
13
- "syncstuff": "src/cli/index.ts"
13
+ "syncstuff": "dist/cli.js"
14
14
  },
15
15
  "scripts": {
16
16
  "dev": "bun run src/cli/index.ts",
@@ -1,7 +1,7 @@
1
- import type { DebugMode } from "../../core";
1
+ import { DebugMode } from "../../core";
2
2
 
3
- export const showDebug = (debugMode: DebugMode) => {
4
- if (!debugMode.enabled) {
3
+ export const showDebug = () => {
4
+ if (!DebugMode.enabled) {
5
5
  return;
6
6
  } else {
7
7
  console.log("Debug mode enabled");
@@ -2,6 +2,7 @@ import chalk from "chalk";
2
2
  import { readFileSync } from "fs";
3
3
  import { dirname, join } from "path";
4
4
  import { fileURLToPath } from "url";
5
+ import { DebugMode } from "../../core.js";
5
6
  import { createBox, printHeader, printSeparator } from "../../utils/ui.js";
6
7
 
7
8
  const __filename = fileURLToPath(import.meta.url);
@@ -13,7 +14,13 @@ export function showversion() {
13
14
  try {
14
15
  const packagePath = join(__dirname, "../../../package.json");
15
16
  const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
16
- const version = packageJson.version || "0.0.1";
17
+ const version = packageJson.version;
18
+
19
+ if (DebugMode.enabled === true) {
20
+ console.log(chalk.yellow("Debug mode enabled"));
21
+ console.log("Package path: " + packagePath);
22
+ console.log("Version: " + version);
23
+ }
17
24
 
18
25
  const versionBox = createBox(
19
26
  chalk.cyan.bold("Syncstuff CLI\n\n") +
@@ -30,6 +37,12 @@ export function showversion() {
30
37
  console.log(versionBox);
31
38
  printSeparator();
32
39
  } catch {
40
+ if (DebugMode.enabled === true) {
41
+ const packagePath = join(__dirname, "../../../package.json");
42
+ console.log(chalk.yellow("Debug mode enabled"));
43
+ console.log("Packagepath: " + packagePath);
44
+ console.log(chalk.yellow("Version: 0.0.1 (unable to read package.json)"));
45
+ }
33
46
  console.log(chalk.yellow("Version: 0.0.1 (unable to read package.json)"));
34
47
  }
35
48
  }
package/src/core.ts CHANGED
@@ -8,6 +8,6 @@ export interface Device {
8
8
  is_online: boolean;
9
9
  }
10
10
 
11
- export type DebugMode = {
12
- enabled: boolean;
11
+ export const DebugMode = {
12
+ enabled: false,
13
13
  };
package/src/utils/ui.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import boxen from "boxen";
2
2
  import chalk from "chalk";
3
+ import { readFileSync } from "fs";
3
4
  import ora from "ora";
5
+ import { join } from "path";
4
6
  import Table from "table";
5
7
 
6
8
  export function success(message: string): void {
@@ -69,9 +71,12 @@ export function animateText(text: string, delay: number = 50): Promise<void> {
69
71
  }
70
72
 
71
73
  export function printHeader(): void {
74
+ const packagePath = join(__dirname, "../../package.json");
75
+ const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
76
+ const version = packageJson.version;
72
77
  const header = chalk.cyan.bold(`
73
78
  ╔═══════════════════════════════════════╗
74
- ║ Syncstuff CLI v0.0.1
79
+ ║ Syncstuff CLI v${version}
75
80
  ║ Seamless Sync Across Devices ║
76
81
  ╚═══════════════════════════════════════╝
77
82
  `);