Skip to content

Commit

Permalink
docs($site): add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iq9891 committed Mar 14, 2022
1 parent 7cd5e34 commit fa2bf74
Show file tree
Hide file tree
Showing 20 changed files with 3,252 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue,sh,md}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.DS_Store

node_modules
**/*/node_modules

.idea
/.vscode/
.npmrc

dist
dist-ssr
TODOs.md
*.log
temp
explorations
*.local
*.cpuprofile
*.iml
.history

# lock
package-lock.json
**/*/package-lock.json
yarn.lock
**/*/yarn.lock

# debug
*debug.log
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.yaml
*.hbs
*.yml
dist/
changelog.md
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @format */

module.exports = {
...require('@fe6/norm-prettier'),
};
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @format */

module.exports = {
extends: ['@fe6/norm-git-cz-config'],
};
28 changes: 28 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/** @format */

module.exports = {
title: 'BIU',
description: '可插拔的企业级应用程序框架',
themeConfig: {
repo: 'fe6/biu',
// logo: '/logo.svg',
docsDir: 'docs',
docsBranch: 'next',
editLinks: true,
editLinkText: '修改这页内容',

nav: [
// { text: '指引', link: '/guide/' },
{ text: '开发', link: '/develop/' },
{ text: '配置', link: '/config/' },
{ text: '插件', link: '/plugin/' },
],

sidebar: {
// '/guide/': 'auto',
'/develop/': 'auto',
'/config/': 'auto',
'/plugins/': 'auto',
},
},
};
26 changes: 26 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @format */

* {
font-family: '微软雅黑';
}
:root {
--c-brand: #eb2f96;
--c-brand-light: #ff85c0;
}
#main-title {
font-size: 5rem !important;
}

.release-tag {
font-size: 0.6rem;
font-weight: bold;
display: inline-block;
position: absolute;
top: 0;
/* transform: translateY(-50%); */
padding: 6px;
margin-left: 6px;
background: var(--c-brand);
color: white;
border-radius: 3px;
}
16 changes: 16 additions & 0 deletions docs/.vitepress/theme/fetch-release-tag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @format */

import { onMounted } from 'vue';
// import pkg from '../../../packages/emp/package.json'
export default function fetchReleaseTag() {
onMounted(() => {
const mainTitle = document.getElementById('main-title');
mainTitle.style.position = 'relative';
const docsReleaseTag = document.createElement('span');
docsReleaseTag.classList.add('release-tag');
// const releaseTagName = `v${pkg.version}`
const releaseTagName = `v1.0.0`;
docsReleaseTag.innerText = releaseTagName;
mainTitle.appendChild(docsReleaseTag);
});
}
6 changes: 6 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @format */

import DefaultTheme from 'vitepress/theme';
import './custom.css';

export default DefaultTheme;
30 changes: 30 additions & 0 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- @format -->

# Why BIU

## 💡 解决的问题

- HTML 模板的真正定制
- 支持注入 JS 、 CSS 等
- 动态更改 TITLE 等
- 可在 VUE 文件中直接用组件的形式修改 title
- 参考 [import { Helmet } from 'umi';](https://umijs.org/zh-CN/docs/ssr#%E9%A1%B5%E9%9D%A2%E6%A0%87%E9%A2%98%E6%B8%B2%E6%9F%93)
- 专注企业级微前端
- 目前只支持网站的构建,微前端,( empShare 、 module federation )
- REACT 17+ 、 VUE 3
- 多页面模式
- 可作为基座,暴露组件等,也可单独运行。
- esm 及共享
- d.ts 同步协助,一键生成同步

## ⚡️ 版本定位

- 公共的业务模块不在用 sub git , npm
- 组件,各种钩子,各种辅助方法,ajax 统一初始化等业务方面的最佳实践及更好的管理
- 一体化,私有部署的最佳实践

## 📦 特有功能

- 实现 `empshare` 3 级共享模型
- 重写 `d.ts` 生成于同步逻辑,实现跨业务开发的自动同步体验
- 基于 `swc` 深度定制 `js``ts` loader,实现更加高效的开发体验
44 changes: 44 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
home: true
# heroImage: /logo.svg
actionText: Get Started
actionLink: /develop/

altActionText: Learn More
altActionLink: /guide/

features:
- title: 🔑 可扩展
details: BIU 实现了完整的生命周期,并使其插件化, BIU 内部功能也全由插件完成。此外还支持插件和插件集,以满足功能和垂直域的分层需求.
- title: 🔑 面向未来
details: 在满足需求的同时,我们也不会停止对新技术的探索。比如 modern mode、webpack@5、自动化 external 、 bundler less 等等.
- title: 🔑 大量自研
details: 包含微前端、组件打包、文档工具、请求库、hooks 库、数据流等,满足日常项目的周边需求.
- title: 💡 微组件化
details: 结合 webpack5 、 Module Federation 的丰富项目实战、建立三层共享模型
- title: ⚡️ 快速构建重载
details: 结合 SWC 进行 bundle 编译构建、提升整体构建速度.
- title: 🛠️ 多功能模块支持
details: 对 TypeScript 、 JSX 、 CSS 、 Less 、 Sass 等支持开箱即用。
- title: 📦 优化的构建
details: 可选 “多页应用”模式的预配置 webpack 构建.
- title: 🔩 通用的插件
details: 在开发和构建之间共享 webpack chain 插件接口.
- title: 🔑 TS 重构项目
details: 提供灵活的 api 、 Plugin 以及完整的类型提示.
- title: 🔑 区块化
details: 完善的区块市场,垂直业务场景.
- title: 🔑 UI
details: 一键添加区块.
- title: 🔑 企业级
details: 经过数百个项目的打磨,经得住考验.

footer: MIT Licensed | Copyright © 2022 Tian Yi
---

<!-- @format -->

<script setup>
import fetchReleaseTag from './.vitepress/theme/fetch-release-tag.js'
fetchReleaseTag()
</script>
33 changes: 33 additions & 0 deletions docs/plugin/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- @format -->

# 插件

:::tip 主要项
EMP v2 plugin 结合 webpack chain 提供对 webpack 自定义配置,详细类型 [[点击了解]](https://github.com/efoxTeam/emp/blob/26c89aa3fc5494f274a714b6b09844b66b5e1237/packages/emp/src/config/plugins.ts#L9)
:::

## 官方插件

### [@efox/emp/plugin-vue-2](https://github.com/efoxTeam/emp/tree/next/packages/plugin-vue-2)

- 提供 vue 2 编译支持

```js
const { defineConfig } = require('@efox/emp');
const vue = require('@efox/plugin-vue-2');
module.exports = defineConfig({
plugins: [vue],
});
```

### [@efox/emp/plugin-babel-react](https://github.com/efoxTeam/emp/tree/next/packages/plugin-babel-react)

- 提供 react babel 编译支持

```js
const { defineConfig } = require('@efox/emp');
const babelReact = require('@efox/plugin-babel-react');
module.exports = defineConfig({
plugins: [babelReact],
});
```
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "biu",
"description": "Pluggable enterprise-level application framework.",
"scripts": {
"build": "pnpm build:pkg",
"build:pkg": "pnpm run --filter=@efox/emp build && pnpm run --filter=@efox/* --filter=!@efox/emp --parallel build",
"docs:dev": "vitepress dev docs --host",
"docs:build": "vitepress build docs",
"docs:start": "vitepress serve docs --host",
"prebuild": "[[ $CI = true ]] && npx pnpm@6 install -r --store=node_modules/.pnpm-store || echo skiping pnpm install",
"lint": "pretty-quick",
"postinstall": "husky install"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fe6/biu.git"
},
"author": "tianyi",
"license": "MIT",
"bugs": {
"url": "https://github.com/fe6/biu/issues"
},
"homepage": "https://github.com/fe6/biu#readme",
"devDependencies": {
"@commitlint/cli": "^16.2.1",
"@commitlint/config-conventional": "^16.2.1",
"@fe6/norm-git-cz-config": "^0.1.1",
"@fe6/norm-prettier": "^0.1.0",
"cz-customizable": "^6.3.0",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"vitepress": "^0.22.3"
},
"packageManager": "pnpm@6.32.0",
"engines": {
"node": ">= 16.0.0",
"pnpm": ">=6"
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
},
"cz-customizable": {
"config": "node_modules/@fe6/norm-git-cz-config/customizable.js"
}
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"react",
"react-dom",
"@types/react"
]
}
}
}
Loading

0 comments on commit fa2bf74

Please sign in to comment.