feat: add bot and api services with config, logger and database packages
- Add bot service with telegram integration and webhook/polling modes - Add api service with hono, swagger and zod-openapi - Create config package for environment variable management - Create logger package for colored console logging - Create database package with prisma integration - Remove next.js web and docs apps - Update turbo.json for new services - Add dockerfiles and gitea workflows for deployment
This commit is contained in:
14
packages/logger/package.json
Normal file
14
packages/logger/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "@repo/logger",
|
||||
"scripts": {
|
||||
"dev": "tsc --watch",
|
||||
"build": "tsc"
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/typescript-config": "*",
|
||||
"typescript": "latest"
|
||||
}
|
||||
}
|
||||
1
packages/logger/src/index.ts
Normal file
1
packages/logger/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './logger'
|
||||
39
packages/logger/src/logger.ts
Normal file
39
packages/logger/src/logger.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
export const logger = {
|
||||
info: (msg: string, data?: any) => {
|
||||
console.log(
|
||||
"\x1b[44m\x1b[37m\x1b[1m[INFO]\x1b[0m",
|
||||
"\x1b[94m" + msg + "\x1b[0m",
|
||||
);
|
||||
if (data) {
|
||||
console.log("\x1b[94m" + JSON.stringify(data, null, 2) + "\x1b[0m");
|
||||
}
|
||||
},
|
||||
error: (msg: string, err?: unknown) => {
|
||||
console.error(
|
||||
"\x1b[41m\x1b[37m\x1b[1m[ERROR]\x1b[0m",
|
||||
"\x1b[91m" + msg + "\x1b[0m",
|
||||
);
|
||||
if (err) {
|
||||
console.error(
|
||||
"\x1b[91m" +
|
||||
(err instanceof Error ? err.stack : JSON.stringify(err, null, 2)) +
|
||||
"\x1b[0m",
|
||||
);
|
||||
}
|
||||
},
|
||||
success: (msg: string) => {
|
||||
console.log(
|
||||
"\x1b[42m\x1b[37m\x1b[1m[SUCCESS]\x1b[0m",
|
||||
"\x1b[92m" + msg + "\x1b[0m",
|
||||
);
|
||||
},
|
||||
warn: (msg: string, data?: any) => {
|
||||
console.warn(
|
||||
"\x1b[43m\x1b[30m\x1b[1m[WARN]\x1b[0m",
|
||||
"\x1b[93m" + msg + "\x1b[0m",
|
||||
);
|
||||
if (data) {
|
||||
console.warn("\x1b[93m" + JSON.stringify(data, null, 2) + "\x1b[0m");
|
||||
}
|
||||
},
|
||||
};
|
||||
9
packages/logger/tsconfig.json
Normal file
9
packages/logger/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "@repo/typescript-config/base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
12
packages/logger/turbo.json
Normal file
12
packages/logger/turbo.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": [
|
||||
"//"
|
||||
],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"dist/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user