Skip to content

Commit 90900b0

Browse files
authored
Merge pull request #1 from LJ-Hao/main
update
2 parents 3af4d47 + ba8ffcb commit 90900b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3082
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'src/**'
8+
- 'package*.json'
9+
- 'build.js'
10+
schedule:
11+
# 每天 UTC 时间 2 点运行 (相当于北京时间晚上 10 点)
12+
- cron: '0 2 * * *'
13+
workflow_dispatch: # 允许手动触发工作流
14+
15+
# Set permissions for GitHub Actions
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow one concurrent deployment
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build-and-deploy:
28+
runs-on: ubuntu-latest
29+
environment:
30+
name: github-pages
31+
url: ${{ steps.deployment.outputs.page_url }}
32+
permissions:
33+
contents: read
34+
pages: write
35+
id-token: write
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '18'
45+
cache: 'npm'
46+
47+
- name: Install dependencies
48+
run: npm ci
49+
50+
- name: Build website
51+
run: npm run build
52+
53+
- name: Setup Pages
54+
uses: actions/configure-pages@v4
55+
continue-on-error: true # 允许错误继续执行
56+
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: ./public
61+
62+
- name: Deploy to GitHub Pages
63+
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
64+
uses: actions/deploy-pages@v4
65+
continue-on-error: true # 允许错误继续执行
66+
with:
67+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
dist/
6+
build/
7+
public/
8+
.nyc_output/
9+
coverage/
10+
11+
# Environment variables
12+
.env
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
# IDE files
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS generated files
26+
.DS_Store
27+
.DS_Store?
28+
._*
29+
.Spotlight-V100
30+
.Trashes
31+
ehthumbs.db
32+
Thumbs.db
33+
34+
# Logs
35+
logs/
36+
*.log
37+
38+
# Runtime data
39+
pids/
40+
*.pid
41+
*.seed
42+
*.pid.lock
43+
44+
# Coverage directory used by tools like istanbul
45+
coverage/
46+
47+
# Temporary folders
48+
tmp/
49+
temp/
50+
51+
# npm debug log
52+
npm-debug.log*
53+
yarn-debug.log*
54+
yarn-error.log*
55+
56+
# Local development server
57+
.sass-cache/
58+
connect.lock
59+
.nodemon
60+
.hypermodules/
61+
62+
# Editor temporary files
63+
*.tmp
64+
*.bak
65+
*.orig
66+
67+
# GitHub
68+
# Ignore everything in .github except workflows
69+
.github/*
70+
!.github/workflows/

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# Rockchip-AI-Lab
1+
# Rockchip AI Lab Website
2+
3+
This repository contains the source code for the Rockchip AI Lab website, built with HTML, CSS, and JavaScript.
4+
5+
## Project Structure
6+
7+
```
8+
Rockchip-AI-Lab/
9+
├── dist/ # Distribution directory
10+
├── img/ # Image assets
11+
├── node_modules/ # Node.js dependencies
12+
├── public/ # Built website files (deployed to GitHub Pages)
13+
├── src/ # Source files
14+
│ ├── components/ # Reusable components (navigation, RK chips header)
15+
│ ├── content/ # Content files organized by chip model and AI field
16+
│ │ ├── rk1820/ # Content for RK1820 chip
17+
│ │ │ ├── cv/ # Computer Vision content
18+
│ │ │ ├── llm/ # Large Language Model content
19+
│ │ │ ├── ui/ # User Interface content
20+
│ │ │ └── vlm/ # Visual Language Model content
21+
│ │ └── rk3588/ # Content for RK3588 chip
22+
│ │ ├── cv/ # Computer Vision content
23+
│ │ ├── llm/ # Large Language Model content
24+
│ │ ├── ui/ # User Interface content
25+
│ │ └── vlm/ # Visual Language Model content
26+
│ ├── js/ # JavaScript files
27+
│ ├── pages/ # HTML pages (Home, CV, LLM, VLM, UI)
28+
│ ├── index.html # Main HTML file
29+
│ └── styles.css # Main stylesheet
30+
├── .github/workflows/ # GitHub Actions workflows
31+
├── build.js # Build script
32+
├── package.json # Project configuration
33+
└── README.md # This file
34+
```
35+
36+
## Pages
37+
38+
The website includes the following pages:
39+
- Home
40+
- Computer Vision (CV)
41+
- Large Language Models (LLM)
42+
- Visual Language Models (VLM)
43+
- User Interface (UI)
44+
45+
Each page allows users to select between Rockchip processors RK3588 and RK1820, and dynamically loads relevant content from the corresponding content directories.
46+
47+
## Development
48+
49+
To run the project locally:
50+
51+
1. Install dependencies:
52+
```bash
53+
npm install
54+
```
55+
56+
2. Build the website:
57+
```bash
58+
npm run build
59+
```
60+
61+
3. Start a local server:
62+
```bash
63+
npm start
64+
```
65+
66+
4. For development with auto-rebuild:
67+
```bash
68+
npm run dev
69+
```
70+
71+
## Deployment
72+
73+
The website is automatically deployed to GitHub Pages using GitHub Actions when changes are pushed to the `main` branch.

build.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
// Define source and destination directories
5+
const srcDir = './src';
6+
const publicDir = './public';
7+
8+
// Ensure public directory exists with images subdirectory
9+
if (!fs.existsSync(publicDir)) {
10+
fs.mkdirSync(publicDir, { recursive: true });
11+
}
12+
13+
if (!fs.existsSync(path.join(publicDir, 'images'))) {
14+
fs.mkdirSync(path.join(publicDir, 'images'), { recursive: true });
15+
}
16+
17+
// Copy HTML, CSS, JS files to public
18+
copyFileToPublic('index.html');
19+
copyFileToPublic('styles.css');
20+
21+
// Copy JavaScript files
22+
const jsSrcDir = path.join(srcDir, 'js');
23+
const jsDestDir = path.join(publicDir, 'js');
24+
if (fs.existsSync(jsSrcDir)) {
25+
// Remove old js directory if it exists
26+
if (fs.existsSync(jsDestDir)) {
27+
fs.rmSync(jsDestDir, { recursive: true, force: true });
28+
}
29+
30+
fs.mkdirSync(jsDestDir, { recursive: true });
31+
const jsFiles = fs.readdirSync(jsSrcDir);
32+
jsFiles.forEach(file => {
33+
const srcPath = path.join(jsSrcDir, file);
34+
const destPath = path.join(jsDestDir, file);
35+
if (fs.statSync(srcPath).isFile()) {
36+
fs.copyFileSync(srcPath, destPath);
37+
console.log(`Copied ${file} to public/js directory`);
38+
}
39+
});
40+
}
41+
42+
// Copy content files (RK3588 and RK1820 documentation)
43+
const contentSrcDir = path.join(srcDir, 'content');
44+
const contentDestDir = path.join(publicDir, 'content');
45+
if (fs.existsSync(contentSrcDir)) {
46+
// Remove old content directory if it exists
47+
if (fs.existsSync(contentDestDir)) {
48+
fs.rmSync(contentDestDir, { recursive: true, force: true });
49+
}
50+
51+
copyDirectory(contentSrcDir, contentDestDir);
52+
console.log('Copied content directory to public/content');
53+
}
54+
55+
// Helper function to copy a single file to public
56+
function copyFileToPublic(fileName) {
57+
const srcPath = path.join(srcDir, fileName);
58+
const destPath = path.join(publicDir, fileName);
59+
60+
if (fs.existsSync(srcPath)) {
61+
fs.copyFileSync(srcPath, destPath);
62+
console.log(`Copied ${fileName} to public directory`);
63+
} else {
64+
console.log(`${fileName} does not exist in src directory`);
65+
}
66+
}
67+
68+
// Helper function to recursively copy directories
69+
function copyDirectory(src, dest) {
70+
if (!fs.existsSync(src)) {
71+
console.log(`Source directory does not exist: ${src}`);
72+
return;
73+
}
74+
75+
if (!fs.existsSync(dest)) {
76+
fs.mkdirSync(dest, { recursive: true });
77+
}
78+
79+
const items = fs.readdirSync(src);
80+
81+
for (const item of items) {
82+
const srcPath = path.join(src, item);
83+
const destPath = path.join(dest, item);
84+
85+
const stat = fs.statSync(srcPath);
86+
87+
if (stat.isDirectory()) {
88+
copyDirectory(srcPath, destPath);
89+
} else {
90+
fs.copyFileSync(srcPath, destPath);
91+
}
92+
}
93+
}
94+
95+
console.log('Build completed successfully!');
96+
console.log('Files in public/:', fs.readdirSync(publicDir));
97+
if (fs.existsSync(path.join(publicDir, 'content'))) {
98+
console.log('Content directories:', fs.readdirSync(path.join(publicDir, 'content')));
99+
}

0 commit comments

Comments
 (0)