@nbtca/prompt 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/.github/workflows/ci.yml +40 -0
- package/.github/workflows/publish.yml +59 -0
- package/DATA_MANAGEMENT.md +409 -0
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/assets/Prompt_demo.gif +0 -0
- package/bin/nbtca-welcome.js +2 -0
- package/dist/config/data.d.ts +22 -0
- package/dist/config/data.d.ts.map +1 -0
- package/dist/config/data.js +25 -0
- package/dist/config/data.js.map +1 -0
- package/dist/config/theme.d.ts +23 -0
- package/dist/config/theme.d.ts.map +1 -0
- package/dist/config/theme.js +25 -0
- package/dist/config/theme.js.map +1 -0
- package/dist/core/logo.d.ts +9 -0
- package/dist/core/logo.d.ts.map +1 -0
- package/dist/core/logo.js +71 -0
- package/dist/core/logo.js.map +1 -0
- package/dist/core/menu.d.ts +9 -0
- package/dist/core/menu.d.ts.map +1 -0
- package/dist/core/menu.js +153 -0
- package/dist/core/menu.js.map +1 -0
- package/dist/core/ui.d.ts +49 -0
- package/dist/core/ui.d.ts.map +1 -0
- package/dist/core/ui.js +95 -0
- package/dist/core/ui.js.map +1 -0
- package/dist/features/calendar.d.ts +27 -0
- package/dist/features/calendar.d.ts.map +1 -0
- package/dist/features/calendar.js +121 -0
- package/dist/features/calendar.js.map +1 -0
- package/dist/features/docs.d.ts +21 -0
- package/dist/features/docs.d.ts.map +1 -0
- package/dist/features/docs.js +109 -0
- package/dist/features/docs.js.map +1 -0
- package/dist/features/repair.d.ts +9 -0
- package/dist/features/repair.d.ts.map +1 -0
- package/dist/features/repair.js +37 -0
- package/dist/features/repair.js.map +1 -0
- package/dist/features/website.d.ts +17 -0
- package/dist/features/website.d.ts.map +1 -0
- package/dist/features/website.js +39 -0
- package/dist/features/website.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/logo/ascii-logo.txt +6 -0
- package/dist/logo/logo.txt +2 -0
- package/dist/main.d.ts +9 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +36 -0
- package/dist/main.js.map +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/src/config/data.js +484 -0
- package/src/config/data.ts +28 -0
- package/src/config/theme.js +138 -0
- package/src/config/theme.ts +26 -0
- package/src/core/logo.ts +80 -0
- package/src/core/menu.ts +165 -0
- package/src/core/ui.ts +119 -0
- package/src/features/calendar.ts +153 -0
- package/src/features/docs.ts +120 -0
- package/src/features/repair.ts +40 -0
- package/src/features/website.ts +43 -0
- package/src/index.ts +9 -0
- package/src/logo/ascii-logo.txt +6 -0
- package/src/logo/logo.txt +2 -0
- package/src/logo/printLogo.js +26 -0
- package/src/main.ts +39 -0
- package/src/types.ts +51 -0
- package/tsconfig.json +53 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Print the ASCII logo from logo.txt.
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Reads and prints the ASCII logo from logo.txt.
|
|
12
|
+
*/
|
|
13
|
+
export function printLogo() {
|
|
14
|
+
const logoPath = path.resolve(__dirname, "./logo.txt");
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const data = fs.readFileSync(logoPath, "utf8");
|
|
18
|
+
console.log(data.trim());
|
|
19
|
+
} catch (err) {
|
|
20
|
+
if (err.code === "ENOENT") {
|
|
21
|
+
console.error("Error: logo.txt not found. Please ensure the file exists!");
|
|
22
|
+
} else {
|
|
23
|
+
console.error("Error reading logo.txt:", err.message);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NBTCA Welcome Tool
|
|
3
|
+
* 极简启动流程
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { printLogo } from './core/logo.js';
|
|
7
|
+
import { printHeader, clearScreen } from './core/ui.js';
|
|
8
|
+
import { showMainMenu } from './core/menu.js';
|
|
9
|
+
import { APP_INFO } from './config/data.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 主程序入口
|
|
13
|
+
*/
|
|
14
|
+
export async function main(): Promise<void> {
|
|
15
|
+
try {
|
|
16
|
+
// 1. 清屏
|
|
17
|
+
clearScreen();
|
|
18
|
+
|
|
19
|
+
// 2. 显示Logo(智能降级)
|
|
20
|
+
await printLogo();
|
|
21
|
+
|
|
22
|
+
// 3. 显示头部
|
|
23
|
+
printHeader(`${APP_INFO.name} v${APP_INFO.version}`);
|
|
24
|
+
console.log();
|
|
25
|
+
|
|
26
|
+
// 4. 显示主菜单(循环)
|
|
27
|
+
await showMainMenu();
|
|
28
|
+
|
|
29
|
+
} catch (err: any) {
|
|
30
|
+
// 处理Ctrl+C退出
|
|
31
|
+
if (err.message?.includes('SIGINT') || err.message?.includes('User force closed')) {
|
|
32
|
+
console.log('\n再见!');
|
|
33
|
+
process.exit(0);
|
|
34
|
+
} else {
|
|
35
|
+
console.error('发生错误:', err);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 极简类型定义
|
|
3
|
+
* 只保留核心类型
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 菜单项类型
|
|
8
|
+
*/
|
|
9
|
+
export interface MenuItem {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
short?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 活动事件类型
|
|
19
|
+
*/
|
|
20
|
+
export interface Event {
|
|
21
|
+
date: string;
|
|
22
|
+
time: string;
|
|
23
|
+
title: string;
|
|
24
|
+
location: string;
|
|
25
|
+
startDate: Date;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* URL配置类型
|
|
30
|
+
*/
|
|
31
|
+
export interface URLConfig {
|
|
32
|
+
homepage: string;
|
|
33
|
+
github: string;
|
|
34
|
+
docs: string;
|
|
35
|
+
repair: string;
|
|
36
|
+
calendar: string;
|
|
37
|
+
email: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 应用信息类型
|
|
42
|
+
*/
|
|
43
|
+
export interface AppInfo {
|
|
44
|
+
name: string;
|
|
45
|
+
version: string;
|
|
46
|
+
description: string;
|
|
47
|
+
fullDescription: string;
|
|
48
|
+
author: string;
|
|
49
|
+
license: string;
|
|
50
|
+
repository: string;
|
|
51
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Language and Environment */
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"module": "ES2022",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
|
|
9
|
+
/* Emit */
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"rootDir": "./src",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"removeComments": false,
|
|
16
|
+
"importHelpers": false,
|
|
17
|
+
"downlevelIteration": true,
|
|
18
|
+
|
|
19
|
+
/* Interop Constraints */
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"allowSyntheticDefaultImports": true,
|
|
22
|
+
"forceConsistentCasingInFileNames": true,
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
|
|
25
|
+
/* Type Checking */
|
|
26
|
+
"strict": true,
|
|
27
|
+
"noImplicitAny": true,
|
|
28
|
+
"strictNullChecks": true,
|
|
29
|
+
"strictFunctionTypes": true,
|
|
30
|
+
"strictBindCallApply": true,
|
|
31
|
+
"strictPropertyInitialization": true,
|
|
32
|
+
"noImplicitThis": true,
|
|
33
|
+
"alwaysStrict": true,
|
|
34
|
+
"noUnusedLocals": true,
|
|
35
|
+
"noUnusedParameters": true,
|
|
36
|
+
"noImplicitReturns": true,
|
|
37
|
+
"noFallthroughCasesInSwitch": true,
|
|
38
|
+
"noUncheckedIndexedAccess": true,
|
|
39
|
+
"noImplicitOverride": true,
|
|
40
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
41
|
+
|
|
42
|
+
/* Completeness */
|
|
43
|
+
"skipLibCheck": true
|
|
44
|
+
},
|
|
45
|
+
"include": [
|
|
46
|
+
"src/**/*"
|
|
47
|
+
],
|
|
48
|
+
"exclude": [
|
|
49
|
+
"node_modules",
|
|
50
|
+
"dist",
|
|
51
|
+
"**/*.spec.ts"
|
|
52
|
+
]
|
|
53
|
+
}
|