This commit is contained in:
2025-02-23 22:25:46 +08:00
parent 3b26fe4adc
commit d934111354
9 changed files with 1222 additions and 900 deletions

28
.github/workflows/deploy.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Deploy
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm install
- run: CI=false npm run build
- uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.KEY }}
REMOTE_HOST: ${{ secrets.HOST }}
ARGS: "-avzr --delete"
SOURCE: dist/
REMOTE_USER: root
TARGET: /root/WebPreview/build

View File

@@ -1,5 +1 @@
# Vue 3 + TypeScript + Vite web preview
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).

View File

@@ -4,11 +4,10 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="shortcut icon" href="/favicon.ico" /> <link rel="shortcut icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>前端开发网站</title> <title>前端开发预览网站</title>
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

2036
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,8 +4,8 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"start": "vite", "start": "rsbuild dev",
"build": "vue-tsc -b && vite build", "build": "rsbuild build",
"fmt": "prettier --write src/" "fmt": "prettier --write src/"
}, },
"dependencies": { "dependencies": {
@@ -21,11 +21,10 @@
}, },
"devDependencies": { "devDependencies": {
"@codemirror/state": "^6.5.2", "@codemirror/state": "^6.5.2",
"@vitejs/plugin-vue": "^5.2.1", "@rsbuild/core": "^1.2.11",
"@rsbuild/plugin-vue": "^1.0.6",
"@vue/tsconfig": "^0.7.0", "@vue/tsconfig": "^0.7.0",
"prettier": "^3.5.2", "prettier": "^3.5.2",
"typescript": "^5.7.3", "typescript": "^5.7.3"
"vite": "^6.1.1",
"vue-tsc": "^2.2.2"
} }
} }

23
rsbuild.config.ts Normal file
View File

@@ -0,0 +1,23 @@
import { defineConfig } from "@rsbuild/core"
import { pluginVue } from "@rsbuild/plugin-vue"
export default defineConfig({
plugins: [pluginVue()],
html: {
template: "./index.html",
},
source: {
entry: {
index: "./src/main.ts",
},
},
performance: {
chunkSplit: {
strategy: "split-by-experience",
forceSplitting: {
"lib-ui": /node_modules[\\/]naive-ui/,
"lib-cm": /node_modules[\\/]@codemirror/,
},
},
},
})

View File

@@ -3,7 +3,7 @@ import { darkTheme, dateZhCN, zhCN } from "naive-ui"
import { useDark, useMagicKeys, whenever } from "@vueuse/core" import { useDark, useMagicKeys, whenever } from "@vueuse/core"
import Editor from "./components/Editor.vue" import Editor from "./components/Editor.vue"
import Preview from "./components/Preview.vue" import Preview from "./components/Preview.vue"
import { html, css } from "./store.ts" import { html, css, js } from "./store.ts"
const isDark = useDark() const isDark = useDark()
@@ -39,9 +39,9 @@ whenever(ctrl_r, () => {})
<n-tab-pane name="css" tab="CSS"> <n-tab-pane name="css" tab="CSS">
<Editor language="css" v-model:value="css" /> <Editor language="css" v-model:value="css" />
</n-tab-pane> </n-tab-pane>
<!-- <n-tab-pane name="js" tab="JS"> <n-tab-pane name="js" tab="JS">
<Editor language="js" v-model:value="js" /> <Editor language="js" v-model:value="js" />
</n-tab-pane> --> </n-tab-pane>
</n-tabs> </n-tabs>
</template> </template>
<template #2> <template #2>

View File

@@ -20,5 +20,5 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true "noUncheckedSideEffectImports": true
}, },
"include": ["vite.config.ts"] "include": ["rsbuild.config.ts"]
} }

View File

@@ -1,7 +0,0 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
})