Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

[evo] add Documentation system (from Divio) #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist/
coverage/
.idea/
*.iml
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ npx create-vuepress-site
# yarn create vuepress-site
```

Answer some project's information and choose one of the template:
- docs (the vuepress standard template)
- documentation-system (an opinionated documentation system based upon Divio's documentation-system)


This will create a scaffolded documentation site in the `docs` directory that is enclosed from the rest of the folder.

### Setup local environment
Expand Down
43 changes: 43 additions & 0 deletions lib/generators/documentation-system/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const BasicGenerator = require('../../BasicGenerator');

class Generator extends BasicGenerator {
prompting() {
const prompts = [
{
name: 'name',
message: `What's the name of your project?`,
default: this.name
},
{
name: 'description',
message: `What's the description of your project?`
},
{
name: 'mail',
message: `What's your email?`
},
{
name: 'author',
message: `What's your name?`
},
{
name: 'repo',
message: `What's the repo of your project?`
}
];
return this.prompt(prompts).then(props => {
this.prompts = props;
});
}

writing() {
this.writeFiles({
context: this.prompts,
filterFiles: () => {
return true;
}
});
}
}

module.exports = Generator;
3 changes: 3 additions & 0 deletions lib/generators/documentation-system/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"description": "Create a documentation system site for your project with VuePress. \n For more informations, see https://documentation.divio.com/"
}
12 changes: 12 additions & 0 deletions lib/generators/documentation-system/templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pids
logs
node_modules
npm-debug.log
coverage/
run
dist
.DS_Store
.nyc_output
.basement
config.local.js
basement_dist
10 changes: 10 additions & 0 deletions lib/generators/documentation-system/templates/buildAndRun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

npm run build
echo "-----> building docs"
docker build -t ssp_docs .
echo "-----> remove old version"
docker rm -f ssp_docs
echo "-----> starting docs"
docker run --name project_docs -d --network=host project_docs
echo "-----> project_docs ready: http:localhost"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<p class="demo">
{{ msg }}
</p>
</template>

<script>
export default {
data () {
return {
msg: 'Hello this is <Foo-Bar>'
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<p class="demo">This is another component</p>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<p class="demo">
{{ msg }}
</p>
</template>

<script>
export default {
data() {
return {
msg: 'Hello this is <demo-component>'
}
}
}
</script>
107 changes: 107 additions & 0 deletions lib/generators/documentation-system/templates/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
const { description } = require('../../package')

module.exports = {
/**
* Ref:https://v1.vuepress.vuejs.org/config/#title
*/
title: 'Project Documentation System',
/**
* Ref:https://v1.vuepress.vuejs.org/config/#description
*/
description: description,

/**
* Extra tags to be injected to the page HTML `<head>`
*
* ref:https://v1.vuepress.vuejs.org/config/#head
*/
head: [
['meta', { name: 'theme-color', content: '#3eaf7c' }],
['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }]
],

/**
* Theme configuration, here is the default theme configuration for VuePress.
*
* ref:https://v1.vuepress.vuejs.org/theme/default-theme-config.html
*/
themeConfig: {
repo: '',
editLinks: false,
docsDir: '',
editLinkText: '',
lastUpdated: false,
nav: [
{
text: 'References',
link: '/references/',
},
{
text: 'How to',
link: '/how-to/',
},
{
text: 'Tutorials',
link: '/tutorials/',
},
{
text: 'Explanations',
link: '/explanations/',
},
{
text: 'VuePress',
link: 'https://v1.vuepress.vuejs.org'
}
],
sidebar: {
'/references/': [
{
title: 'References',
collapsable: false,
children: [
'',
'documentation-system.md'
]
}
],
'/how-to/': [
{
title: 'How to',
collapsable: false,
children: [
'',
'contribute.md'
]
}
],
'/tutorials/': [
{
title: 'Tutorials',
collapsable: false,
children: [
'',
'create-a-doc.md'
]
}
],
'/explanations/': [
{
title: 'Explanations',
collapsable: false,
children: [
''
]
}
],
}
},

/**
* Apply plugins,ref:https://v1.vuepress.vuejs.org/zh/plugin/
*/
plugins: [
'@vuepress/plugin-back-to-top',
'@vuepress/plugin-medium-zoom',
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Client app enhancement file.
*
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
*/

export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
// ...apply enhancements for the site.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Custom Styles here.
*
* ref:https://v1.vuepress.vuejs.org/config/#index-styl
*/

.home .hero img
max-width 450px!important
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Custom palette here.
*
* ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl
*/

$accentColor = #3eaf7c
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
15 changes: 15 additions & 0 deletions lib/generators/documentation-system/templates/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
home: true
heroImage: https://v1.vuepress.vuejs.org/hero.png
tagline: <%= description %>
actionText: Quick Start →
actionLink: /references/
features:
- title: Feature 1 Title
details: Feature 1 Description
- title: Feature 2 Title
details: Feature 2 Description
- title: Feature 3 Title
details: Feature 3 Description
footer: Made by <%= author %> with ❤️
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Documentation system 'Explanations'

> Documentation "Understanding oriented"

- Most useful when we're studying
- Theoretical knowledge

[Divio Documentation System resources 'explanations'](https://documentation.divio.com/explanation/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Documentation system 'How to'

> Documentation "Problem oriented"

- Most useful when we're working
- Practical knowledge

[Divio Documentation System resources 'how to'](https://documentation.divio.com/how-to-guides/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# How to contribute

1. Create your feature branch: `git checkout -b my-new-feature` (may need a fork before)
2. Commit your changes: `git commit -am 'Add some feature'`
3. Push to the branch: `git push origin my-new-feature`
4. Submit a pull request

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Documentation system 'References'

> Documentation "Information oriented"

- Most useful when we're working
- Theoretical knowledge

[Divio Documentation System resources 'references'](https://documentation.divio.com/reference/)

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The Documentation System

## by Divio
You can learn 'Documentation system' at Divio's website: [https://documentation.divio.com/](https://documentation.divio.com/)



## TLDR;

![Divio](https://documentation.divio.com/_images/overview.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Documentation system 'Tutorials'

> Documentation "Learning oriented"

- Most useful when we are studying
- Practical knowledge

[Divio Documentation System resources 'tutorials'](https://documentation.divio.com/tutorials/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Create a documentation for this project

1. [learn documentation system](/references/documentation-system.md)
2. Identify the type of documentation you want
3. just do it!
4. [contribute](/how-to/contribute.md)

19 changes: 19 additions & 0 deletions lib/generators/documentation-system/templates/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "<%= name %>",
"version": "0.0.1",
"description": "<%= description %>",
"main": "index.js",
"authors": {
"name": "<%= author %>",
"email": "<%= mail %>"
},
"repository": "<%= repo %>/<%= name %>",
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs"
},
"license": "MIT",
"devDependencies": {
"vuepress": "^1.5.3"
}
}
4 changes: 3 additions & 1 deletion lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const mkdirp = require('mkdirp');
const inquirer = require('inquirer');
const clipboardy = require('clipboardy');

const sequences = ['docs', 'blog'];
const sequences = ['docs', 'blog', 'documentation-system'];

const generators = fs
.readdirSync(`${__dirname}/generators`)
Expand Down Expand Up @@ -52,6 +52,8 @@ const runGenerator = (
}

console.log('✨ File Generate Done');
console.log('Now you can Run "npm install" and "npm run dev"');

resolve(true);
});
});
Expand Down
Loading