Skip to content

Commit da6846f

Browse files
committed
init vewpress layout
1 parent 5f5b86b commit da6846f

25 files changed

+396
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
package-lock.json

deploy.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env sh
2+
3+
# 오류 발생시 중단한다.
4+
set -e
5+
6+
# 문서(md)를 build하여 html로 만든다.
7+
npm run build
8+
9+
# build가 output된 폴더로 이동한다.
10+
cd docs/.vuepress/dist
11+
12+
# init + add + commit을 해준 다음
13+
git init
14+
git add -A
15+
git commit -m 'deploy'
16+
17+
git push -f https://github.com/qnote/qnote.git main
18+
19+
cd -
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template lang="html">
2+
<div class="tags">
3+
<router-link
4+
v-for="tag in $page.frontmatter.tags"
5+
:key="tag"
6+
:to="{ path: `/tag/#${tag}` }"
7+
>
8+
#{{ tag }}
9+
</router-link>
10+
</div>
11+
</template>
12+
13+
<style scoped>
14+
.tags {
15+
margin: 30px 0;
16+
}
17+
a {
18+
margin-right: 10px;
19+
}
20+
</style>

docs/.vuepress/components/TagList.vue

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template lang="html">
2+
<div>
3+
<span v-for="tag in Object.keys(tags)">
4+
<h2 :id="tag">
5+
<router-link
6+
:to="{ path: `/tag/#${tag}` }"
7+
class="header-anchor"
8+
aria-hidden="true"
9+
>#</router-link
10+
>
11+
{{ tag }}
12+
</h2>
13+
<ul>
14+
<li v-for="page in tags[tag]">
15+
<router-link :to="{ path: page.path }">{{ page.title }}</router-link>
16+
</li>
17+
</ul>
18+
</span>
19+
</div>
20+
</template>
21+
22+
<script>
23+
export default {
24+
computed: {
25+
tags() {
26+
let tags = {};
27+
for (let page of this.$site.pages) {
28+
for (let index in page.frontmatter.tags) {
29+
const tag = page.frontmatter.tags[index];
30+
if (tag in tags) {
31+
tags[tag].push(page);
32+
} else {
33+
tags[tag] = [page];
34+
}
35+
}
36+
}
37+
return tags;
38+
}
39+
}
40+
};
41+
</script>

docs/.vuepress/config.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// config.js
2+
const routes = [
3+
"Tag",
4+
"Infra",
5+
"PrivatePlatform",
6+
"PublicCloud",
7+
"HashiCorp",
8+
"etc",
9+
"Howto"
10+
];
11+
12+
const createSidebar = () => {
13+
const sidebar = {};
14+
for (const route of routes) {
15+
Object.assign(sidebar, require("../" + route));
16+
}
17+
return sidebar;
18+
};
19+
20+
module.exports = {
21+
base: "/",
22+
title: "qnote", // 사이트 타이틀
23+
description: "혼자서는 불가능",
24+
themeConfig: {
25+
logo: "/image/shortcuts-quick-open.png", // 로고 이미지
26+
nav: [
27+
{ text: "Tag", link: "/tag/" },
28+
{ text: "Infra", link: "/Infra/" },
29+
{ text: "Private Platform", link: "/PrivatePlatform/" },
30+
{ text: "Public Cloud", link: "/PublicCloud/" },
31+
{ text: "HashiCorp", link: "/HashiCorp/" },
32+
{ text: "etc", link: "/etc/" },
33+
{ text: "How To", link: "/Howto/" },
34+
{
35+
text: "Info",
36+
items: [
37+
{ text: "Repository", link: "https://github.com/qnote/page" },
38+
]
39+
}
40+
],
41+
sidebar: createSidebar(),
42+
lastUpdated: "Last Updated",
43+
smoothScroll: true,
44+
},
45+
// head: [
46+
// ['meta', {name: "google-site-verification", content: "sHfBWIoCUOYFXJ3b0ulN8jp9jpD8SEW5Wpxvlk-UABA"}],
47+
// ],
48+
markdown: {
49+
extendMarkdown: (md) => {
50+
md.use(require("markdown-it-plantuml"));
51+
md.use(require("markdown-it-underline"));
52+
md.use(require("markdown-it-task-lists"));
53+
},
54+
},
55+
plugins: [["@vuepress/back-to-top"], ["@vuepress/last-updated"]],
56+
};
Loading

docs/HashiCorp/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
title: HashiCorp
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# HashiCorp
10+
11+
...
12+
13+

docs/HashiCorp/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("HashiCorp");

docs/Howto/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
title: How to
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# How to
10+
11+
12+
13+

docs/Howto/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("Howto");

docs/Infra/Linux/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
3+
title: Linux
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Linux
10+
11+
## Debian
12+
13+
## RedHat
14+
15+
## SUSE
16+
17+
18+
19+

docs/Infra/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
title: Infra
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Infrastructure
10+
11+
12+
13+

docs/Infra/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("Infra");

docs/PrivatePlatform/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
title: Private Platform
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Private Platform
10+
11+
## VMware
12+
13+
## OpenStack
14+
15+
## Kubernetes
16+
17+

docs/PrivatePlatform/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("PrivatePlatform");

docs/PublicCloud/Azure/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
title: Azure
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Azure
10+
11+
12+
13+

docs/PublicCloud/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
title: Public Cloud
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Public Cloud
10+
11+
## Amazon Web Service (AWS)
12+
13+
## Microsoft Azure
14+
15+
## Google Cloud Platform (GCP)
16+
17+
## Naver Cloud Platform (NCP)
18+
19+
## Alibaba Cloud
20+
21+
22+
23+

docs/PublicCloud/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("PublicCloud");

docs/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
home: true
3+
actionText: Get started →
4+
actionLink: /tag/
5+
features:
6+
- title: Infra
7+
details: OS / Network / Storage
8+
- title: Private Platform
9+
details: VMware / OpenStack / Kubernetes
10+
- title: Public Cloud
11+
details: AWS / Azure / GCP / NCP / Alibaba
12+
- title: HashiCorp
13+
details: Vagrant / Packer / Terraform / Vault / Boundary / Consul / Nomad / Waypoint
14+
- title: 기타
15+
details: 미분류된 자료
16+
- title: How to
17+
details: 활용 방법 안내
18+
footer: CC-BY-SA-4.0 Licensed | ⓒ 2021-present qnote™ contributers all rights reserved.
19+
---
20+
---
21+
### Start contributing to `qnote`
22+
```sh
23+
# git clone
24+
git clone https://github.com/qnote/page.git
25+
26+
# npm install
27+
cd page
28+
npm install
29+
30+
# start VuePress writing
31+
npm run dev
32+
```

docs/etc/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
title: etc
4+
sidebar: true
5+
next: false
6+
7+
---
8+
9+
# Etc.
10+
11+
12+
13+

docs/etc/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("../../getBuild")("etc");

docs/tag/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Tag
2+
3+
<TagList />
4+
<TagLinks />

docs/tag/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
"/Tag/": [""]
3+
};

getBuild.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = function(dirName) {
2+
const envValue = process.env.NODE_ENV
3+
? { "43": 4, "61": 6, "54": 5 }
4+
: { "43": 3, "61": 1, "54": 4 };
5+
6+
const fs = require("fs");
7+
8+
const listsNesting = [""];
9+
const nesting = [];
10+
const once = [];
11+
12+
function getFiles(dir) {
13+
const all = fs.readdirSync(dir);
14+
const filtersDir = all.filter(
15+
file => file.indexOf(".") === -1 || file.indexOf(".md") !== -1
16+
);
17+
18+
return filtersDir.map(file => {
19+
if (fs.statSync(`${dir}/${file}`).isDirectory()) {
20+
return getFiles(`${dir}/${file}`);
21+
} else {
22+
if (dir.split("/").length === envValue[43]) {
23+
once.push(`${dir.slice(envValue[61])}/`);
24+
} else if (dir.split("/").length === envValue[54]) {
25+
let check = false;
26+
nesting.map(el => {
27+
if (el.title === dir.split("/")[dir.split("/").length - 2]) {
28+
check = true;
29+
el.children.push(`${dir.slice(envValue[61])}/`);
30+
}
31+
});
32+
if (!check) {
33+
nesting.push({
34+
collapsable: true,
35+
title: dir.split("/")[dir.split("/").length - 2],
36+
children: [`${dir.slice(envValue[61])}/`]
37+
});
38+
}
39+
}
40+
}
41+
});
42+
}
43+
44+
const filePath = process.env.NODE_ENV ? `./docs/${dirName}` : `./${dirName}`;
45+
46+
getFiles(filePath);
47+
const res = listsNesting.concat(nesting).concat(once);
48+
return {
49+
[`/${dirName}/`]: res
50+
};
51+
};

0 commit comments

Comments
 (0)