Skip to content

Commit 94a153f

Browse files
committed
Initial
1 parent ec97ded commit 94a153f

64 files changed

Lines changed: 8429 additions & 4346 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ jobs:
1313
uses: actions/checkout@v3
1414

1515
- uses: actions/setup-node@v3
16-
with:
17-
node-version: 18
18-
cache: yarn
19-
20-
- run: yarn install --frozen-lockfile
16+
- run: npm install
2117

2218
- name: Build
23-
run: yarn docs:build
19+
run: npm run docs:build
2420

2521
- name: Deploy to GitHub Pages
2622
uses: peaceiris/actions-gh-pages@v3

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
```bash
77
# Install dependencies
8-
yarn
8+
npm i
99

1010
# Dev mode
11-
yarn docs:dev
11+
npm run docs:dev
1212

1313
# Build mode, target: docs/.vitepress/dist/
14-
yarn docs:build
14+
npm run docs:build
1515
```
1616
## Note
1717

docs/.vitepress/components/CliGenerator.vue

Lines changed: 778 additions & 331 deletions
Large diffs are not rendered by default.
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
<template>
2+
<div class="contributors-container">
3+
<div class="contributors-header">
4+
<h2>Contributors</h2>
5+
<p class="contributors-description">
6+
Thanks to all the amazing people who have contributed to this project!
7+
</p>
8+
</div>
9+
10+
<div v-if="loading" class="loading-state">
11+
<div class="spinner"></div>
12+
<p>Loading contributors...</p>
13+
</div>
14+
15+
<div v-else-if="error" class="error-state">
16+
<p>{{ error }}</p>
17+
</div>
18+
19+
<div v-else class="contributors-grid">
20+
<a
21+
v-for="contributor in contributors"
22+
:key="contributor.id"
23+
:href="contributor.html_url"
24+
target="_blank"
25+
rel="noopener noreferrer"
26+
class="contributor-card"
27+
:title="contributor.login"
28+
>
29+
<img
30+
:src="contributor.avatar_url"
31+
:alt="contributor.login"
32+
class="contributor-avatar"
33+
loading="lazy"
34+
/>
35+
<div class="contributor-name">{{ contributor.login }}</div>
36+
</a>
37+
</div>
38+
</div>
39+
</template>
40+
41+
<script setup lang="ts">
42+
import { ref, onMounted } from 'vue';
43+
44+
interface Contributor {
45+
id: number;
46+
login: string;
47+
avatar_url: string;
48+
html_url: string;
49+
contributions: number;
50+
}
51+
52+
const contributors = ref<Contributor[]>([]);
53+
const loading = ref(true);
54+
const error = ref('');
55+
56+
const fetchContributors = async () => {
57+
try {
58+
loading.value = true;
59+
error.value = '';
60+
61+
const response = await fetch(
62+
'https://api.github.com/repos/crazywhalecc/static-php-cli/contributors?per_page=24'
63+
);
64+
65+
if (!response.ok) {
66+
throw new Error('Failed to fetch contributors');
67+
}
68+
69+
const data = await response.json();
70+
contributors.value = data;
71+
} catch (err) {
72+
error.value = 'Failed to load contributors. Please try again later.';
73+
console.error('Error fetching contributors:', err);
74+
} finally {
75+
loading.value = false;
76+
}
77+
};
78+
79+
onMounted(() => {
80+
fetchContributors();
81+
});
82+
</script>
83+
84+
<style scoped>
85+
.contributors-container {
86+
margin: 48px auto;
87+
padding: 32px 24px;
88+
max-width: 1152px;
89+
background: linear-gradient(135deg, var(--vp-c-bg-soft) 0%, var(--vp-c-bg) 100%);
90+
border-radius: 16px;
91+
border: 1px solid var(--vp-c-divider);
92+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
93+
}
94+
95+
.contributors-header {
96+
text-align: center;
97+
margin-bottom: 24px;
98+
}
99+
100+
.contributors-header h2 {
101+
font-size: 1.5rem;
102+
font-weight: 700;
103+
margin: 0 0 8px 0;
104+
background: linear-gradient(120deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
105+
-webkit-background-clip: text;
106+
-webkit-text-fill-color: transparent;
107+
background-clip: text;
108+
}
109+
110+
.contributors-description {
111+
font-size: 0.95rem;
112+
color: var(--vp-c-text-2);
113+
margin: 0;
114+
line-height: 1.5;
115+
}
116+
117+
.loading-state,
118+
.error-state {
119+
text-align: center;
120+
padding: 40px 20px;
121+
color: var(--vp-c-text-2);
122+
}
123+
124+
.spinner {
125+
width: 40px;
126+
height: 40px;
127+
margin: 0 auto 16px;
128+
border: 4px solid var(--vp-c-divider);
129+
border-top-color: var(--vp-c-brand-1);
130+
border-radius: 50%;
131+
animation: spin 1s linear infinite;
132+
}
133+
134+
@keyframes spin {
135+
to {
136+
transform: rotate(360deg);
137+
}
138+
}
139+
140+
.contributors-grid {
141+
display: grid;
142+
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
143+
gap: 16px;
144+
}
145+
146+
.contributor-card {
147+
display: flex;
148+
flex-direction: column;
149+
align-items: center;
150+
padding: 12px;
151+
background: var(--vp-c-bg);
152+
border-radius: 12px;
153+
border: 1px solid var(--vp-c-divider);
154+
transition: all 0.3s ease;
155+
text-decoration: none;
156+
color: var(--vp-c-text-1);
157+
}
158+
159+
.contributor-card:hover {
160+
transform: translateY(-4px);
161+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
162+
border-color: var(--vp-c-brand-1);
163+
}
164+
165+
.contributor-avatar {
166+
width: 60px;
167+
height: 60px;
168+
border-radius: 50%;
169+
border: 2px solid var(--vp-c-divider);
170+
transition: all 0.3s ease;
171+
margin-bottom: 8px;
172+
}
173+
174+
.contributor-card:hover .contributor-avatar {
175+
border-color: var(--vp-c-brand-1);
176+
transform: scale(1.05);
177+
}
178+
179+
.contributor-name {
180+
font-size: 12px;
181+
font-weight: 500;
182+
text-align: center;
183+
word-break: break-word;
184+
max-width: 100%;
185+
}
186+
187+
@media (max-width: 768px) {
188+
.contributors-container {
189+
margin: 32px 16px;
190+
padding: 24px 16px;
191+
}
192+
193+
.contributors-header h2 {
194+
font-size: 1.25rem;
195+
}
196+
197+
.contributors-description {
198+
font-size: 0.9rem;
199+
}
200+
201+
.contributors-grid {
202+
grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
203+
gap: 12px;
204+
}
205+
206+
.contributor-card {
207+
padding: 8px;
208+
}
209+
210+
.contributor-avatar {
211+
width: 48px;
212+
height: 48px;
213+
}
214+
215+
.contributor-name {
216+
font-size: 11px;
217+
}
218+
}
219+
</style>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<template>
2+
<div>
3+
<header class="DocSearch-SearchBar" style="padding: 0">
4+
<form class="DocSearch-Form searchinput">
5+
<input class="DocSearch-Input" v-model="filterText" placeholder="Filter name..." @input="doFilter" />
6+
</form>
7+
</header>
8+
<table>
9+
<thead>
10+
<tr>
11+
<th>Extension Name</th>
12+
<th>Linux</th>
13+
<th>macOS</th>
14+
<th>FreeBSD</th>
15+
<th>Windows</th>
16+
</tr>
17+
</thead>
18+
<tbody>
19+
<tr v-for="item in filterData">
20+
<td v-if="!item.notes">{{ item.name }}</td>
21+
<td v-else>
22+
<a :href="'./extension-notes.html#' + item.name">{{ item.name }}</a>
23+
</td>
24+
<td>{{ item.linux }}</td>
25+
<td>{{ item.macos }}</td>
26+
<td>{{ item.freebsd }}</td>
27+
<td>{{ item.windows }}</td>
28+
</tr>
29+
</tbody>
30+
</table>
31+
<div v-if="filterData.length === 0" style="margin: 0 4px 20px 4px; color: var(--vp-c-text-2); font-size: 14px">
32+
No result, please try another keyword.
33+
</div>
34+
</div>
35+
</template>
36+
37+
<script>
38+
export default {
39+
name: "SearchTable"
40+
}
41+
</script>
42+
43+
<script setup>
44+
import {ref} from "vue";
45+
import ext from '../../../config/ext.json';
46+
47+
// 将 ext 转换为列表,方便后续操作
48+
const data = ref([]);
49+
for (const [name, item] of Object.entries(ext)) {
50+
data.value.push({
51+
name,
52+
linux: item.support?.Linux === undefined ? 'yes' : (item.support?.Linux === 'wip' ? '' : item.support?.Linux),
53+
macos: item.support?.Darwin === undefined ? 'yes' : (item.support?.Darwin === 'wip' ? '' : item.support?.Darwin),
54+
freebsd: item.support?.BSD === undefined ? 'yes' : (item.support?.BSD === 'wip' ? '' : item.support?.BSD),
55+
windows: item.support?.Windows === undefined ? 'yes' : (item.support?.Windows === 'wip' ? '' : item.support?.Windows),
56+
notes: item.notes === true,
57+
});
58+
}
59+
60+
61+
const filterData = ref(data.value);
62+
const filterText = ref('');
63+
64+
const doFilter = () => {
65+
if (filterText.value === '') {
66+
filterData.value = data.value;
67+
return;
68+
}
69+
filterData.value = data.value.filter(item => {
70+
return item.name.toLowerCase().includes(filterText.value.toLowerCase());
71+
});
72+
}
73+
</script>
74+
75+
<style>
76+
.searchinput {
77+
border: 1px solid var(--vp-c-divider);
78+
}
79+
</style>

docs/.vitepress/config.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import sidebarZh from "./sidebar.zh";
44

55
// https://vitepress.dev/reference/site-config
66
export default {
7-
title: "static-php-cli",
7+
title: "Static PHP",
88
description: "Build single static PHP binary, with PHP project together, with popular extensions included.",
9+
base: '/v2-docs/',
910
locales: {
1011
en: {
1112
label: 'English',
1213
lang: 'en',
1314
themeConfig: {
1415
nav: [
1516
{text: 'Guide', link: '/en/guide/',},
16-
{text: 'Developing', link: '/en/develop/'},
17+
{text: 'Advanced', link: '/en/develop/'},
1718
{text: 'Contributing', link: '/en/contributing/'},
1819
{text: 'FAQ', link: '/en/faq/'},
1920
],
@@ -30,7 +31,7 @@ export default {
3031
themeConfig: {
3132
nav: [
3233
{text: '构建指南', link: '/zh/guide/'},
33-
{text: '开发指南', link: '/zh/develop/'},
34+
{text: '进阶', link: '/zh/develop/'},
3435
{text: '贡献', link: '/zh/contributing/'},
3536
{text: 'FAQ', link: '/zh/faq/'},
3637
],
@@ -44,9 +45,22 @@ export default {
4445
},
4546
themeConfig: {
4647
// https://vitepress.dev/reference/default-theme-config
48+
logo: '/images/static-php_nobg.png',
4749
nav: [],
4850
socialLinks: [
4951
{icon: 'github', link: 'https://github.com/crazywhalecc/static-php-cli'}
50-
]
52+
],
53+
footer: {
54+
message: 'Released under the MIT License.',
55+
copyright: 'Copyright © 2023-present crazywhalecc'
56+
},
57+
search: {
58+
provider: 'algolia',
59+
options: {
60+
appId: 'IHJHUB1SF1',
61+
apiKey: '8266d31cc2ffbd0e059f1c6e5bdaf8fc',
62+
indexName: 'static-php docs',
63+
},
64+
},
5165
}
5266
}

0 commit comments

Comments
 (0)