Merge branch 'main' of https://gitea.simengweb.com/si-meng-spec/SiMengWebSite_Notes
This commit is contained in:
@@ -1,133 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal EnableExtensions
|
|
||||||
|
|
||||||
chcp 65001 >nul
|
|
||||||
|
|
||||||
REM Paths and settings
|
|
||||||
set "ROOT_DIR=%~dp0"
|
|
||||||
set "PROJECT_DIR=%ROOT_DIR%"
|
|
||||||
set "DIST_DIR=%PROJECT_DIR%docs\.vuepress\dist"
|
|
||||||
set "PUBLISH_DIR=%PROJECT_DIR%_publish"
|
|
||||||
set "REMOTE_URL=https://gitea.simengweb.com/si-meng-spec/build_notes_simengweb.git"
|
|
||||||
set "BRANCH=main"
|
|
||||||
|
|
||||||
REM Args
|
|
||||||
set "LIGHT_FLAG=%~1"
|
|
||||||
set "COMMIT_MSG=%~2"
|
|
||||||
|
|
||||||
echo [Info] Working dir: %PROJECT_DIR%
|
|
||||||
|
|
||||||
REM Pre-checks
|
|
||||||
where npm >nul 2>&1
|
|
||||||
if errorlevel 1 goto :npm_missing
|
|
||||||
where git >nul 2>&1
|
|
||||||
if errorlevel 1 goto :git_missing
|
|
||||||
|
|
||||||
REM Install deps on first run
|
|
||||||
if not exist "%PROJECT_DIR%node_modules" (
|
|
||||||
echo [Info] Installing deps ^(npm ci^)...
|
|
||||||
call npm ci
|
|
||||||
if errorlevel 1 goto :fail
|
|
||||||
) else (
|
|
||||||
echo [Info] node_modules exists, skip install.
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Light build mode
|
|
||||||
if /I "%LIGHT_FLAG%"=="light" (
|
|
||||||
set "LIGHT_BUILD=1"
|
|
||||||
echo [Info] LIGHT_BUILD=1 enabled
|
|
||||||
)
|
|
||||||
|
|
||||||
set "NODE_OPTIONS=--max-old-space-size=4096"
|
|
||||||
|
|
||||||
echo [Info] Building docs...
|
|
||||||
call npm run docs:build
|
|
||||||
if errorlevel 1 goto :fail
|
|
||||||
|
|
||||||
if not exist "%DIST_DIR%" goto :no_dist
|
|
||||||
|
|
||||||
REM Prepare publish repo
|
|
||||||
if not exist "%PUBLISH_DIR%\.git" (
|
|
||||||
echo [Info] Cloning publish repo...
|
|
||||||
git clone "%REMOTE_URL%" "%PUBLISH_DIR%"
|
|
||||||
if errorlevel 1 goto :fail
|
|
||||||
) else (
|
|
||||||
echo [Info] Updating publish repo...
|
|
||||||
pushd "%PUBLISH_DIR%"
|
|
||||||
git fetch --all
|
|
||||||
if errorlevel 1 goto :gitfail
|
|
||||||
git checkout "%BRANCH%"
|
|
||||||
if errorlevel 1 goto :gitfail
|
|
||||||
git reset --hard "origin/%BRANCH%"
|
|
||||||
if errorlevel 1 goto :gitfail
|
|
||||||
popd
|
|
||||||
)
|
|
||||||
|
|
||||||
echo [Info] Cleaning publish directory ^(keep .git^)...
|
|
||||||
pushd "%PUBLISH_DIR%"
|
|
||||||
for /f "delims=" %%F in ('dir /a /b') do (
|
|
||||||
if /I not "%%F"==".git" (
|
|
||||||
if exist "%%F" (
|
|
||||||
attrib -R "%%F" >nul 2>&1
|
|
||||||
rd /s /q "%%F" 2>nul
|
|
||||||
del /f /q "%%F" 2>nul
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo [Info] Copying dist to publish...
|
|
||||||
robocopy "%DIST_DIR%" "%PUBLISH_DIR%" *.* /E /NFL /NDL /NP /NJH /NJS >nul
|
|
||||||
if errorlevel 8 goto :fail
|
|
||||||
|
|
||||||
pushd "%PUBLISH_DIR%"
|
|
||||||
if defined GIT_USERNAME git config user.name "%GIT_USERNAME%"
|
|
||||||
if defined GIT_EMAIL git config user.email "%GIT_EMAIL%"
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
|
|
||||||
if "%COMMIT_MSG%"=="" set "COMMIT_MSG=Build: %DATE% %TIME%"
|
|
||||||
|
|
||||||
set "HAS_CHANGES=1"
|
|
||||||
git diff --cached --quiet
|
|
||||||
if not errorlevel 1 set "HAS_CHANGES=0"
|
|
||||||
|
|
||||||
if "%HAS_CHANGES%"=="0" (
|
|
||||||
echo [Info] No changes to commit; skipping push.
|
|
||||||
) else (
|
|
||||||
git commit -m "%COMMIT_MSG%"
|
|
||||||
if errorlevel 1 (
|
|
||||||
popd
|
|
||||||
goto :fail
|
|
||||||
)
|
|
||||||
git push origin "%BRANCH%"
|
|
||||||
if errorlevel 1 (
|
|
||||||
popd
|
|
||||||
goto :fail
|
|
||||||
)
|
|
||||||
echo [Info] Pushed to %REMOTE_URL% ^(branch %BRANCH%^).
|
|
||||||
)
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo [Success] Build and publish done.
|
|
||||||
exit /b 0
|
|
||||||
|
|
||||||
:npm_missing
|
|
||||||
echo [ERROR] npm not found. Please install Node.js.
|
|
||||||
goto :fail
|
|
||||||
|
|
||||||
:git_missing
|
|
||||||
echo [ERROR] git not found. Please install Git.
|
|
||||||
goto :fail
|
|
||||||
|
|
||||||
:no_dist
|
|
||||||
echo [ERROR] Dist directory not found: %DIST_DIR%
|
|
||||||
goto :fail
|
|
||||||
|
|
||||||
:gitfail
|
|
||||||
echo [ERROR] Git operation failed.
|
|
||||||
popd
|
|
||||||
goto :fail
|
|
||||||
|
|
||||||
:fail
|
|
||||||
exit /b 1
|
|
||||||
@@ -99,9 +99,9 @@ export default defineUserConfig({
|
|||||||
requiredMeta: ['nick']
|
requiredMeta: ['nick']
|
||||||
}),
|
}),
|
||||||
umamiAnalyticsPlugin({
|
umamiAnalyticsPlugin({
|
||||||
id: 'a4f0ca65-2da6-4e6b-a01b-f3b3157d05a3',
|
id: '2114ab32-5543-4be1-b5e8-c4f2c9269d0d',
|
||||||
link: 'https://umami.simengweb.com/script.js',
|
link: 'https://umami.simengweb.com/script.js',
|
||||||
domains: ['notes.simengweb.com'],
|
domains: ['www.simengweb.com'],
|
||||||
cache: true
|
cache: true
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 关于祀梦的花园
|
title: 关于祀梦与他的花园
|
||||||
description: 这里是爱与回忆的小世界~
|
description: 这里是爱与回忆的小世界~
|
||||||
hideInBlogList: true
|
hideInBlogList: true
|
||||||
article: false
|
article: false
|
||||||
@@ -7,36 +7,59 @@ createTime: 2024/10/29 12:30:00
|
|||||||
permalink: /about/
|
permalink: /about/
|
||||||
---
|
---
|
||||||
|
|
||||||
# 👋 这里是祀梦的小窝!
|
# 👋 嗨呀!这里是祀梦的小窝~
|
||||||
|
|
||||||
嗨~ 欢迎来到祀梦的个人博客,这是我在这个小站发布的第一篇文章哦~ (✧ω✧)
|
欢迎来到我的数字花园!这里不仅是笔记的存放处,更是我思维流转、技术成长与生活感悟的小小交汇点。希望能在这里和你分享温暖与美好~ (๑>◡<๑)
|
||||||
|
|
||||||
## 关于站长我呀~ 🌸
|
## 🏗️ 正在努力构建的未来~
|
||||||
|
|
||||||
我是祀梦,现在在上海某大专读书,是个可爱的男孩子~ 目前是信息安全专业的学生,但是超——级喜欢编程!(๑•̀ㅂ•́)و✧
|
目前我是一名大三的学生,主修**信息安全**专业。虽然专业背景在“守”,但我对“建”有着更浓厚的兴趣呢!
|
||||||
|
|
||||||
## 我的兴趣爱好~ 🌈
|
- **职业坐标**:目前正全力投入**后端开发**的学习中,正在努力准备实习,期待能在真实的代码世界里磨砺自己,成为厉害的后端大牛!(๑•̀ㅂ•́)و✧
|
||||||
|
- **技术理念**:我崇尚简洁、高效的代码,同时也相信技术的最终目的是为了传递温暖和解决问题。
|
||||||
|
|
||||||
我喜欢好多好多东西呀!编程、摄像、美食、旅游,还有画画~ 假期闲下来的时候,我会画一些自己喜欢的角色呢!(๑˘ᴗ˘๑)
|
## 🪴 为什么会有这个“花园”?
|
||||||
|
|
||||||
## 技术方面~ 💻
|
你可能会发现这个站点的结构非常清晰(或者说,我在努力让它变得整齐一些~)。
|
||||||
|
|
||||||
在技术方面,Python 是我最熟练的编程语言,Java 和 C 也懂一些,前后端开发和 Linux 运维我也会一点哦~ 虽然什么都感兴趣,什么都想学,但是总觉得自己不够聪明,学杂而不精呢... (╥ω╥)
|
在 2025 年末,我决定将原有的博客迁移到这个新家。原因很简单:**我需要一个更具结构化的空间来安放我的笔记**。从密码学理论到后端开发实战,从英语四级备考到算法练习,我希望知识能够像小植物一样,在合适的土壤里有序生长,方便自己翻阅,也能给路过的你一点点参考呀~ 🌸
|
||||||
|
|
||||||
## 为什么叫"祀梦"? 🌙
|
## 🚀 个人项目展示~
|
||||||
|
|
||||||
这个名字的由来超有趣!初中的时候我很喜欢写小说,"祀梦"是我其中一本小书的主角名字~ 当时我的初中同学聊天的时候说这个名字很好听,我就一直沿用下来啦!(๑´ㅂ`๑)
|
除了这个笔记站,我还维护着以下这些心血之作:
|
||||||
|
|
||||||
## 联系方式~ 📱
|
- [**祀梦的个人博客**](https://blog.simengweb.com/):我的感性领地,记录着生活故事与长长的技术思考。
|
||||||
|
- [**算法练习平台**](https://algorithmplatform.simengweb.com/):为了提升算法能力而开发的小平台,欢迎来一起刷题呀!(≧∇≦)ノ
|
||||||
|
|
||||||
如果您在网页访问过程中遇到什么问题,或者想要交个朋友的话,欢迎随时来找我玩哦~
|
## 🛠️ 祀梦的小技能树~ (〃'▽'〃)
|
||||||
- 邮箱:meng_si@proton.me
|
|
||||||
- B站:[66ccff色的薰依草](https://space.bilibili.com/361714249)
|
|
||||||
|
|
||||||
## 网站的成长记录~ 📝
|
虽然总觉得自己学得杂杂的,但每一项技能都是我用心收集的“宝藏”哦!
|
||||||
|
|
||||||
- 2025年9月21日:部署完网站
|
- **常用的魔法咒语**:Python (最熟练啦~), C++, Java, Solidity, JavaScript
|
||||||
|
- **探索过的奇幻领地**:后端开发、信息安全、区块链运维、Linux 系统管理 (。・ω・。)
|
||||||
|
- **随身携带的口袋工具**:Docker, Git, WSL2, Hardhat
|
||||||
|
|
||||||
## 写在最后~ 💌
|
## 📸 生活的彩色一角
|
||||||
|
|
||||||
很早之前我就总是喜欢写点东西,但是又不敢发到大的平台上,做一个属于自己的互联网小窝感觉真的超——级棒!希望大家能在这里找到有用的内容,也欢迎大家常来玩哦~ (づ ̄ 3 ̄)づ
|
在代码之外,我的世界也是五颜六色的:
|
||||||
|
|
||||||
|
- **超棒的朋友**:首页提到的“小小夏”是我非常要好的朋友。我们共同守护着这个数字花园的宁静。
|
||||||
|
- **我的小爱好**:我热爱摄像、美食与旅游。假期闲下来的时候,也会拿起画笔,勾勒出心里的角色呢~ (๑˘ᴗ˘๑)
|
||||||
|
- **关于我呀**:一个喜欢美好事物、偶尔有点小社恐、但在技术面前总能保持好奇心的男孩子。
|
||||||
|
|
||||||
|
## 🕰️ 网站的成长足迹
|
||||||
|
|
||||||
|
- **2025-12-15**:完成结构化迁移,给笔记们找了个舒服的新家。
|
||||||
|
- **2025-09-21**:笔记站初次部署。
|
||||||
|
- **2024-10-29**:在这个小站写下了第一段关于花园的文字。
|
||||||
|
|
||||||
|
## 💌 找我玩呀~
|
||||||
|
|
||||||
|
如果你对我的项目感兴趣,或者只是想聊聊技术与生活,欢迎随时联系:
|
||||||
|
|
||||||
|
- **邮箱**:[meng_si@proton.me](mailto:meng_si@proton.me)
|
||||||
|
- **B站**:[66ccff色的薰依草](https://space.bilibili.com/361714249)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> “在每一个文字里,都承载着温暖与美好。” 🌸
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: test
|
title: html 列表与语义布局
|
||||||
createTime: 2025/11/02 20:47:50
|
createTime: 2025/11/02 20:47:50
|
||||||
permalink: /programming/web/basic-syntax/html-lists-and-semantic-layout/
|
permalink: /programming/web/basic-syntax/html-lists-and-semantic-layout/
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ while (count <= 5) {
|
|||||||
|
|
||||||
## 函数
|
## 函数
|
||||||
|
|
||||||
函数是可重用的代码块,用于执行特定任务。
|
函数是一段可重复使用的代码块,可以接受输入(参数),执行操作,并返回输出(返回值)。
|
||||||
|
|
||||||
### 函数声明
|
### 函数声明
|
||||||
|
|
||||||
@@ -306,6 +306,15 @@ const message = greet("小明");
|
|||||||
console.log(message); // 输出:你好,小明!
|
console.log(message); // 输出:你好,小明!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
格式如下
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
function 函数名(参数1, 参数2, ...参数N) {
|
||||||
|
// 函数体:要执行的代码
|
||||||
|
return 返回值; // 可选
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 箭头函数(ES6)
|
### 箭头函数(ES6)
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
24
package-lock.json
generated
24
package-lock.json
generated
@@ -5573,9 +5573,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "3.14.1",
|
"version": "3.14.2",
|
||||||
"resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-3.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
||||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -5889,9 +5889,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-to-hast": {
|
"node_modules/mdast-util-to-hast": {
|
||||||
"version": "13.2.0",
|
"version": "13.2.1",
|
||||||
"resolved": "https://registry.npmmirror.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
|
||||||
"integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==",
|
"integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -7668,9 +7668,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "7.0.7",
|
"version": "7.0.8",
|
||||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-7.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.0.8.tgz",
|
||||||
"integrity": "sha512-hc6LujN/EkJHmxeiDJMs0qBontZ1cdBvvoCbWhVjzUFTU329VRyOC46gHNSA8NcOC5yzCeXpwI40tieI3DEZqg==",
|
"integrity": "sha512-cJBdq0/u+8rgstg9t7UkBilf8ipLmeXJO30NxD5HAHOivnj10ocV8YtR/XBvd2wQpN3TmcaxNKaHX3tN7o5F5A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -8124,9 +8124,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vuepress-theme-plume/node_modules/js-yaml": {
|
"node_modules/vuepress-theme-plume/node_modules/js-yaml": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmmirror.com/js-yaml/-/js-yaml-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"node": "^20.6.0 || >=22.0.0"
|
"node": "^20.6.0 || >=22.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docs:dev": "vuepress dev docs --port 4567",
|
"docs:dev": "vuepress dev docs",
|
||||||
"docs:dev-clean": "vuepress dev docs --clean-cache --clean-temp --port 4567",
|
"docs:dev-clean": "vuepress dev docs --clean-cache --clean-temp",
|
||||||
"docs:build": "vuepress build docs --clean-cache --clean-temp",
|
"docs:build": "vuepress build docs --clean-cache --clean-temp",
|
||||||
"docs:preview": "http-server docs/.vuepress/dist",
|
"docs:preview": "http-server docs/.vuepress/dist",
|
||||||
"vp-update": "npx vp-update"
|
"vp-update": "npx vp-update"
|
||||||
|
|||||||
149
script/build-and-publish.bat
Normal file
149
script/build-and-publish.bat
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM Configuration
|
||||||
|
REM ==========================================
|
||||||
|
chcp 65001 >nul
|
||||||
|
|
||||||
|
REM Move to project root
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
set "PROJECT_DIR=%CD%\"
|
||||||
|
|
||||||
|
set "DIST_DIR=%PROJECT_DIR%docs\.vuepress\dist"
|
||||||
|
set "CACHE_DIR=%PROJECT_DIR%docs\.vuepress\.cache"
|
||||||
|
set "TEMP_DIR=%PROJECT_DIR%docs\.vuepress\.temp"
|
||||||
|
set "PUBLISH_DIR=%PROJECT_DIR%_publish"
|
||||||
|
set "REMOTE_URL=https://gitea.simengweb.com/si-meng-spec/build_notes_simengweb.git"
|
||||||
|
set "BRANCH=main"
|
||||||
|
|
||||||
|
REM High memory limit for better performance/stability (8GB)
|
||||||
|
set "NODE_OPTIONS=--max-old-space-size=8192"
|
||||||
|
|
||||||
|
REM Args
|
||||||
|
set "COMMIT_MSG=%~1"
|
||||||
|
if "%COMMIT_MSG%"=="" set "COMMIT_MSG=Build: %DATE% %TIME%"
|
||||||
|
|
||||||
|
echo ==========================================
|
||||||
|
echo Start Build and Publish
|
||||||
|
echo Project Dir: %PROJECT_DIR%
|
||||||
|
echo Memory Limit: 8192 MB
|
||||||
|
echo ==========================================
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM 1. Cleanup
|
||||||
|
REM ==========================================
|
||||||
|
echo [1/5] Cleaning up old artifacts...
|
||||||
|
|
||||||
|
if exist "%DIST_DIR%" (
|
||||||
|
echo - Removing %DIST_DIR%
|
||||||
|
rd /s /q "%DIST_DIR%"
|
||||||
|
)
|
||||||
|
if exist "%CACHE_DIR%" (
|
||||||
|
echo - Removing %CACHE_DIR%
|
||||||
|
rd /s /q "%CACHE_DIR%"
|
||||||
|
)
|
||||||
|
if exist "%TEMP_DIR%" (
|
||||||
|
echo - Removing %TEMP_DIR%
|
||||||
|
rd /s /q "%TEMP_DIR%"
|
||||||
|
)
|
||||||
|
REM Clean node_modules for a fresh install every time (Ensures clean state)
|
||||||
|
if exist "%PROJECT_DIR%node_modules" (
|
||||||
|
echo - Removing node_modules (Fresh Install Mode)
|
||||||
|
rd /s /q "%PROJECT_DIR%node_modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM 2. Install Dependencies
|
||||||
|
REM ==========================================
|
||||||
|
echo [2/5] Installing dependencies (npm ci)...
|
||||||
|
call npm ci
|
||||||
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
echo [Error] npm ci failed.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM 3. Build
|
||||||
|
REM ==========================================
|
||||||
|
echo [3/5] Building docs...
|
||||||
|
call npm run docs:build
|
||||||
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
echo [Error] Build failed.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%DIST_DIR%" (
|
||||||
|
echo [Error] Dist directory not found after build.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM 4. Prepare Publish Directory
|
||||||
|
REM ==========================================
|
||||||
|
echo [4/5] Preparing publish directory...
|
||||||
|
|
||||||
|
if not exist "%PUBLISH_DIR%\.git" (
|
||||||
|
echo - Cloning publish repo...
|
||||||
|
if exist "%PUBLISH_DIR%" rd /s /q "%PUBLISH_DIR%"
|
||||||
|
git clone "%REMOTE_URL%" "%PUBLISH_DIR%"
|
||||||
|
if !ERRORLEVEL! NEQ 0 exit /b 1
|
||||||
|
) else (
|
||||||
|
echo - Updating publish repo...
|
||||||
|
pushd "%PUBLISH_DIR%"
|
||||||
|
git fetch --all
|
||||||
|
git checkout "%BRANCH%"
|
||||||
|
git reset --hard "origin/%BRANCH%"
|
||||||
|
popd
|
||||||
|
)
|
||||||
|
|
||||||
|
echo - Cleaning publish directory content (preserving .git)...
|
||||||
|
pushd "%PUBLISH_DIR%"
|
||||||
|
for /f "delims=" %%F in ('dir /a /b') do (
|
||||||
|
if /I not "%%F"==".git" (
|
||||||
|
if exist "%%F" (
|
||||||
|
attrib -R "%%F" >nul 2>&1
|
||||||
|
rd /s /q "%%F" 2>nul
|
||||||
|
del /f /q "%%F" 2>nul
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo - Copying new build artifacts...
|
||||||
|
robocopy "%DIST_DIR%" "%PUBLISH_DIR%" *.* /E /NFL /NDL /NP /NJH /NJS >nul
|
||||||
|
if %ERRORLEVEL% GEQ 8 (
|
||||||
|
echo [Error] Robocopy failed.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ==========================================
|
||||||
|
REM 5. Push to Remote
|
||||||
|
REM ==========================================
|
||||||
|
echo [5/5] Pushing changes...
|
||||||
|
pushd "%PUBLISH_DIR%"
|
||||||
|
|
||||||
|
if defined GIT_USERNAME git config user.name "%GIT_USERNAME%"
|
||||||
|
if defined GIT_EMAIL git config user.email "%GIT_EMAIL%"
|
||||||
|
|
||||||
|
git add -A
|
||||||
|
git diff --cached --quiet
|
||||||
|
if %ERRORLEVEL% EQU 0 (
|
||||||
|
echo [Info] No changes to commit.
|
||||||
|
) else (
|
||||||
|
git commit -m "%COMMIT_MSG%"
|
||||||
|
echo - Pushing to %BRANCH%...
|
||||||
|
git push origin "%BRANCH%"
|
||||||
|
if !ERRORLEVEL! NEQ 0 (
|
||||||
|
echo [Error] Git push failed.
|
||||||
|
popd
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
echo [Success] Pushed successfully.
|
||||||
|
)
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo ==========================================
|
||||||
|
echo All Done!
|
||||||
|
echo ==========================================
|
||||||
|
exit /b 0
|
||||||
3
script/start.bat
Normal file
3
script/start.bat
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
||||||
1
start.sh → script/start.sh
Executable file → Normal file
1
start.sh → script/start.sh
Executable file → Normal file
@@ -1 +1,2 @@
|
|||||||
|
cd "$(dirname "$0")/.."
|
||||||
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
npm run docs:dev -- --host 0.0.0.0 --port 8888
|
||||||
59
start.bat
59
start.bat
@@ -1,59 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal ENABLEDELAYEDEXPANSION
|
|
||||||
|
|
||||||
REM Usage:
|
|
||||||
REM start.bat [host] [port]
|
|
||||||
REM Examples:
|
|
||||||
REM start.bat -> try 0.0.0.0:4567, fallback to localhost and 5173
|
|
||||||
REM start.bat local 8080 -> localhost:8080
|
|
||||||
REM start.bat lan 4567 -> 0.0.0.0:4567
|
|
||||||
|
|
||||||
set HOST=%~1
|
|
||||||
if "%HOST%"=="" set HOST=0.0.0.0
|
|
||||||
if /I "%HOST%"=="lan" set HOST=0.0.0.0
|
|
||||||
if /I "%HOST%"=="local" set HOST=localhost
|
|
||||||
|
|
||||||
set PORT=%~2
|
|
||||||
if "%PORT%"=="" set PORT=4567
|
|
||||||
set FALLBACK_PORT=5173
|
|
||||||
|
|
||||||
echo [Start] VuePress dev on host %HOST% port %PORT%
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host %HOST% --port %PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 goto success
|
|
||||||
|
|
||||||
REM Fallback 1: switch to localhost same port
|
|
||||||
if NOT "%HOST%"=="localhost" (
|
|
||||||
echo [Fallback] switch to localhost on same port %PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host localhost --port %PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 goto success
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Fallback 2: clean cache and use localhost on fallback port
|
|
||||||
if NOT "%PORT%"=="%FALLBACK_PORT%" (
|
|
||||||
echo [Fallback] clean cache and start on localhost:%FALLBACK_PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --clean-cache --clean-temp --host localhost --port %FALLBACK_PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
set HOST=localhost
|
|
||||||
set PORT=%FALLBACK_PORT%
|
|
||||||
goto success
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Fallback 3: try another common port
|
|
||||||
set ALT_PORT=8080
|
|
||||||
if NOT "%PORT%"=="%ALT_PORT%" (
|
|
||||||
echo [Fallback] try localhost:%ALT_PORT%...
|
|
||||||
call npx vuepress@2.0.0-rc.24 dev docs --host localhost --port %ALT_PORT%
|
|
||||||
if %ERRORLEVEL% EQU 0 (
|
|
||||||
set HOST=localhost
|
|
||||||
set PORT=%ALT_PORT%
|
|
||||||
goto success
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
echo [Error] Failed to start dev server. Please check firewall or port usage.
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:success
|
|
||||||
echo [Ready] Open http://localhost:%PORT%/ (or http://%HOST%:%PORT%/ if accessible)
|
|
||||||
exit /b 0
|
|
||||||
Reference in New Issue
Block a user