Add VuePress support

This commit is contained in:
Lolipop 2021-05-21 23:50:56 +08:00
parent c0e06672d1
commit b18a13e5fa
16 changed files with 10061 additions and 5 deletions

19
.travis.yml Normal file
View File

@ -0,0 +1,19 @@
language: node_js
node_js:
- lts/*
branches:
only:
- master
install:
- cd vuepress
- yarn install
script:
- yarn build
deploy:
provider: pages
skip_cleanup: true
local_dir: docs/.vuepress/dist
github_token: $CI_DEPLOY_TOKEN
keep_history: true
on:
branch: master

View File

@ -1,4 +1,4 @@
![献给中文读者的设计模式教程 / Design Patterns for Humans CN](./cover.png)
![献给中文读者的设计模式教程 / Design Patterns for Humans CN](./cover/cover.png)
***
<div align="center">
@ -6,7 +6,7 @@
🎉 对设计模式的超简单解读! 🎉
</p>
<p>
设计模式的话题经常害得我们心神不宁。在这里,我将试着用尽可能简单的方式来解释它们,让它们深深地刻在您的脑海里。
设计模式的话题经常害得我们心神不宁。在这里,我将试着用尽可能简单的方式来解释它们,让它们深深地刻在您(还有我)的脑海里。
</p>
<p>
本项目基于 <a href="https://github.com/kamranahmedse/design-patterns-for-humans">Design Patterns for Humans</a>,案例的 JavaScript 代码来自 <a href="https://github.com/sohamkamani/javascript-design-patterns-for-humans">JavaScript Design Patterns for Humans</a>,翻译借鉴参考了 <a href="https://github.com/guanguans">guanguans</a> 前辈的<a href="https://github.com/Leon0X/design-patterns-for-humans-cn">中文翻译项目</a>
@ -53,7 +53,7 @@
* [结构型 / Structural](#structural-design-patterns)
* [行为型 / Behavioral](#behavioral-design-patterns)
## 创建型设计模式 / Creational Design Patterns
## 🏗️ 创建型设计模式 / Creational Design Patterns
In plain words
> Creational patterns are focused towards how to instantiate an object or group of related objects.
@ -544,7 +544,7 @@ president.name // Outputs undefined
president.presidentsPrivateInformation // Outputs undefined
```
## 结构型设计模式 / Structural Design Patterns
## 🔩 结构型设计模式 / Structural Design Patterns
In plain words
> Structural patterns are mostly concerned with object composition or in other words how the entities can use each other. Or yet another explanation would be, they help in answering "How to build a software component?"
@ -1173,7 +1173,7 @@ door.open('ecr@t') // Opening lab door
door.close() // Closing lab door
```
## 行为型设计模式 / Behavioral Design Patterns
## 🤹 行为型设计模式 / Behavioral Design Patterns
In plain words
> It is concerned with assignment of responsibilities between the objects. What makes them different from structural patterns is they don't just specify the structure but also outline the patterns for message passing/communication between them. Or in other words, they assist in answering "How to run a behavior in software component?"

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

3
vuepress/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
.cache/
dist/

21
vuepress/README.md Normal file
View File

@ -0,0 +1,21 @@
# Design Patterns for Humans ZH - VuePress
## Init development
You need to have installed [Node.js](https://nodejs.org/en/) version >= 8.6 at least.
```bash
yarn install
```
## Start development
```bash
yarn dev
```
## Build for production
```baah
yarn build
```

View File

@ -0,0 +1,42 @@
const themeConfigLocalesSettings = {
selectText: '选择编程语言',
editLinkText: '在 GitHub 上编辑此页',
serviceWorker: {
updatePopup: {
message: "伙计,我们发现了新内容可用!",
buttonText: "刷新页面"
}
}
}
module.exports = {
title: '献给中文读者的设计模式教程',
description: '对设计模式的超简单解读!的另一个中文译本。',
base: '/design-patterns-for-humans-zh/',
themeConfig: {
nav: [
{
text: '选择编程语言',
items: [
{ text: 'JavaScript', link: '/' },
// { text: 'PHP', link: '/php/' },
// { text: 'Python', link: '/python/' }
]
},
{
text: '英文原文',
link: 'https://github.com/kamranahmedse/design-patterns-for-humans'
},
],
sidebar: 'auto',
displayAllHeaders: true,
nextLinks: false,
prevLinks: false,
repo: 'LolipopJ/design-patterns-for-humans-zh',
docsDir: 'vuepress/docs',
smoothScroll: true
},
markdown: {
lineNumbers: true
}
}

View File

@ -0,0 +1,9 @@
export default ({
Vue, // VuePress 正在使用的 Vue 构造函数
options, // 附加到根实例的一些选项
router, // 当前应用的路由实例
siteData, // 站点元数据
isServer // 当前应用配置是处于 服务端渲染 或 客户端
}) => {
//
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

1975
vuepress/docs/README.md Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

17
vuepress/package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "design-patterns-for-humans-zh",
"version": "1.0.0",
"description": "献给中文读者的设计模式教程 / An ultra-simplified explanation of design patterns, yet another Chinese translation.",
"main": "index.js",
"repository": "https://github.com/LolipopJ/design-patterns-for-humans-zh",
"author": "LolipopJ",
"license": "MIT",
"private": true,
"scripts": {
"dev": "vuepress dev docs --cache .cache",
"build": "vuepress build docs"
},
"devDependencies": {
"vuepress": "^1.8.2"
}
}

7970
vuepress/yarn.lock Normal file

File diff suppressed because it is too large Load Diff