feat: 控制臺快捷指令
This commit is contained in:
@@ -6,7 +6,10 @@ import HttpServerLike from "./types/HttpServerLike.ts"
|
|||||||
import config from './config.ts'
|
import config from './config.ts'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import https from 'node:https'
|
import https from 'node:https'
|
||||||
|
import readline from 'node:readline'
|
||||||
|
import process from "node:process"
|
||||||
import transform from './compiler/transform.ts'
|
import transform from './compiler/transform.ts'
|
||||||
|
import chalk from "chalk"
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
@@ -31,5 +34,18 @@ ApiManager.initEvents()
|
|||||||
ApiManager.initAllApis()
|
ApiManager.initAllApis()
|
||||||
|
|
||||||
httpServer.listen(config.server.listen)
|
httpServer.listen(config.server.listen)
|
||||||
|
console.log(chalk.green("API & Web 服務已經開始運作"))
|
||||||
|
|
||||||
transform('./client', config.data_path + '/page_compiled')
|
console.log(chalk.green("Web 頁面已編譯完成, 用時 " + await transform('./client', config.data_path + '/page_compiled') + "s"))
|
||||||
|
|
||||||
|
console.log(chalk.yellow("===== TheWhiteSilk Server ====="))
|
||||||
|
console.log(chalk.yellow("b - 重新編譯 Web 頁面"))
|
||||||
|
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout
|
||||||
|
})
|
||||||
|
rl.on('line', async (text) => {
|
||||||
|
if (text == "b")
|
||||||
|
console.log(chalk.green("Web 頁面已編譯完成, 用時 " + await transform('./client', config.data_path + '/page_compiled') + "s"))
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user