distats-cli 0.0.3 → 0.0.5

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": "distats-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@ import chalk from "chalk";
3
3
  import ora from "ora";
4
4
  import crypto from "crypto";
5
5
  import { getDatabase, runQuery } from "../utils/database.js";
6
- import { showWelcome } from "./utils/logger.js";
6
+ import { showWelcome } from "../utils/logger.js";
7
7
 
8
8
 
9
9
  /**
@@ -2,10 +2,14 @@ import path from "path";
2
2
  import fs from "fs";
3
3
  import inquirer from "inquirer";
4
4
  import chalk from "chalk";
5
- import { execSync } from "child_process";
5
+ import crypto from "crypto";
6
+ import { exec } from "child_process";
7
+ import { promisify } from "util";
6
8
  import { createLoader } from "../utils/loader.js";
7
9
  import { showWelcome } from "../utils/logger.js";
8
10
 
11
+ const execAsync = promisify(exec);
12
+
9
13
  export async function init() {
10
14
  showWelcome();
11
15
 
@@ -23,9 +27,10 @@ export async function init() {
23
27
 
24
28
  const promptAnswers = await inquirer.prompt([
25
29
  {
26
- type: "input",
30
+ type: "password",
27
31
  name: "bot_token",
28
32
  message: "Your Bot Token:",
33
+ mask: "*",
29
34
  },
30
35
  ]);
31
36
 
@@ -34,15 +39,15 @@ export async function init() {
34
39
  try {
35
40
  // 2. Clone the repo
36
41
  loader.update(`Downloading panel from ${github_repo}...`);
37
- execSync(`git clone ${github_repo} .`, { stdio: 'ignore' });
42
+ await execAsync(`git clone ${github_repo} .`);
38
43
 
39
44
  // 3. Install packages
40
45
  loader.update("Installing packages (npm install)... this may take a moment.");
41
- execSync(`npm install`, { stdio: 'ignore' });
46
+ await execAsync(`npm install`);
42
47
 
43
48
  // 4. Build Next.js
44
49
  loader.update("Building Next.js application (npm run build)...");
45
- execSync(`npm run build`, { stdio: 'ignore' });
50
+ await execAsync(`npm run build`);
46
51
 
47
52
  // 5. Save the configuration
48
53
  loader.update("Finalizing setup...");
@@ -54,6 +59,7 @@ export async function init() {
54
59
  const configPath = path.join(configDir, "config.json");
55
60
  const configData = {
56
61
  bot_token: promptAnswers.bot_token,
62
+ session_secret: crypto.randomBytes(64).toString("hex"),
57
63
  database_type: "sqlite",
58
64
  db_path: "./@distats_panel/database.sqlite",
59
65
  installed_at: new Date().toISOString(),