feat(project): 创建基础项目架构,上传基础架构文件 feat(CI): 提供.drone.yml,可以用于对后续更新配置文件做CI验证 feat(image): 完成镜像搭建knowai-nuxt-base:1.0.0,上传对应Dockerfile
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
102
.drone.yml
Normal file
102
.drone.yml
Normal file
@@ -0,0 +1,102 @@
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: verify-nuxt-config
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- architecture-nuxt3
|
||||
event:
|
||||
- push
|
||||
|
||||
environment:
|
||||
NUXT_PORT: 3000
|
||||
HEALTH_CHECK_TIMEOUT: 30
|
||||
|
||||
volumes:
|
||||
- name: node_modules_cache
|
||||
emptyDir: {}
|
||||
- name: repo-volume
|
||||
emptyDir: {}
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
# 0️⃣ clone代码覆盖
|
||||
- name: clone
|
||||
image: alpine/git:latest
|
||||
environment:
|
||||
CA_CRT:
|
||||
from_secret: ca-crt
|
||||
commands:
|
||||
- apk add --no-cache ca-certificates
|
||||
- echo "$CA_CRT" > /etc/ssl/certs/ca.crt
|
||||
- update-ca-certificates
|
||||
- git clone https://gitea.local.knowai/tobegold574/knowai.git /drone/src
|
||||
- cd /drone/src
|
||||
- git checkout ${DRONE_BRANCH}
|
||||
- echo "✅ 当前分支:$(git rev-parse --abbrev-ref HEAD)"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
|
||||
# 1️⃣ 准备环境
|
||||
- name: prepare-environment
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
commands:
|
||||
- cd /drone/src/knowai-nuxt
|
||||
- echo "🚀 验证Nuxt基础环境..."
|
||||
- node --version
|
||||
- npm --version
|
||||
- npx nuxt --version || true
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
|
||||
# 2️⃣ 安装依赖
|
||||
- name: install-dependencies
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
commands:
|
||||
- cd /drone/src/knowai-nuxt
|
||||
- echo "📦 安装项目依赖..."
|
||||
- npm ci --prefer-offline --progress=false
|
||||
- echo "✅ 依赖安装完成"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
|
||||
# 3️⃣ 构建验证
|
||||
- name: build-verification
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
commands:
|
||||
- cd /drone/src/knowai-nuxt
|
||||
- echo "🔨 验证构建过程..."
|
||||
- npm run build
|
||||
- echo "✅ 构建验证通过"
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
|
||||
# 4️⃣ 启动服务并检查运行状态
|
||||
- name: service-start-check
|
||||
image: gitea.local.knowai/tobegold574/knowai-nuxt-base:1.0.0
|
||||
commands:
|
||||
- cd /drone/src/knowai-nuxt
|
||||
- echo "🌐 启动 Nuxt 服务..."
|
||||
- npm run start &
|
||||
- sleep 10
|
||||
- |
|
||||
if ps aux | grep -v grep | grep "nuxt" > /dev/null; then
|
||||
echo "✅ Nuxt 服务启动成功"
|
||||
else
|
||||
echo "❌ Nuxt 服务启动失败"
|
||||
exit 1
|
||||
volumeMounts:
|
||||
- name: repo-volume
|
||||
mountPath: /drone/src
|
||||
- name: node_modules_cache
|
||||
mountPath: /drone/src/node_modules
|
||||
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
# ------------------------------------------------
|
||||
# 基础镜像:Node LTS(Debian trixie-slim)
|
||||
# ------------------------------------------------
|
||||
FROM node:lts-trixie-slim
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# ------------------------------------------------
|
||||
# 安装全局依赖:框架生态核心模块
|
||||
# ------------------------------------------------
|
||||
RUN npm install -g \
|
||||
nuxt \
|
||||
@pinia/nuxt \
|
||||
@element-plus/nuxt \
|
||||
@nuxtjs/tailwindcss
|
||||
|
||||
# ------------------------------------------------
|
||||
# 暴露端口(Nuxt 默认 3000)
|
||||
# ------------------------------------------------
|
||||
EXPOSE 3000
|
||||
|
||||
# ------------------------------------------------
|
||||
# 默认进入 shell(或可改为 nuxt dev)
|
||||
# ------------------------------------------------
|
||||
CMD ["bash"]
|
||||
26
README.md
26
README.md
@@ -5,25 +5,15 @@
|
||||
|
||||
## 具体负责内容
|
||||
|
||||
### 1. 配置文件管理
|
||||
- `nuxt.config.ts` - Nuxt构建配置、插件配置
|
||||
- `tsconfig.json` - TypeScript类型检查规则
|
||||
- `package.json` - 核心依赖版本锁定
|
||||
### 1. 基础环境镜像
|
||||
- Docker基础镜像(Node + Nuxt + Vue核心环境)
|
||||
- 核心依赖版本锁定和标准化
|
||||
- 基础构建配置模板
|
||||
|
||||
### 2. 全局类型定义
|
||||
- `types/global.d.ts` - 全局接口、类型定义
|
||||
- API响应类型规范
|
||||
- 业务数据模型定义
|
||||
|
||||
### 3. 核心工具函数
|
||||
- `utils/request.ts` - HTTP请求封装
|
||||
- `utils/date.ts` - 日期格式化工具
|
||||
- `utils/validate.ts` - 通用验证函数
|
||||
|
||||
### 4. 样式系统基础
|
||||
- `assets/scss/variables.scss` - 设计系统变量
|
||||
- 主题配色方案
|
||||
- 响应式断点定义
|
||||
### 2. 配置文件模板
|
||||
- `nuxt.config.ts` - Nuxt构建配置模板
|
||||
- `tsconfig.json` - TypeScript配置模板
|
||||
- 其他基础配置文件模板
|
||||
|
||||
## 更新记录
|
||||
|
||||
|
||||
24
knowai-nuxt/.gitignore
vendored
Normal file
24
knowai-nuxt/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
75
knowai-nuxt/README.md
Normal file
75
knowai-nuxt/README.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Nuxt Minimal Starter
|
||||
|
||||
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
||||
|
||||
## Setup
|
||||
|
||||
Make sure to install dependencies:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm install
|
||||
|
||||
# pnpm
|
||||
pnpm install
|
||||
|
||||
# yarn
|
||||
yarn install
|
||||
|
||||
# bun
|
||||
bun install
|
||||
```
|
||||
|
||||
## Development Server
|
||||
|
||||
Start the development server on `http://localhost:3000`:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run dev
|
||||
|
||||
# pnpm
|
||||
pnpm dev
|
||||
|
||||
# yarn
|
||||
yarn dev
|
||||
|
||||
# bun
|
||||
bun run dev
|
||||
```
|
||||
|
||||
## Production
|
||||
|
||||
Build the application for production:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run build
|
||||
|
||||
# pnpm
|
||||
pnpm build
|
||||
|
||||
# yarn
|
||||
yarn build
|
||||
|
||||
# bun
|
||||
bun run build
|
||||
```
|
||||
|
||||
Locally preview production build:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run preview
|
||||
|
||||
# pnpm
|
||||
pnpm preview
|
||||
|
||||
# yarn
|
||||
yarn preview
|
||||
|
||||
# bun
|
||||
bun run preview
|
||||
```
|
||||
|
||||
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
||||
6
knowai-nuxt/app/app.vue
Normal file
6
knowai-nuxt/app/app.vue
Normal file
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<NuxtRouteAnnouncer />
|
||||
<NuxtWelcome />
|
||||
</div>
|
||||
</template>
|
||||
5
knowai-nuxt/nuxt.config.ts
Normal file
5
knowai-nuxt/nuxt.config.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2025-07-15',
|
||||
devtools: { enabled: true }
|
||||
})
|
||||
9742
knowai-nuxt/package-lock.json
generated
Normal file
9742
knowai-nuxt/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
knowai-nuxt/package.json
Normal file
17
knowai-nuxt/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "knowai-nuxt",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "^4.2.0",
|
||||
"vue": "^3.5.22",
|
||||
"vue-router": "^4.6.3"
|
||||
}
|
||||
}
|
||||
BIN
knowai-nuxt/public/favicon.ico
Normal file
BIN
knowai-nuxt/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
2
knowai-nuxt/public/robots.txt
Normal file
2
knowai-nuxt/public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow:
|
||||
18
knowai-nuxt/tsconfig.json
Normal file
18
knowai-nuxt/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
// https://nuxt.com/docs/guide/concepts/typescript
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./.nuxt/tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./.nuxt/tsconfig.server.json"
|
||||
},
|
||||
{
|
||||
"path": "./.nuxt/tsconfig.shared.json"
|
||||
},
|
||||
{
|
||||
"path": "./.nuxt/tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user