Skip to content

Commit 74246d4

Browse files
committed
update:structure
1 parent 6866741 commit 74246d4

Some content is hidden

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

54 files changed

+1316
-507
lines changed

.github/workflows/deploy.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ name: Build and Deploy to GitHub Pages
33
on:
44
push:
55
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
6+
paths:
7+
- 'src/**'
8+
- 'package*.json'
9+
- 'build.js'
10+
workflow_dispatch: # 允许手动触发工作流
811

912
jobs:
1013
build-and-deploy:
@@ -26,10 +29,16 @@ jobs:
2629
- name: Build website
2730
run: npm run build
2831

32+
- name: Setup Pages
33+
uses: actions/configure-pages@v4
34+
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./public
39+
2940
- name: Deploy to GitHub Pages
3041
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
31-
uses: peaceiris/actions-gh-pages@v3
42+
uses: actions/deploy-pages@v4
3243
with:
33-
github_token: ${{ secrets.GITHUB_TOKEN }}
34-
publish_dir: ./public
35-
publish_branch: gh-pages
44+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules/
44
# Build outputs
55
dist/
66
build/
7+
public/
78
.nyc_output/
89
coverage/
910

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,26 @@ This repository contains the source code for the Rockchip AI Lab website, built
66

77
```
88
Rockchip-AI-Lab/
9+
├── dist/ # Distribution directory
10+
├── img/ # Image assets
11+
├── node_modules/ # Node.js dependencies
912
├── public/ # Built website files (deployed to GitHub Pages)
1013
├── src/ # Source files
11-
│ ├── pages/ # HTML pages (Home, CV, LLM, VLM, UI)
1214
│ ├── 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
1329
│ └── styles.css # Main stylesheet
1430
├── .github/workflows/ # GitHub Actions workflows
1531
├── build.js # Build script
@@ -26,7 +42,7 @@ The website includes the following pages:
2642
- Visual Language Models (VLM)
2743
- User Interface (UI)
2844

29-
Each page features information about Rockchip processors RK3588 and RK1820 at the top.
45+
Each page allows users to select between Rockchip processors RK3588 and RK1820, and dynamically loads relevant content from the corresponding content directories.
3046

3147
## Development
3248

@@ -47,6 +63,11 @@ To run the project locally:
4763
npm start
4864
```
4965

66+
4. For development with auto-rebuild:
67+
```bash
68+
npm run dev
69+
```
70+
5071
## Deployment
5172

5273
The website is automatically deployed to GitHub Pages using GitHub Actions when changes are pushed to the `main` branch.

build.js

Lines changed: 73 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -5,176 +5,95 @@ const path = require('path');
55
const srcDir = './src';
66
const publicDir = './public';
77

8-
// Create public directory if it doesn't exist
8+
// Ensure public directory exists with images subdirectory
99
if (!fs.existsSync(publicDir)) {
1010
fs.mkdirSync(publicDir, { recursive: true });
1111
}
1212

13-
// Copy HTML files from src/pages to public
14-
const pagesDir = path.join(srcDir, 'pages');
15-
const files = fs.readdirSync(pagesDir);
16-
17-
files.forEach(file => {
18-
if (path.extname(file) === '.html') {
19-
const srcPath = path.join(pagesDir, file);
20-
const destPath = path.join(publicDir, file);
21-
22-
let content = fs.readFileSync(srcPath, 'utf8');
23-
24-
// Update relative paths to work from public directory
25-
content = content.replace(/\.\.\/styles\.css/g, 'styles.css');
26-
content = content.replace(/\.\.\/components/g, 'components');
27-
28-
fs.writeFileSync(destPath, content);
29-
console.log(`Copied ${file} to public directory`);
30-
}
31-
});
32-
33-
// Copy CSS file
34-
const cssSrc = path.join(srcDir, 'styles.css');
35-
const cssDest = path.join(publicDir, 'styles.css');
36-
if (fs.existsSync(cssSrc)) {
37-
fs.copyFileSync(cssSrc, cssDest);
38-
console.log('Copied styles.css to public directory');
39-
} else {
40-
// Create a default styles.css if it doesn't exist
41-
const defaultCSS = `
42-
/* Global Styles */
43-
body {
44-
font-family: 'Arial', sans-serif;
45-
margin: 0;
46-
padding: 0;
47-
background-color: #f5f5f5;
48-
color: #333;
13+
if (!fs.existsSync(path.join(publicDir, 'images'))) {
14+
fs.mkdirSync(path.join(publicDir, 'images'), { recursive: true });
4915
}
5016

51-
/* Navigation Styles */
52-
.navbar {
53-
background-color: #2c3e50;
54-
padding: 1rem 0;
55-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
56-
}
57-
58-
.nav-container {
59-
max-width: 1200px;
60-
margin: 0 auto;
61-
display: flex;
62-
justify-content: space-between;
63-
align-items: center;
64-
padding: 0 2rem;
65-
}
66-
67-
.nav-logo {
68-
color: white;
69-
font-size: 1.5rem;
70-
text-decoration: none;
71-
font-weight: bold;
72-
}
73-
74-
.nav-menu {
75-
display: flex;
76-
list-style: none;
77-
margin: 0;
78-
padding: 0;
79-
}
80-
81-
.nav-item {
82-
margin-left: 2rem;
83-
}
84-
85-
.nav-link {
86-
color: white;
87-
text-decoration: none;
88-
transition: color 0.3s;
89-
}
90-
91-
.nav-link:hover {
92-
color: #3498db;
93-
}
94-
95-
/* RK Chips Header */
96-
.rk-chips-header {
97-
background-color: #ecf0f1;
98-
padding: 1rem 2rem;
99-
display: flex;
100-
justify-content: space-around;
101-
border-bottom: 1px solid #bdc3c7;
102-
}
17+
// Copy HTML, CSS, JS files to public
18+
copyFileToPublic('index.html');
19+
copyFileToPublic('styles.css');
10320

104-
.rk-chip {
105-
text-align: center;
106-
padding: 1rem;
107-
background-color: white;
108-
border-radius: 8px;
109-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
110-
width: 45%;
111-
}
112-
113-
.rk-chip h3 {
114-
margin: 0 0 0.5rem 0;
115-
color: #2c3e50;
116-
}
117-
118-
/* Container for page content */
119-
.container {
120-
max-width: 1200px;
121-
margin: 2rem auto;
122-
padding: 0 2rem;
123-
background-color: white;
124-
border-radius: 8px;
125-
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
126-
padding: 2rem;
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');
12753
}
12854

129-
h1 {
130-
color: #2c3e50;
131-
border-bottom: 2px solid #3498db;
132-
padding-bottom: 0.5rem;
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+
}
13366
}
13467

135-
/* Responsive adjustments */
136-
@media (max-width: 768px) {
137-
.nav-container {
138-
flex-direction: column;
139-
padding: 1rem;
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;
14073
}
14174

142-
.nav-menu {
143-
margin-top: 1rem;
75+
if (!fs.existsSync(dest)) {
76+
fs.mkdirSync(dest, { recursive: true });
14477
}
14578

146-
.nav-item {
147-
margin: 0 1rem;
148-
}
149-
150-
.rk-chips-header {
151-
flex-direction: column;
152-
}
79+
const items = fs.readdirSync(src);
15380

154-
.rk-chip {
155-
width: 100%;
156-
margin-bottom: 1rem;
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+
}
15792
}
15893
}
159-
`;
160-
fs.writeFileSync(cssDest, defaultCSS);
161-
console.log('Created default styles.css in public directory');
162-
}
163-
164-
// Copy components directory
165-
const componentsSrc = path.join(srcDir, 'components');
166-
const componentsDest = path.join(publicDir, 'components');
167-
168-
if (!fs.existsSync(componentsDest)) {
169-
fs.mkdirSync(componentsDest, { recursive: true });
170-
}
171-
172-
const componentFiles = fs.readdirSync(componentsSrc);
173-
componentFiles.forEach(file => {
174-
const srcPath = path.join(componentsSrc, file);
175-
const destPath = path.join(componentsDest, file);
176-
fs.copyFileSync(srcPath, destPath);
177-
console.log(`Copied ${file} to public/components directory`);
178-
});
17994

180-
console.log('Build completed successfully!');
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+
}

public/components/navigation.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

public/components/rkChipsHeader.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)