feat: 增加自动格式化

This commit is contained in:
ningmengchongshui 2024-06-14 19:20:45 +08:00
parent 0bc9112bdb
commit d84987567a
8 changed files with 41 additions and 25 deletions

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}

15
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

1
.vscode/yunzai.code-snippets vendored Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -2,7 +2,7 @@
"apps": [ "apps": [
{ {
"name": "Miao-Yunzai", "name": "Miao-Yunzai",
"script": "./app.js", "script": "./index.js",
"max_memory_restart": "512M", "max_memory_restart": "512M",
"restart_delay": 60000 "restart_delay": 60000
} }

View File

@ -16,7 +16,7 @@ function createLog() {
type: 'console', type: 'console',
layout: { layout: {
type: 'pattern', type: 'pattern',
pattern: '%[[MiaoYz][%d{hh:mm:ss.SSS}][%4.4p]%] %m' pattern: '%[[MYZ-V4][%d{hh:mm:ss.SSS}][%4.4p]%] %m'
} }
}, },
command: { command: {

View File

@ -1,38 +1,22 @@
import { existsSync } from 'fs' import './init/modules.js'
import { join } from 'path' import './init/logger.js'
import { configInit } from './config/config'
import { loggerInit } from './config/log'
import { BOT_NAME } from './config'
import { redisInit } from './config/redis'
import { promises } from 'node:fs' import { promises } from 'node:fs'
import yaml from 'yaml' import yaml from 'yaml'
import { configInit } from './config/config'
import { BOT_NAME } from './config'
import { redisInit } from './config/redis'
import { CONFIG_INIT_PATH } from './config/system.js' import { CONFIG_INIT_PATH } from './config/system.js'
import { checkRun } from './config/check.js' import { checkRun } from './config/check.js'
/** /**
* node_modules *
*/ */
if (!existsSync(join(process.cwd(), './node_modules'))) { logger.mark(`${BOT_NAME} 启动中...`)
console.log('未安装依赖。。。。')
console.log('请先运行命令pnpm install -P 安装依赖')
process.exit()
}
/** /**
* *
*/ */
configInit() configInit()
/**
*
*/
loggerInit()
/**
*
*/
logger.mark(`${BOT_NAME} 启动中...`)
/** /**
* *
*/ */

2
src/init/logger.ts Normal file
View File

@ -0,0 +1,2 @@
import { loggerInit } from '../config/log'
loggerInit()

11
src/init/modules.ts Normal file
View File

@ -0,0 +1,11 @@
import { existsSync } from 'fs'
import { join } from 'path'
const node_modules = join(process.cwd(), './node_modules')
/**
* node_modules
*/
if (!existsSync(node_modules)) {
console.log('未安装依赖。。。。')
console.log('请先运行命令pnpm install -P 安装依赖')
process.exit()
}