refactor: 推翻舊架構, 進入 Vite 盛世!

* 所有的 CDN 依賴已全部 npm 化
* Webpack? 一邊去! Vite 太好用啦!
* 將 Imports.ts 剔除
* 移除了大量的靜態文件
* 將 index.html 的部分代碼分離
* 修改 deno task
* 移除了動態編譯頁面的支持
* ./static 引用全部變更為 npm 包引用
This commit is contained in:
CrescentLeaf
2025-09-07 12:49:09 +08:00
parent b6140063c7
commit 25320fe521
74 changed files with 217 additions and 36326 deletions

View File

@@ -1,5 +1,9 @@
import fs from 'node:fs/promises'
import chalk from 'chalk'
import { cwd } from "node:process"
const isCompilingClient = /client(\\|\/)?$/.test(cwd())
const prefix = isCompilingClient ? '.' : ''
const default_data_path = "./thewhitesilk_data"
let config = {
@@ -28,12 +32,12 @@ let config = {
}
try {
config = JSON.parse(await fs.readFile('thewhitesilk_config.json', 'utf-8'))
config = JSON.parse(await fs.readFile(prefix + './thewhitesilk_config.json', 'utf-8'))
} catch (_e) {
console.log(chalk.yellow("配置文件貌似不存在, 正在创建..."))
await fs.writeFile('thewhitesilk_config.json', JSON.stringify(config))
await fs.writeFile(prefix + './thewhitesilk_config.json', JSON.stringify(config))
}
await fs.mkdir(config.data_path, { recursive: true })
await fs.mkdir(prefix + config.data_path, { recursive: true })
export default config