Skip to content

Commit

Permalink
docs: dumi (#4879)
Browse files Browse the repository at this point in the history
* feat(docs): use dumi to build docs

* chore(docs): remove doctools & ignore dist

* chore(docs): use github action to deploy docs

* test(docs): skip doc tests

* docs: support jsdoc

* docs: remove title in community

* docs: update readme banner src
  • Loading branch information
thonatos committed Feb 11, 2022
1 parent 56816db commit b474097
Show file tree
Hide file tree
Showing 164 changed files with 4,535 additions and 2,913 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/gh-pages.yml
@@ -0,0 +1,35 @@
name: Github Pages

on:
push:
branches:
- master

jobs:
Runner:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
node-version: [ 16 ]
steps:
- name: Checkout Git Source
uses: actions/checkout@master

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i -g npminstall && npminstall

- name: Build Documents
run: npm run docs:build

- name: Code Coverage
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/dist
16 changes: 6 additions & 10 deletions .gitignore
Expand Up @@ -10,16 +10,6 @@ run
.idea
.DS_Store
.tmp
docs/CONTRIBUTING.md
docs/node_modules
docs/README.md
docs/db.json
docs/source/release/index.md
docs/source/member_guide.md
docs/source/_data/versions.yml
docs/**/contributing.md
docs/public
docs/plugins.png

package-lock.json
yarn.lock
Expand All @@ -33,3 +23,9 @@ test/fixtures/apps/app-ts/**/*.js
!test/fixtures/apps/app-ts/node_modules/**/*.js
test/fixtures/apps/app-ts-esm/**/*.js
test/fixtures/apps/app-ts-type-check/**/*.js

# docs
.umi
.umi-production
docs/dist
!docs/public
4 changes: 2 additions & 2 deletions README.md
@@ -1,5 +1,5 @@
<div style="text-align:center">
<img src="docs/assets/egg-banner.png" />
<img src="docs/public/assets/egg-banner.png" />
</div>

[![NPM version](https://img.shields.io/npm/v/egg.svg?style=flat-square)](https://npmjs.org/package/egg)
Expand Down Expand Up @@ -43,7 +43,7 @@ $ open http://localhost:7001

## Contributors

[![contributors](https://ergatejs.implements.io/badges/contributors/eggjs/egg.png)](https://github.com/eggjs/egg/graphs/contributors)
[![contributors](https://ergatejs.implements.io/badges/contributors/eggjs/egg.svg)](https://github.com/eggjs/egg/graphs/contributors)

## How to Contribute

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Expand Up @@ -39,7 +39,7 @@ $ open http://localhost:7001

## 贡献者

[![contributors](https://ergatejs.implements.io/badges/contributors/eggjs/egg.png)](https://github.com/eggjs/egg/graphs/contributors)
[![contributors](https://ergatejs.implements.io/badges/contributors/eggjs/egg.svg)](https://github.com/eggjs/egg/graphs/contributors)

## 贡献代码

Expand Down
38 changes: 38 additions & 0 deletions docs/.dumi/theme/layout.tsx
@@ -0,0 +1,38 @@
import React, { useContext } from 'react';
import { context } from 'dumi/theme';
import Layout from 'dumi-theme-default/es/layout';

const style = {
wrap: {
marginBottom: '1em',
boxShadow: '0px 1px 0px rgba(0,0,0,0.1)',
},
title: {
color: '#454d64',
},
};

export default ({ children, ...props }) => {
const { meta } = useContext(context);
const { title, hero } = meta;

const renderTitle = () => {
if (hero) {
return null;
}

return (
<div style={style.wrap}>
<h1 style={style.title}>{title}</h1>
</div>
);
};

return (
<Layout {...props}>
{renderTitle()}

{children}
</Layout>
);
};
9 changes: 9 additions & 0 deletions docs/.prettierignore
@@ -0,0 +1,9 @@
**/*.svg
**/*.ejs
**/*.html
package.json

.umi
.umi-production

dist
11 changes: 11 additions & 0 deletions docs/.prettierrc
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
29 changes: 0 additions & 29 deletions docs/_config.yml

This file was deleted.

63 changes: 63 additions & 0 deletions docs/config/config.ts
@@ -0,0 +1,63 @@
import { defineConfig } from 'dumi';

export default defineConfig({
mode: 'site',
title: 'Egg',

description: 'Born to build better enterprise frameworks and apps',

logo: '/logo.svg',
favicon: '/favicon.png',

algolia: {
apiKey: '1561de31a86f79507ea00cdb54ce647c',
indexName: 'eggjs',
},

exportStatic: {},

sitemap: {
hostname: 'https://eggjs.org',
},

navs: {
'en-US': [
null,
{
title: 'API',
path: 'https://eggjs.org/api/index.html',
},
{
title: 'GitHub',
path: 'https://github.com/eggjs/egg',
},
{
title: 'Release',
path: 'https://github.com/eggjs/egg/releases',
},
{
title: 'Plugins',
path: 'https://github.com/search?q=topic%3Aegg-plugin&type=Repositories',
},
],
'zh-CN': [
null,
{
title: 'API',
path: 'https://eggjs.org/api/index.html',
},
{
title: 'GitHub',
path: 'https://github.com/eggjs/egg',
},
{
title: '插件列表',
path: 'https://github.com/search?q=topic%3Aegg-plugin&type=Repositories',
},
{
title: '发布日志',
path: 'https://github.com/eggjs/egg/releases',
},
],
},
});

1 comment on commit b474097

@vercel
Copy link

@vercel vercel bot commented on b474097 Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.