This commit is contained in:
parent
f28918d724
commit
d4aa63eea2
11
package.json
11
package.json
@ -17,6 +17,7 @@
|
|||||||
"build": "rollup -c rollup.config.mjs",
|
"build": "rollup -c rollup.config.mjs",
|
||||||
"dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs",
|
"dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs",
|
||||||
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
|
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
|
||||||
|
"bun:dev": "bun run dev",
|
||||||
"test": "tsx test/**/*.ts",
|
"test": "tsx test/**/*.ts",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"pub": "npm run build && envision pack -p -u",
|
"pub": "npm run build && envision pack -p -u",
|
||||||
@ -36,7 +37,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kevisual/code-center-module": "0.0.18",
|
"@kevisual/code-center-module": "0.0.18",
|
||||||
"@kevisual/use-config": "^1.0.11",
|
"@kevisual/use-config": "^1.0.12",
|
||||||
"@kevisual/mark": "0.0.7",
|
"@kevisual/mark": "0.0.7",
|
||||||
"@kevisual/router": "0.0.13",
|
"@kevisual/router": "0.0.13",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.0.2",
|
||||||
@ -45,8 +46,8 @@
|
|||||||
"lodash-es": "^4.17.21"
|
"lodash-es": "^4.17.21"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/types": "^0.0.7",
|
"@kevisual/types": "^0.0.9",
|
||||||
"@kevisual/use-config": "^1.0.11",
|
"@kevisual/use-config": "^1.0.12",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-commonjs": "^28.0.3",
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
@ -56,7 +57,7 @@
|
|||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/formidable": "^3.4.5",
|
"@types/formidable": "^3.4.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^22.15.2",
|
"@types/node": "^22.15.3",
|
||||||
"commander": "^13.1.0",
|
"commander": "^13.1.0",
|
||||||
"concurrently": "^9.1.2",
|
"concurrently": "^9.1.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@ -75,7 +76,7 @@
|
|||||||
"rollup-plugin-esbuild": "^6.2.1",
|
"rollup-plugin-esbuild": "^6.2.1",
|
||||||
"sequelize": "^6.37.7",
|
"sequelize": "^6.37.7",
|
||||||
"tape": "^5.9.0",
|
"tape": "^5.9.0",
|
||||||
"tsx": "^4.19.3",
|
"tsx": "^4.19.4",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.10.0"
|
"packageManager": "pnpm@10.10.0"
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
import { pino } from 'pino';
|
|
||||||
import { useConfig } from '@kevisual/use-config/env';
|
|
||||||
|
|
||||||
const config = useConfig();
|
|
||||||
|
|
||||||
export const logger = pino({
|
|
||||||
level: config.LOG_LEVEL || 'info',
|
|
||||||
transport: {
|
|
||||||
target: 'pino-pretty',
|
|
||||||
options: {
|
|
||||||
colorize: true,
|
|
||||||
translateTime: 'SYS:standard',
|
|
||||||
ignore: 'pid,hostname',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
serializers: {
|
|
||||||
error: pino.stdSerializers.err,
|
|
||||||
req: pino.stdSerializers.req,
|
|
||||||
res: pino.stdSerializers.res,
|
|
||||||
},
|
|
||||||
base: {
|
|
||||||
app: 'ai-chat',
|
|
||||||
env: process.env.NODE_ENV || 'development',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const logError = (message: string, data?: any) => logger.error({ data }, message);
|
|
||||||
export const logWarning = (message: string, data?: any) => logger.warn({ data }, message);
|
|
||||||
export const logInfo = (message: string, data?: any) => logger.info({ data }, message);
|
|
||||||
export const logDebug = (message: string, data?: any) => logger.debug({ data }, message);
|
|
||||||
|
|
||||||
export const log = {
|
|
||||||
error: logError,
|
|
||||||
warn: logWarning,
|
|
||||||
info: logInfo,
|
|
||||||
debug: logDebug,
|
|
||||||
};
|
|
3
src/modules/config.ts
Normal file
3
src/modules/config.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { useConfig } from '@kevisual/use-config/env';
|
||||||
|
|
||||||
|
export const config = useConfig();
|
@ -1,7 +1,5 @@
|
|||||||
import { Sequelize } from 'sequelize';
|
import { Sequelize } from 'sequelize';
|
||||||
import { useConfig } from '@kevisual/use-config/env';
|
import { config } from './config';
|
||||||
|
|
||||||
const config = useConfig();
|
|
||||||
|
|
||||||
export type PostgresConfig = {
|
export type PostgresConfig = {
|
||||||
postgres: {
|
postgres: {
|
||||||
|
@ -1,25 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "@kevisual/types/json/backend.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "nodenext",
|
|
||||||
"target": "esnext",
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"outDir": "./dist",
|
|
||||||
"sourceMap": false,
|
|
||||||
"allowJs": true,
|
|
||||||
"newLine": "LF",
|
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"typeRoots": [
|
|
||||||
"node_modules/@types",
|
|
||||||
"node_modules/@kevisual/types"
|
|
||||||
],
|
|
||||||
"declaration": true,
|
|
||||||
"noEmit": false,
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
"src/*"
|
"src/*"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user