distats-cli 0.0.4 → 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 +1 -1
- package/src/commands/init.js +9 -5
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -3,10 +3,13 @@ import fs from "fs";
|
|
|
3
3
|
import inquirer from "inquirer";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import crypto from "crypto";
|
|
6
|
-
import {
|
|
6
|
+
import { exec } from "child_process";
|
|
7
|
+
import { promisify } from "util";
|
|
7
8
|
import { createLoader } from "../utils/loader.js";
|
|
8
9
|
import { showWelcome } from "../utils/logger.js";
|
|
9
10
|
|
|
11
|
+
const execAsync = promisify(exec);
|
|
12
|
+
|
|
10
13
|
export async function init() {
|
|
11
14
|
showWelcome();
|
|
12
15
|
|
|
@@ -24,9 +27,10 @@ export async function init() {
|
|
|
24
27
|
|
|
25
28
|
const promptAnswers = await inquirer.prompt([
|
|
26
29
|
{
|
|
27
|
-
type: "
|
|
30
|
+
type: "password",
|
|
28
31
|
name: "bot_token",
|
|
29
32
|
message: "Your Bot Token:",
|
|
33
|
+
mask: "*",
|
|
30
34
|
},
|
|
31
35
|
]);
|
|
32
36
|
|
|
@@ -35,15 +39,15 @@ export async function init() {
|
|
|
35
39
|
try {
|
|
36
40
|
// 2. Clone the repo
|
|
37
41
|
loader.update(`Downloading panel from ${github_repo}...`);
|
|
38
|
-
|
|
42
|
+
await execAsync(`git clone ${github_repo} .`);
|
|
39
43
|
|
|
40
44
|
// 3. Install packages
|
|
41
45
|
loader.update("Installing packages (npm install)... this may take a moment.");
|
|
42
|
-
|
|
46
|
+
await execAsync(`npm install`);
|
|
43
47
|
|
|
44
48
|
// 4. Build Next.js
|
|
45
49
|
loader.update("Building Next.js application (npm run build)...");
|
|
46
|
-
|
|
50
|
+
await execAsync(`npm run build`);
|
|
47
51
|
|
|
48
52
|
// 5. Save the configuration
|
|
49
53
|
loader.update("Finalizing setup...");
|