prismpanel-cli 1.0.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/bin/index.js +3 -0
- package/package.json +21 -0
- package/src/commands/init.js +45 -0
- package/src/index.js +12 -0
- package/src/utils/loader.js +20 -0
- package/src/utils/logger.js +58 -0
- package/tmp/test.md +23 -0
- package/tmp/test_logo.js +22 -0
package/bin/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prismpanel-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"prismpanel": "./bin/index.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"chalk": "^5.6.2",
|
|
18
|
+
"inquirer": "^13.3.2",
|
|
19
|
+
"ora": "^9.3.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { createLoader } from "../utils/loader.js";
|
|
4
|
+
import { showWelcome } from "../utils/logger.js";
|
|
5
|
+
|
|
6
|
+
export async function init() {
|
|
7
|
+
showWelcome();
|
|
8
|
+
const getVisibleLength = (str) => str.replace(/\u001b\[\d+m/g, "").length;
|
|
9
|
+
const noteWidth = 55;
|
|
10
|
+
const borderCol = chalk.yellow;
|
|
11
|
+
|
|
12
|
+
const titleStr = ` ${chalk.yellow.bold("⚠ PRIVACY NOTICE")} `;
|
|
13
|
+
const line1 = ` Your Bot Token is used exclusively for features.`;
|
|
14
|
+
const line2 = ` It will never be stored or used elsewhere.`;
|
|
15
|
+
|
|
16
|
+
console.log(borderCol(` ┌${"─".repeat(noteWidth)}┐`));
|
|
17
|
+
[titleStr, line1, line2].forEach(line => {
|
|
18
|
+
const visibleLength = getVisibleLength(line);
|
|
19
|
+
const padding = " ".repeat(Math.max(0, noteWidth - visibleLength));
|
|
20
|
+
console.log(` ${borderCol("│")}${line}${padding}${borderCol("│")}`);
|
|
21
|
+
});
|
|
22
|
+
console.log(borderCol(` └${"─".repeat(noteWidth)}┘\n`));
|
|
23
|
+
|
|
24
|
+
const answers = await inquirer.prompt([
|
|
25
|
+
{
|
|
26
|
+
type: "input",
|
|
27
|
+
name: "bot_token",
|
|
28
|
+
message: "Bot Token:",
|
|
29
|
+
},
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
const loader = createLoader("Creating project...");
|
|
33
|
+
|
|
34
|
+
// simulate progress over 4 seconds
|
|
35
|
+
await new Promise((resolve) => {
|
|
36
|
+
setTimeout(() => loader.update("Setting up files..."), 1000);
|
|
37
|
+
setTimeout(() => loader.update("Installing dependencies..."), 2000);
|
|
38
|
+
setTimeout(() => loader.update("Finalizing..."), 3000);
|
|
39
|
+
setTimeout(resolve, 4000);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
loader.succeed("Project created successfully!");
|
|
43
|
+
|
|
44
|
+
console.log("\nResult:", answers);
|
|
45
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ora from "ora";
|
|
2
|
+
|
|
3
|
+
export function createLoader(text = "Loading...") {
|
|
4
|
+
const spinner = ora({
|
|
5
|
+
text,
|
|
6
|
+
color: "blue",
|
|
7
|
+
}).start();
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
update(message) {
|
|
11
|
+
spinner.text = message;
|
|
12
|
+
},
|
|
13
|
+
succeed(message) {
|
|
14
|
+
spinner.succeed(message);
|
|
15
|
+
},
|
|
16
|
+
fail(message) {
|
|
17
|
+
spinner.fail(message);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
export function logInfo(message) {
|
|
4
|
+
console.log(chalk.blue(message));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function logSuccess(message) {
|
|
8
|
+
console.log(chalk.green(message));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function logError(message) {
|
|
12
|
+
console.log(chalk.red(message));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* High-fidelity, modern welcomer for the PRISM CLI.
|
|
17
|
+
* Features a minimalist, premium "Next.js" style header.
|
|
18
|
+
*/
|
|
19
|
+
export function showWelcome() {
|
|
20
|
+
const version = "1.0.0";
|
|
21
|
+
|
|
22
|
+
const logoRows = [
|
|
23
|
+
" ▲ ",
|
|
24
|
+
" / \\ ",
|
|
25
|
+
" / \\ ",
|
|
26
|
+
" / /_\\ \\ ",
|
|
27
|
+
" /_______\\ ",
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const textLines = [
|
|
31
|
+
"",
|
|
32
|
+
`${chalk.bgCyan.black.bold(" PRISM PANEL ")} ${chalk.white("CLI")} ${chalk.gray("•")} ${chalk.cyan("v" + version)}`,
|
|
33
|
+
chalk.gray("https://prism.sh/docs/cli"),
|
|
34
|
+
"",
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const boxWidth = 55;
|
|
38
|
+
const borderChar = chalk.gray;
|
|
39
|
+
|
|
40
|
+
// Simple ANSI stripper to calculate visible length
|
|
41
|
+
const getVisibleLength = (str) => str.replace(/\u001b\[\d+m/g, "").length;
|
|
42
|
+
|
|
43
|
+
console.log("");
|
|
44
|
+
console.log(borderChar(` ┌${"─".repeat(boxWidth)}┐`));
|
|
45
|
+
|
|
46
|
+
logoRows.forEach((row, i) => {
|
|
47
|
+
const logoPart = chalk.cyan(row);
|
|
48
|
+
const textPart = textLines[i] || "";
|
|
49
|
+
|
|
50
|
+
// row is approx 12 chars
|
|
51
|
+
const visibleLength = getVisibleLength(row + " " + textPart);
|
|
52
|
+
const padding = " ".repeat(Math.max(0, boxWidth - visibleLength - 1));
|
|
53
|
+
|
|
54
|
+
console.log(` ${borderChar("│")} ${logoPart} ${textPart}${padding}${borderChar("│")}`);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log(borderChar(` └${"─".repeat(boxWidth)}┘`) + "\n");
|
|
58
|
+
}
|
package/tmp/test.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# PRISM CLI Logo Concept
|
|
2
|
+
|
|
3
|
+
This is a smaller, optimized version of the triangle logo used in the CLI.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
▲
|
|
7
|
+
/ \
|
|
8
|
+
/ \
|
|
9
|
+
/ / \ \
|
|
10
|
+
/_______\
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Reference (Larger Version)
|
|
14
|
+
Original high-res concept:
|
|
15
|
+
[View Original Blocks Above]
|
|
16
|
+
```
|
|
17
|
+
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
18
|
+
...
|
|
19
|
+
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBZ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
20
|
+
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
|
21
|
+
...
|
|
22
|
+
```
|
|
23
|
+
*(Full content retained above in original file)*
|
package/tmp/test_logo.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
const logo = [
|
|
4
|
+
" ▲ ",
|
|
5
|
+
" / \\ ",
|
|
6
|
+
" / ▲ \\ ",
|
|
7
|
+
"/_/ \\_\\"
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const welcomeLines = [
|
|
11
|
+
"",
|
|
12
|
+
chalk.white.bold("Welcome to PRISM"),
|
|
13
|
+
chalk.gray("The modern CLI for your projects"),
|
|
14
|
+
""
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const combined = logo.map((line, index) => {
|
|
18
|
+
const textLine = welcomeLines[index] || "";
|
|
19
|
+
return chalk.white(line) + " " + textLine;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log("\n" + combined.join("\n") + "\n");
|