Skip to content

Commit 01b4186

Browse files
committed
chore: upgrade vitesse playground
1 parent 53992ce commit 01b4186

36 files changed

+3259
-1764
lines changed

playgrounds/vitesse/.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

playgrounds/vitesse/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@antfu"
3+
}

playgrounds/vitesse/README.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ Mocking up web app with <b>Vitesse</b><sup><em>(speed)</em></sup><br>
2121

2222
<br>
2323

24+
2425
## Features
2526

26-
- ⚡️ [Vue 3](https://github.com/vuejs/vue-next), [Vite 2](https://github.com/vitejs/vite), [pnpm](https://pnpm.js.org/), [ESBuild](https://github.com/evanw/esbuild) - born with fastness
27+
- ⚡️ [Vue 3](https://github.com/vuejs/core), [Vite 3](https://github.com/vitejs/vite), [pnpm](https://pnpm.io/), [ESBuild](https://github.com/evanw/esbuild) - born with fastness
2728

2829
- 🗂 [File based routing](./src/pages)
2930

3031
- 📦 [Components auto importing](./src/components)
3132

32-
- 🍍 [State Management via Pinia](https://pinia.esm.dev/)
33+
- 🍍 [State Management via Pinia](https://pinia.vuejs.org/)
3334

3435
- 📑 [Layout system](./src/layouts)
3536

@@ -41,7 +42,7 @@ Mocking up web app with <b>Vitesse</b><sup><em>(speed)</em></sup><br>
4142

4243
- 🌍 [I18n ready](./locales)
4344

44-
- 🗒 [Markdown Support](https://github.com/antfu/vite-plugin-md)
45+
- 🗒 [Markdown Support](https://github.com/antfu/vite-plugin-vue-markdown)
4546

4647
- 🔥 Use the [new `<script setup>` syntax](https://github.com/vuejs/rfcs/pull/227)
4748

@@ -61,6 +62,7 @@ Mocking up web app with <b>Vitesse</b><sup><em>(speed)</em></sup><br>
6162

6263
<br>
6364

65+
6466
## Pre-packed
6567

6668
### UI Frameworks
@@ -74,18 +76,17 @@ Mocking up web app with <b>Vitesse</b><sup><em>(speed)</em></sup><br>
7476

7577
### Plugins
7678

77-
- [Vue Router](https://github.com/vuejs/vue-router)
79+
- [Vue Router](https://github.com/vuejs/router)
7880
- [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) - file system based routing
7981
- [`vite-plugin-vue-layouts`](https://github.com/JohnCampionJr/vite-plugin-vue-layouts) - layouts for pages
8082
- [Pinia](https://pinia.esm.dev) - Intuitive, type safe, light and flexible Store for Vue using the composition api
8183
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - components auto import
8284
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - Directly use Vue Composition API and others without importing
8385
- [`vite-plugin-pwa`](https://github.com/antfu/vite-plugin-pwa) - PWA
84-
- [`vite-plugin-md`](https://github.com/antfu/vite-plugin-md) - Markdown as components / components in Markdown
85-
- [`markdown-it-prism`](https://github.com/jGleitz/markdown-it-prism) - [Prism](https://prismjs.com/) for syntax highlighting
86-
- [`prism-theme-vars`](https://github.com/antfu/prism-theme-vars) - customizable Prism.js theme using CSS variables
86+
- [`vite-plugin-vue-markdown`](https://github.com/antfu/vite-plugin-vue-markdown) - Markdown as components / components in Markdown
87+
- [`markdown-it-shiki`](https://github.com/antfu/markdown-it-shiki) - [Shiki](https://github.com/shikijs/shiki) for syntax highlighting
8788
- [Vue I18n](https://github.com/intlify/vue-i18n-next) - Internationalization
88-
- [`vite-plugin-vue-i18n`](https://github.com/intlify/vite-plugin-vue-i18n) - Vite plugin for Vue I18n
89+
- [`vite-plugin-vue-i18n`](https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n) - Vite plugin for Vue I18n
8990
- [VueUse](https://github.com/antfu/vueuse) - collection of useful composition APIs
9091
- [`vite-ssg-sitemap`](https://github.com/jbaubree/vite-ssg-sitemap) - Sitemap generator
9192
- [`@vueuse/head`](https://github.com/vueuse/head) - manipulate document head reactively
@@ -106,7 +107,7 @@ Mocking up web app with <b>Vitesse</b><sup><em>(speed)</em></sup><br>
106107
- [Netlify](https://www.netlify.com/) - zero-config deployment
107108
- [VS Code Extensions](./.vscode/extensions.json)
108109
- [Vite](https://marketplace.visualstudio.com/items?itemName=antfu.vite) - Fire up Vite server automatically
109-
- [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) - Vue 3 `<script setup>` IDE support
110+
- [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 3 `<script setup>` IDE support
110111
- [Iconify IntelliSense](https://marketplace.visualstudio.com/items?itemName=antfu.iconify) - Icon inline display and autocomplete
111112
- [i18n Ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally) - All in one i18n support
112113
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
@@ -124,7 +125,6 @@ As this template is strongly opinionated, the following provides a curated list
124125

125126
###### Community
126127

127-
- [vitesse-addons](https://github.com/JohnCampionJr/vitesse-addons) by [@johncampionjr](https://github.com/johncampionjr) - additional options for integrations, including [Prettier](https://prettier.io) and [Storybook](https://storybook.js.org)
128128
- [vitesse-ssr-template](https://github.com/frandiox/vitesse-ssr-template) by [@frandiox](https://github.com/frandiox) - Vitesse with SSR
129129
- [vitespa](https://github.com/ctholho/vitespa) by [@ctholho](https://github.com/ctholho) - Like Vitesse but without SSG/SSR
130130
- [vitailse](https://github.com/zynth17/vitailse) by [@zynth17](https://github.com/zynth17) - Like Vitesse but with TailwindCSS
@@ -133,10 +133,11 @@ As this template is strongly opinionated, the following provides a curated list
133133
- [vitesse-enterprise](https://github.com/FranciscoKloganB/vitesse-enterprise) by [@FranciscoKloganB](https://github.com/FranciscoKloganB) - Consistent coding styles regardless of team-size.
134134
- [vitecamp](https://github.com/nekobc1998923/vitecamp) by [@nekobc1998923](https://github.com/nekobc1998923) - Like Vitesse but without SSG/SSR/File based routing, includes Element Plus
135135
- [vitesse-lite-react](https://github.com/lxy-yz/vitesse-lite-react) by [@lxy-yz](https://github.com/lxy-yz) - vitesse-lite React fork
136+
- [vide](https://github.com/Nico-Mayer/vide) by [@nico-mayer](https://github.com/Nico-Mayer) - Vite superlight Beginner Starter Template
136137

137138
## Try it now!
138139

139-
> Vitesse requires Node >=14
140+
> Vitesse requires Node >=14.18
140141
141142
### GitHub Template
142143

@@ -189,8 +190,22 @@ And you will see the generated file in `dist` that ready to be served.
189190

190191
Go to [Netlify](https://app.netlify.com/start) and select your clone, `OK` along the way, and your App will be live in a minute.
191192

193+
### Docker Production Build
194+
195+
First, build the vitesse image by opening the terminal in the project's root directory.
196+
197+
```bash
198+
docker buildx build . -t vitesse:latest
199+
```
200+
201+
Run the image and specify port mapping with the `-p` flag.
202+
203+
```bash
204+
docker run --rm -it -p 8080:80 vitesse:latest
205+
```
206+
192207
## Why
193208

194209
I have created several Vite apps recently. Setting the configs up is kinda the bottleneck for me to make the ideas simply come true within a very short time.
195210

196-
So I made this starter template for myself to create apps more easily, along with some good practices that I have learned from making those apps. It's strongly opinionated, but feel free to tweak it or even maintains your own forks. [(see community maintained variation forks)](#variations)
211+
So I made this starter template for myself to create apps more easily, along with some good practices that I have learned from making those apps. It's strongly opinionated, but feel free to tweak it or even maintain your own forks. [(see community maintained variation forks)](#variations)
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
<p align='center'>
2+
<img src='https://user-images.githubusercontent.com/11247099/154486817-f86b8f20-5463-4122-b6e9-930622e757f2.png' alt='Vitesse - Opinionated Vite Starter Template' width='600'/>
3+
</p>
4+
5+
<p align='center'>
6+
快速地<sup><em>Vitesse</em></sup> 创建 Web 应用
7+
<br>
8+
</p>
9+
10+
<br>
11+
12+
<p align='center'>
13+
<a href="https://vitesse.netlify.app/">在线 Demo</a>
14+
</p>
15+
16+
<br>
17+
18+
<p align='center'>
19+
<a href="https://github.com/antfu/vitesse/blob/main/README.md">English</a> | <b>简体中文</b>
20+
</p>
21+
22+
<br>
23+
24+
## 特性
25+
26+
- ⚡️ [Vue 3](https://github.com/vuejs/core), [Vite 3](https://github.com/vitejs/vite), [pnpm](https://pnpm.io/), [ESBuild](https://github.com/evanw/esbuild) - 就是快!
27+
28+
- 🗂 [基于文件的路由](./src/pages)
29+
30+
- 📦 [组件自动化加载](./src/components)
31+
32+
- 🍍 [使用 Pinia 的状态管理](https://pinia.esm.dev/)
33+
34+
- 📑 [布局系统](./src/layouts)
35+
36+
- 📲 [PWA](https://github.com/antfu/vite-plugin-pwa)
37+
38+
- 🎨 [UnoCSS](https://github.com/unocss/unocss) - 高性能且极具灵活性的即时原子化 CSS 引擎
39+
40+
- 😃 [各种图标集为你所用](https://github.com/antfu/unocss/tree/main/packages/preset-icons)
41+
42+
- 🌍 [I18n 国际化开箱即用](./locales)
43+
44+
- 🗒 [Markdown 支持](https://github.com/antfu/vite-plugin-vue-markdown)
45+
46+
- 🔥 使用 [新的 `<script setup>` 语法](https://github.com/vuejs/rfcs/pull/227)
47+
48+
- 🤙🏻 默认开启 [响应性语法糖](https://vuejs.org/guide/extras/reactivity-transform.html)
49+
50+
- 📥 [API 自动加载](https://github.com/antfu/unplugin-auto-import) - 直接使用 Composition API 无需引入
51+
52+
- 🖨 使用 [vite-ssg](https://github.com/antfu/vite-ssg) 进行服务端生成 (SSG)
53+
54+
- 🦔 使用 [critters](https://github.com/GoogleChromeLabs/critters) 的生成关键 CSS
55+
56+
- 🦾 TypeScript, 当然
57+
58+
- ⚙️ 结合 [GitHub Actions](https://github.com/features/actions),使用 [Vitest](https://github.com/vitest-dev/vitest) 进行单元测试, [Cypress](https://cypress.io/) 进行 E2E 测试
59+
60+
- ☁️ 零配置部署 Netlify
61+
62+
<br>
63+
64+
## 预配置
65+
66+
### UI 框架
67+
68+
- [UnoCSS](https://github.com/antfu/unocss) - 高性能且极具灵活性的即时原子化 CSS 引擎
69+
70+
### Icons
71+
72+
- [Iconify](https://iconify.design) - 使用任意的图标集,浏览:[🔍Icônes](https://icones.netlify.app/)
73+
- [UnoCSS 的纯 CSS 图标方案](https://github.com/antfu/unocss/tree/main/packages/preset-icons)
74+
75+
### 插件
76+
77+
- [Vue Router](https://github.com/vuejs/router)
78+
- [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) - 以文件系统为基础的路由
79+
- [`vite-plugin-vue-layouts`](https://github.com/JohnCampionJr/vite-plugin-vue-layouts) - 页面布局系统
80+
- [Pinia](https://pinia.esm.dev) - 直接的, 类型安全的, 使用 Composition api 的轻便灵活的 Vue 状态管理
81+
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - 自动加载组件
82+
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - 直接使用 Composition API 等,无需导入
83+
- [`vite-plugin-pwa`](https://github.com/antfu/vite-plugin-pwa) - PWA
84+
- [`vite-plugin-vue-markdown`](https://github.com/antfu/vite-plugin-vue-markdown) - Markdown 作为组件,也可以让组件在 Markdown 中使用
85+
- [`markdown-it-prism`](https://github.com/jGleitz/markdown-it-prism) - [Prism](https://prismjs.com/) 的语法高亮
86+
- [`prism-theme-vars`](https://github.com/antfu/prism-theme-vars) - 利用 CSS 变量自定义 Prism.js 的主题
87+
- [Vue I18n](https://github.com/intlify/vue-i18n-next) - 国际化
88+
- [`vite-plugin-vue-i18n`](https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n) - Vue I18n 的 Vite 插件
89+
- [VueUse](https://github.com/antfu/vueuse) - 实用的 Composition API 工具合集
90+
- [`vite-ssg-sitemap`](https://github.com/jbaubree/vite-ssg-sitemap) - 站点地图生成器
91+
- [`@vueuse/head`](https://github.com/vueuse/head) - 响应式地操作文档头信息
92+
93+
### 编码风格
94+
95+
- 使用 Composition API 地 [`<script setup>` SFC 语法](https://github.com/vuejs/rfcs/pull/227)
96+
- [ESLint](https://eslint.org/) 配置为 [@antfu/eslint-config](https://github.com/antfu/eslint-config), 单引号, 无分号.
97+
98+
### 开发工具
99+
- [TypeScript](https://www.typescriptlang.org/)
100+
- [Vitest](https://github.com/vitest-dev/vitest) - 基于 Vite 的单元测试框架
101+
- [Cypress](https://cypress.io/) - E2E 测试
102+
- [pnpm](https://pnpm.js.org/) - 快, 节省磁盘空间的包管理器
103+
- [`vite-ssg`](https://github.com/antfu/vite-ssg) - 服务端生成
104+
- [critters](https://github.com/GoogleChromeLabs/critters) - 关键 CSS 生成器
105+
- [Netlify](https://www.netlify.com/) - 零配置的部署
106+
- [VS Code 扩展](./.vscode/extensions.json)
107+
- [Vite](https://marketplace.visualstudio.com/items?itemName=antfu.vite) - 自动启动 Vite 服务器
108+
- [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) - Vue 3 `<script setup>` IDE 支持
109+
- [Iconify IntelliSense](https://marketplace.visualstudio.com/items?itemName=antfu.iconify) - 图标内联显示和自动补全
110+
- [i18n Ally](https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally) - 多合一的 I18n 支持
111+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
112+
113+
## 衍生项目
114+
115+
由于这个模板的业务场景非常的局限,下面提供了一个精心策划的列表,列出了社区维护的具有不同偏好和功能集的衍生项目。也可以看看他们。当然也欢迎你 PR 提供自己的项目!
116+
117+
###### 官方
118+
119+
- [vitesse-lite](https://github.com/antfu/vitesse-lite) - Vitesse 的轻量版本
120+
- [vitesse-nuxt3](https://github.com/antfu/vitesse-nuxt3) - Vitesse 的 Nuxt 3 版本
121+
- [vitesse-nuxt-bridge](https://github.com/antfu/vitesse-nuxt-bridge) - Vitesse 的 Nuxt2 桥接版本
122+
- [vitesse-webext](https://github.com/antfu/vitesse-webext) - 开箱即用的浏览器扩展 vite 模板
123+
124+
###### 社区
125+
126+
[查看英文版](./README.md#community)
127+
128+
## 现在可以试试!
129+
130+
> Vitesse 需要 Node 版本 >=14.18
131+
132+
### GitHub 模板
133+
134+
[使用这个模板创建仓库](https://github.com/antfu/vitesse/generate).
135+
136+
### 克隆到本地
137+
138+
如果您更喜欢使用更干净的 git 历史记录手动执行此操作
139+
140+
```bash
141+
npx degit antfu/vitesse my-vitesse-app
142+
cd my-vitesse-app
143+
pnpm i # 如果你没装过 pnpm, 可以先运行: npm install -g pnpm
144+
```
145+
146+
## 清单
147+
148+
使用此模板时,请尝试按照清单正确更新您自己的信息
149+
150+
- [ ]`LICENSE` 中改变作者名
151+
- [ ]`App.vue` 中改变标题
152+
- [ ]`vite.config.ts` 更改主机名
153+
- [ ]`public` 目录下改变favicon
154+
- [ ] 移除 `.github` 文件夹中包含资助的信息
155+
- [ ] 整理 README 并删除路由
156+
157+
紧接着, 享受吧 :)
158+
159+
## 使用
160+
161+
### 开发
162+
163+
只需要执行以下命令就可以在 http://localhost:3333 中看到
164+
165+
```bash
166+
pnpm dev
167+
```
168+
169+
### 构建
170+
171+
构建该应用只需要执行以下命令
172+
173+
```bash
174+
pnpm build
175+
```
176+
177+
然后你会看到用于发布的 `dist` 文件夹被生成。
178+
179+
### 部署到 Netlify
180+
181+
前往 [Netlify](https://app.netlify.com/start) 并选择你的仓库, 一路 `OK` 下去,稍等一下后,你的应用将被创建.

playgrounds/vitesse/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
76
<link rel="apple-touch-icon" href="/pwa-192x192.png">
87
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
98
<meta name="msapplication-TileColor" content="#00aba9">
10-
<meta name="theme-color" content="#ffffff">
119
<script>
12-
(function() {
10+
(function () {
1311
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
1412
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
1513
if (setting === 'dark' || (prefersDark && setting !== 'light'))

playgrounds/vitesse/locales/fr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
button:
2-
about: À propos de
2+
about: À propos
33
back: Retour
44
go: Essayer
55
home: Accueil

playgrounds/vitesse/netlify.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build.environment]
2+
# bypass npm auto install
3+
NPM_FLAGS = "--version"
4+
NODE_VERSION = "16"
5+
6+
[build]
7+
publish = "dist"
8+
command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build"
9+
10+
[[redirects]]
11+
from = "/*"
12+
to = "/index.html"
13+
status = 200
14+
15+
[[headers]]
16+
for = "/manifest.webmanifest"
17+
[headers.values]
18+
Content-Type = "application/manifest+json"

0 commit comments

Comments
 (0)