Skip to content

Commit

Permalink
feat(templates/vuepress): Vuepress solid template
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiehl committed Nov 19, 2024
1 parent 0da5515 commit bb32367
Show file tree
Hide file tree
Showing 21 changed files with 5,421 additions and 0 deletions.
32 changes: 32 additions & 0 deletions templates/vuepress/vuepress-solid-template/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Git
.git
.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
# dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# VuePress
.temp
.cache
16 changes: 16 additions & 0 deletions templates/vuepress/vuepress-solid-template/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Dockerfile]
indent_size = 4

[*.dockerfile]
indent_size = 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Main Edge Deploy

on:
pull_request:
types:
- closed
branches:
- "main"

jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install NPM dependencies
run: npm i

- name: Install Azion CLI
run: |
curl -o azionlinux https://downloads.azion.com/linux/x86_64/azion
sudo mv azionlinux /usr/bin/azion
sudo chmod u+x /usr/bin/azion
- name: Azion Action Deploy
run: |
azion -t ${{ secrets.AZION_PERSONAL_TOKEN }}
azion deploy
31 changes: 31 additions & 0 deletions templates/vuepress/vuepress-solid-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# VuePress
.temp
.cache

# Azion
.edge
.vulcan

13 changes: 13 additions & 0 deletions templates/vuepress/vuepress-solid-template/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: true

# line-length (default: 80)
MD013: false

# blanks-around-fences (allow only code in list)
MD031:
list_items: false

# no-inline-html (allow only Catalog)
MD033:
allowed_elements:
- Catalog
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"yzhang.markdown-all-in-one",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
"bierner.markdown-mermaid",
"DavidAnson.vscode-markdownlint"
]
}
18 changes: 18 additions & 0 deletions templates/vuepress/vuepress-solid-template/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"prettier.enable": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.markdownlint": "explicit",
"source.organizeImports": "explicit"
},
"[markdown]": {
"editor.wordWrap": "on",
"editor.quickSuggestions": {
"other": "off",
"comments": "off",
"strings": "off"
}
},
"cSpell.enabled": false
}
24 changes: 24 additions & 0 deletions templates/vuepress/vuepress-solid-template/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG NODE_VERSION=22.2.0
ARG NPM_REGISTER=https://registry.npmjs.org

# Builder
FROM node:$NODE_VERSION-bookworm AS builder
WORKDIR /app
ARG NPM_REGISTER
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN npm -v \
&& npm config set registry $NPM_REGISTER \
&& npm install -g pnpm \
&& pnpm -v \
&& pnpm config set registry $NPM_REGISTER \
&& pnpm install \
&& pnpm build

# Nginx Server
FROM nginx:1.25.5-alpine3.19-slim
WORKDIR /usr/share/nginx/html/
COPY --from=builder /app/docs/.vuepress/dist/ ./
RUN echo "<script>window.location.href = '/vuepress-solid-template/'</script>" > /usr/share/nginx/html/index.html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
89 changes: 89 additions & 0 deletions templates/vuepress/vuepress-solid-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# *Solid*: a VuePress 2 Template

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Sun-ZhenXing/vuepress-solid-template/deploy-docs.yml?branch=main)

🌐 [**中文文档**](./README.zh.md) | 🚀 [**Demo Page**](https://blog.alexsun.top/vuepress-solid-template/)

## *Solid* is not *Solid.js*! *Solid* is a VuePress2-powered static site generator

Best VuePress2 Template. Get a beautiful and configured default theme document in a minute.

Features:

- 🎉 VuePress 2 (Vue 3 + Vite 5 + TypeScript)
-[VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 📖 Support LaTeX math formulas (use [KaTeX](https://katex.org/))
- 📈 [Mermaid](https://theme-hope.vuejs.press/guide/markdown/mermaid.html) (**optional**, installed by default)
- 💡 [chartjs](https://vuepress-theme-hope.github.io/v2/md-enhance/guide/chart/chartjs.html) (**optional**, please refer to the [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/))
- 📊 [Echarts](https://theme-hope.vuejs.press/guide/markdown/echarts.html) (**optional**, please refer to the [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/))
- 🎞️ [Presentation](https://theme-hope.vuejs.press/guide/markdown/revealjs.html) (use `reveal.js`, **optional**, please refer to the [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/))
- 📐 [Flowchart](https://theme-hope.vuejs.press/guide/markdown/flowchart.html) (**optional**, please refer to the [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/))
- 📋 Copy code support
- 📜 Auto catalog generation
- 🔍 Static search support
- 🎇 Auto format

## 1. Start

```bash
git clone https://github.com/Sun-ZhenXing/vuepress-solid-template
cd vuepress-solid-template
pnpm i
pnpm dev
```

The only thing you need to do is to configure `docs/.vuepress/config.ts`:

1. change `USER_NAME` to yours.
2. change `BASE_PATH` to your repo name.

## 2. Uploading code to remote repo

Change `${YOUR_REPO}` to the address of your remote repository.

```bash
cd vuepress-my-docs
rm -rf .git && git init && git add .
git commit -m "init from Sun-ZhenXing/vuepress-solid-template"
git remote add origin ${YOUR_REPO}
git branch -M main
git push -u origin main
```

## 3. Build

Build with `pnpm`:

```bash
pnpm i
pnpm build
```

You can find the generated static files in `docs/.vuepress/dist`.

Build with Docker:

```bash
docker build -t vuepress-solid-template .
docker run -itd -p 80:80 vuepress-solid-template
```

Now you can visit <http://localhost> to see your document.

## 4. How to config GitHub Pages?

If you don't want it, reomve `.github/workflows/` file.

When building in GitHub Actions for the first time, an error will be reported and an email will be sent to you. Don't panic because you haven't set up GitHub Pages yet.

If you need to open GitHub Pages:

1. Open your GitHub repo page
2. Click `Settings`
3. Click `Actions`, then click `General`
4. Find `Workflow permissions`, select `Read and write permissions`, save
5. If you have not successfully executed GitHub Actions at this time, you need to manually execute them once. Open the actions you just created and click `re-run all jobs`
6. Click `Pages` on the sidebar, goto `Build and deployment`
7. Config as `Branch: gh-pages /(root)`, or force HTTPS, save

It will create **GitHub Pages** automatically.
89 changes: 89 additions & 0 deletions templates/vuepress/vuepress-solid-template/README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# *Solid*: 一个 VuePress 2 模板

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Sun-ZhenXing/vuepress-solid-template/deploy-docs.yml?branch=main)

🚀 [立刻查看 Demo 页面](https://blog.alexsun.top/vuepress-solid-template/).

## **Solid** 不是 **Solid.js**!VuePress2 是 Vue3 驱动的静态网站生成器

最佳 VuePress2 模板,在几分钟之内获得一个精美的、已经配置好的默认主题文档。

特征:

- 🎉 VuePress 2 (Vue 3 + Vite 5 + TypeScript)
-[VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 📖 支持 LaTeX 数学公式(使用 [KaTeX](https://katex.org/)
- 📈 [Mermaid](https://theme-hope.vuejs.press/guide/markdown/mermaid.html)**可选**,默认安装)
- 💡 [chartjs](https://vuepress-theme-hope.github.io/v2/md-enhance/guide/chart/chartjs.html)**可选**,请参考 [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 📊 [Echarts](https://theme-hope.vuejs.press/guide/markdown/echarts.html)**可选**,请参考 [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 🎞️ [Presentation](https://theme-hope.vuejs.press/guide/markdown/revealjs.html)(使用 `reveal.js`**可选**,请参考 [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 📐 [Flowchart](https://theme-hope.vuejs.press/guide/markdown/flowchart.html)**可选**,请参考 [VuePress MarkDown Enhance](https://vuepress-theme-hope.github.io/v2/md-enhance/)
- 📋 代码复制支持
- 📜 自动生成目录
- 🔍 静态搜索支持
- 🎇 自动格式化

## 1. 开始

```bash
git clone https://github.com/Sun-ZhenXing/vuepress-solid-template
cd vuepress-solid-template
pnpm i
pnpm dev
```

你唯一要做的是 `docs/.vuepress/config.ts`

1.`USER_NAME` 修改为你的用户名
2.`BASE_PATH` 修改为你的仓库路径

## 2. 上传代码到远程仓库

`${YOUR_REPO}` 改为你的远程仓库地址。

```bash
cd vuepress-my-docs
rm -rf .git && git init && git add .
git commit -m "init from Sun-ZhenXing/vuepress-solid-template"
git remote add origin ${YOUR_REPO}
git branch -M main
git push -u origin main
```

## 3. 构建

使用 `pnpm` 构建:

```bash
pnpm i
pnpm build
```

内容将生成在 `docs/.vuepress/dist` 下。

使用 Docker 构建:

```bash
docker build -t vuepress-solid-template .
docker run -itd -p 80:80 vuepress-solid-template
```

现在你可以访问 <http://localhost> 来查看你的文档。

## 4. 如何设置 GitHub Pages?

如果你不需要,可以删除 `.github/workflows/` 下的文件。

第一次在 GitHub Actions 中构建时会报错并发邮件给你,不要惊慌,这是因为你还没有设置 GitHub Pages。

如果你想打开 GitHub Pages:

1. GitHub 打开你的项目主页页面
2. 点击 `Settings`
3. 点击 `Actions`,然后点击 `General`
4. 找到 `Workflow permissions`,然后选中 `Read and write permissions`,保存
5. 如果此时你还没有成功执行过 GitHub Actions,那么你需要手动执行一次,打开刚刚的 Actions,点击 `re-run all jobs`
6. 然后点击侧边栏的 `Pages`,然后到 `Build and deployment` 下面
7. 设置 `Branch: gh-pages /(root)`,可选的 HTTPS,保存

这将自动创建 **GitHub Pages**
8 changes: 8 additions & 0 deletions templates/vuepress/vuepress-solid-template/azion.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
build: {
preset: {
name: 'vuepress'
}
}
}

Loading

0 comments on commit bb32367

Please sign in to comment.