Skip to content

Commit

Permalink
chore: use dumi contract routing
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyib committed Feb 28, 2024
1 parent 5b44365 commit 46feb11
Show file tree
Hide file tree
Showing 189 changed files with 278 additions and 203 deletions.
128 changes: 77 additions & 51 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,72 @@ import { defineConfig } from 'dumi';
const packages = require('./packages/hooks/package.json');

export default defineConfig({
// ssr: {},
hash: true,
mfsu: false,
favicons: ['/simple-logo.svg'],
hash: true,
manifest: {},
alias: {
ahooks: process.cwd() + '/packages/hooks/src/index.ts',
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
},
resolve: {
docDirs: ['docs'],
atomDirs: [
{ type: 'hook', dir: 'packages/hooks/src' },
{ type: 'hook', dir: 'packages/hooks/src/useRequest/docs' },
{ type: 'hook', dir: 'packages/use-url-state' },
],
codeBlockMode: 'passive',
},
locales: [
{ id: 'zh-CN', name: '中文' },
{ id: 'en-US', name: 'English' },
],
alias: {
ahooks: process.cwd() + '/packages/hooks/src/index.ts',
'@ahooksjs/use-url-state': process.cwd() + '/packages/use-url-state/src/index.ts',
},
// TODO: 原来的统计使用的是:https://s4.cnzz.com/z_stat.php?id=1278992092&web_id=1278992092,但这个链接无法访问,
// 是否需要切换到 dumi 内置的统计功能中
analytics: {},
manifest: {},
sitemap: {
hostname: 'https://ahooks.js.org/',
},
locales: [
{ id: 'en-US', name: 'English' },
{ id: 'zh-CN', name: '中文' },
],
favicons: ['/simple-logo.svg'],
themeConfig: {
// name: `ahooks ${packages.version}`,
logo: '/logo.svg',
prefersColor: { default: 'auto', switch: true },
// name: packages.version, // TODO: 溢出了
prefersColor: {
default: 'light',
switch: true,
},
footer:
'Open-source MIT Licensed | Copyright © 2019-present<br />Powered by <a href="https://d.umijs.org" target="_blank">dumi</a>',
socialLinks: {
github: 'https://github.com/alibaba/hooks',
},
nav: {
'en-US': [
{ title: 'Guide', link: '/guide' },
{ title: 'Hooks', link: '/hooks/index' },
{ title: 'Blog', link: '/blog/function' },
{ title: 'Releases', link: 'https://github.com/alibaba/hooks/releases' },
{ title: '国内镜像', link: 'https://ahooks.gitee.io/zh-CN' },
{
title: 'Legacy Versions',
children: [
{ title: 'v2.x', link: 'https://ahooks-v2.js.org/' },
{ title: 'v1.x', link: 'http://hooks.umijs.org/' },
],
},
],
'zh-CN': [
{ title: '指南', link: '/zh-CN/guide' },
{ title: 'Hooks', link: '/zh-CN/hooks/index' },
{ title: '博客', link: '/zh-CN/blog/function' },
{ title: '更新日志', link: 'https://github.com/alibaba/hooks/releases' },
{ title: '国内镜像', link: 'https://ahooks.gitee.io/zh-CN' },
{
title: '历史版本',
children: [
{ title: 'v2.x', link: 'https://ahooks-v2.js.org/' },
{ title: 'v1.x', link: 'http://hooks.umijs.org/' },
],
},
],
},
},
// https://github.com/alibaba/hooks/issues/2155
extraBabelIncludes: ['filter-obj'],
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
'antd',
],
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: false,
},
'fusion',
],
],
exportStatic: {},
/**
* TODO: dumi v1 中,该选项配置如下:
*
* nodeModulesTransform: {
* type: 'none',
* exclude: [],
* },
*
* 在 v2 中暂时不确定怎样是等价的配置
*/
// legacy: {},
links: [
// Used by the `useFusionTable` demo
{
Expand Down Expand Up @@ -105,4 +100,35 @@ export default defineConfig({
});
observer.observe(document.body, { childList: true, subtree: true });`,
],
/**
* TODO: dumi v1 中,该选项配置如下:
*
* nodeModulesTransform: {
* type: 'none',
* exclude: [],
* },
*
* 在 v2 中暂时不确定怎样是等价的配置
*/
// https://github.com/alibaba/hooks/issues/2155
extraBabelIncludes: ['filter-obj'],
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
'antd',
],
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: false,
},
'fusion',
],
],
});
121 changes: 0 additions & 121 deletions config/hooks.ts

This file was deleted.

3 changes: 2 additions & 1 deletion docs/guide/dom.en-US.md → docs/blog/dom.en-US.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Hooks of DOM specification
order: 3
order: 2
toc: content
---

## Hooks of DOM specification
Expand Down
3 changes: 2 additions & 1 deletion docs/guide/dom.zh-CN.md → docs/blog/dom.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: DOM 类 Hooks 使用规范
order: 3
order: 2
toc: content
---

## DOM 类 Hooks 使用规范
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ahooks function specification
group: Blog
order: 1
toc: content
---

# ahooks function specification
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ahooks 输入输出函数处理规范
group: Blog
order: 1
toc: content
---

# ahooks 输入输出函数处理规范
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/hmr.en-US.md → docs/blog/hmr.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & react-refresh(HMR)
group: Blog
order: 3
toc: content
---

# React Hooks & react-refresh(HMR)
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/hmr.zh-CN.md → docs/blog/hmr.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & react-refresh(HMR)
group: Blog
order: 3
toc: content
---

# React Hooks & react-refresh(HMR)
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/ssr.en-US.md → docs/blog/ssr.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & SSR
group: Blog
order: 2
order: 4
toc: content
---

# React Hooks & SSR
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/ssr.zh-CN.md → docs/blog/ssr.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & SSR
group: Blog
order: 2
order: 4
toc: content
---

# React Hooks & SSR
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/strict.en-US.md → docs/blog/strict.en-US.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & strict mode
group: Blog
order: 4
order: 5
toc: content
---

# React Hooks & strict mode
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/strict.zh-CN.md → docs/blog/strict.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: React Hooks & strict mode
group: Blog
order: 4
order: 5
toc: content
---

# React Hooks & strict mode
Expand Down
4 changes: 1 addition & 3 deletions docs/guide/index.en-US.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Intro
order: 1
nav:
title: Guide
order: 1
toc: content
---

## Intro
Expand Down
4 changes: 1 addition & 3 deletions docs/guide/index.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: 介绍
order: 1
nav:
title: 指南
order: 1
toc: content
---

# 介绍
Expand Down
Loading

0 comments on commit 46feb11

Please sign in to comment.