Skip to content

Commit

Permalink
chore: upgrade dumi to v2.x (#2493)
Browse files Browse the repository at this point in the history
* chore(deps): upgrade dumi from ^1.1.48 to ^2.1.13

* chore: modify prepare command

* chore: modify gitignore

* chore(ts): add new paths

* docs: change single-tag to double-tag

* chore: 调整 dumi 配置

* docs: demo 中的注释字段升级

* docs: 文档 FrontMatter 完善

* docs: 补充 en 文档的 FrontMatter

* chore: rename dir

* chore: 调整配置

* refactor: 调整样式

* docs: 调整 Hooks nav 的顺序

* docs: close tag

* style: format

* chore: use dumi contract routing

* chore: remove comment & update i18n

* chore: format & lint

* chore: update eslint config & ts alias

* chore: use dumi-theme-antd

* chore: update

* chore: update home page

* docs: update i18n of useRequest

* docs: update title

* chore: update

* chore: update dumi theme

* docs: update

* chore: update theme deps & config

* chore: update lock

* chore: update theme

* docs: change demo to 2 cols

* chore: change theme pkg name

* chore: update dumi config

* docs: request docs update

* docs: update

* chore: update dumi and dumi theme to latest

* chore: demo - space wrap

* docs: update

* docs: remove h1 title

* docs: update

* docs: update
  • Loading branch information
liuyib authored Mar 13, 2024
1 parent dfc55d8 commit 5464309
Show file tree
Hide file tree
Showing 385 changed files with 13,400 additions and 7,637 deletions.
12 changes: 12 additions & 0 deletions .dumi/pages/index.en-US.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* sidebar: false
*/

import React from 'react';
import { HomeBaseLayout } from '@ahooks.js/dumi-theme-antd';

const Index = () => {
return <HomeBaseLayout></HomeBaseLayout>;
};

export default Index;
12 changes: 12 additions & 0 deletions .dumi/pages/index.zh-CN.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* sidebar: false
*/

import React from 'react';
import { HomeBaseLayout } from '@ahooks.js/dumi-theme-antd';

const Index = () => {
return <HomeBaseLayout></HomeBaseLayout>;
};

export default Index;
4 changes: 4 additions & 0 deletions .dumi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig.json",
"include": ["**/*"]
}
155 changes: 155 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { defineConfig } from 'dumi';

const packages = require('./packages/hooks/package.json');

export default defineConfig({
mfsu: false,
ssr: process.env.NODE_ENV === 'development' ? false : {},
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' },
],
},
sitemap: {
hostname: 'https://ahooks.js.org/',
},
favicons: ['/simple-logo.svg'],
locales: [
{ id: 'en-US', name: 'English' },
{ id: 'zh-CN', name: '中文' },
],
themeConfig: {
logo: '/logo.svg',
title: 'ahooks',
bannerConfig: {
showBanner: false,
},
description: {
'en-US': 'A high-quality & reliable React Hooks library',
'zh-CN': '一套高质量可靠的 React Hooks 库',
},
actions: {
'en-US': [
{ text: 'Getting Started', link: '/guide', type: 'primary' },
{ text: 'Hooks List', link: '/hooks/index' },
],
'zh-CN': [
{ text: '开始使用', link: '/zh-CN/guide', type: 'primary' },
{ text: 'Hooks 列表', link: '/zh-CN/hooks/index' },
],
},
features: {
'en-US': [
{ title: 'Easy to learn and use' },
{ title: 'Supports SSR' },
{ title: 'Special treatment for functions, avoid closure problems' },
{
title:
'Contains a large number of advanced Hooks that are refined from business scenarios',
},
{ title: 'Contains a comprehensive collection of basic Hooks' },
{ title: 'Written in TypeScript with predictable static types' },
],
'zh-CN': [
{ title: '易学易用' },
{ title: '支持 SSR' },
{ title: '对输入输出函数做了特殊处理,避免闭包问题' },
{ title: '包含大量提炼自业务的高级 Hooks' },
{ title: '包含丰富的基础 Hooks' },
{ title: '使用 TypeScript 构建,提供完整的类型定义文件' },
],
},
rtl: true,
socialLinks: {
github: 'https://github.com/alibaba/hooks',
},
docVersions: {
[packages.version]: '',
'v2.x': 'https://ahooks-v2.js.org/',
'v1.x': 'http://hooks.umijs.org/',
},
localesEnhance: [
{ id: 'en-US', switchPrefix: 'En' },
{ id: 'zh-CN', switchPrefix: '中' },
],
sidebarGroupModePath: ['/guide', '/hooks', '/blog'],
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: 'Mirror', link: 'https://ahooks.gitee.io' },
],
'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' },
],
},
footer:
'Open-source MIT Licensed | Copyright © 2019-present<br />Powered by <a href="https://d.umijs.org" target="_blank">dumi</a>',
},
links: [
// Used by the `useFusionTable` demo
{
rel: 'stylesheet',
href: 'https://unpkg.com/@alifd/[email protected]/dist/next-noreset.min.css',
},
{ rel: 'stylesheet', href: '/style.css' },
],
scripts: [
`const insertVersion = function() {
const logo = document.querySelector('.__dumi-default-navbar-logo');
if (!logo) return;
const dom = document.createElement('span');
dom.id = 'logo-version';
dom.innerHTML = '${packages.version}';
logo.parentNode.insertBefore(dom, logo.nextSibling);
};
const observer = new MutationObserver((mutationsList, observer) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const logoVersion = document.querySelector('#logo-version');
if (logoVersion) {
observer.disconnect();
} else {
insertVersion();
}
}
}
});
observer.observe(document.body, { childList: true, subtree: true });`,
],
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
'antd',
],
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: false,
},
'fusion',
],
],
// https://github.com/alibaba/hooks/issues/2155
extraBabelIncludes: ['filter-obj'],
});
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = {
'@typescript-eslint/no-parameter-properties': 'off',
'import/no-useless-path-segments': 'off',
'no-unused-expressions': 'off',
'react/no-array-index-key': 'off',
'react/no-unescaped-entities': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off',
'no-await-in-loop': 'off',
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ node_modules
coverage
.doc
.DS_Store
.umi
.umi-production
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
page
lerna-debug.log
tsconfig.tsbuildinfo
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
{
"files": ["*.md"],
"options": {
"embeddedLanguageFormatting": "off"
"embeddedLanguageFormatting": "off",
"proseWrap": "preserve"
}
}
]
Expand Down
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@

<div align="center">

A high-quality & reliable React Hooks library.

[![NPM version][image-1]][1]
[![NPM downloads][image-2]][2]
[![npm](https://img.shields.io/npm/dw/ahooks-v2?label=downloads%28v2%29)](https://www.npmjs.com/package/ahooks-v2)
[![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues)
[![Coverage Status](https://coveralls.io/repos/github/alibaba/hooks/badge.svg?branch=master)](https://coveralls.io/github/alibaba/hooks?branch=master)
![gzip size](https://img.badgesize.io/https:/unpkg.com/ahooks/dist/ahooks.js?label=gzip%20size&compression=gzip)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Percentage of issues still open')
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Average time to resolve an issue')
![GitHub](https://img.shields.io/github/license/alibaba/hooks)
A high-quality & reliable React Hooks library

[![NPM version](https://img.shields.io/npm/v/ahooks.svg)](https://www.npmjs.com/package/ahooks) [![NPM downloads](https://img.shields.io/npm/dw/ahooks.svg)](https://npmjs.org/package/ahooks) [![npm](https://img.shields.io/npm/dw/ahooks-v2?label=downloads%28v2%29)](https://www.npmjs.com/package/ahooks-v2) [![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues) [![Coverage Status](https://coveralls.io/repos/github/alibaba/hooks/badge.svg)](https://coveralls.io/github/alibaba/hooks?branch=master) [![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues) ![gzip size](https://img.badgesize.io/https:/unpkg.com/ahooks/dist/ahooks.js?label=gzip%20size&compression=gzip) [![Percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Percentage of issues still open') [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Average time to resolve an issue') [![GitHub](https://img.shields.io/github/license/alibaba/hooks)](https://github.com/alibaba/hooks/blob/master/LICENSE)

English | [简体中文](https://github.com/alibaba/hooks/blob/master/README.zh-CN.md)

Expand Down Expand Up @@ -80,8 +72,3 @@ Thanks to all the contributors:
## 👥 Discuss

<img src="https://github.com/alibaba/hooks/assets/49217418/ba636378-1dff-4754-bfe6-46923417cd3b" width="200" style='display:inline' /><img src="https://github.com/alibaba/hooks/assets/49217418/93a169ce-f9d1-4a66-a829-9f16e790ee28" width="200" style='display:inline' /><img src="https://github.com/alibaba/hooks/assets/49217418/d30d80c7-eb16-4522-acab-f2d48513464a" width="200" style='display:inline' />

[1]: https://www.npmjs.com/package/ahooks
[2]: https://npmjs.org/package/ahooks
[image-1]: https://img.shields.io/npm/v/ahooks.svg?style=flat
[image-2]: https://img.shields.io/npm/dw/ahooks.svg?style=flat
17 changes: 2 additions & 15 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@

一套高质量可靠的 React Hooks 库

[![NPM version][image-1]][1]
[![NPM downloads][image-2]][2]
[![npm](https://img.shields.io/npm/dw/ahooks-v2?label=downloads%28v2%29)](https://www.npmjs.com/package/ahooks-v2)
[![Coverage Status](https://coveralls.io/repos/github/alibaba/hooks/badge.svg?branch=master)](https://coveralls.io/github/alibaba/hooks?branch=master)
[![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues)
![gzip size](https://img.badgesize.io/https:/unpkg.com/ahooks/dist/ahooks.js?label=gzip%20size&compression=gzip)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Percentage of issues still open')
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Average time to resolve an issue')
![GitHub](https://img.shields.io/github/license/alibaba/hooks)
[![NPM version](https://img.shields.io/npm/v/ahooks.svg)](https://www.npmjs.com/package/ahooks) [![NPM downloads](https://img.shields.io/npm/dw/ahooks.svg)](https://npmjs.org/package/ahooks) [![npm](https://img.shields.io/npm/dw/ahooks-v2?label=downloads%28v2%29)](https://www.npmjs.com/package/ahooks-v2) [![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues) [![Coverage Status](https://coveralls.io/repos/github/alibaba/hooks/badge.svg)](https://coveralls.io/github/alibaba/hooks?branch=master) [![npm](https://img.shields.io/github/issues/alibaba/hooks)](https://github.com/alibaba/hooks/issues) ![gzip size](https://img.badgesize.io/https:/unpkg.com/ahooks/dist/ahooks.js?label=gzip%20size&compression=gzip) [![Percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Percentage of issues still open') [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/hooks.svg)](http://isitmaintained.com/project/alibaba/hooks 'Average time to resolve an issue') [![GitHub](https://img.shields.io/github/license/alibaba/hooks)](https://github.com/alibaba/hooks/blob/master/LICENSE)

[English](https://github.com/alibaba/hooks/blob/master/README.md) | 简体中文

Expand Down Expand Up @@ -50,7 +42,7 @@ $ bun add ahooks

## 🔨 使用

```js
```ts
import { useRequest } from 'ahooks';
```

Expand Down Expand Up @@ -80,8 +72,3 @@ $ pnpm start
## 👥 交流讨论

<img src="https://github.com/alibaba/hooks/assets/49217418/ba636378-1dff-4754-bfe6-46923417cd3b" width="200" style='display:inline' /><img src="https://github.com/alibaba/hooks/assets/49217418/93a169ce-f9d1-4a66-a829-9f16e790ee28" width="200" style='display:inline' /><img src="https://github.com/alibaba/hooks/assets/49217418/d30d80c7-eb16-4522-acab-f2d48513464a" width="200" style='display:inline' />

[1]: https://www.npmjs.com/package/ahooks
[2]: https://npmjs.org/package/ahooks
[image-1]: https://img.shields.io/npm/v/ahooks.svg?style=flat
[image-2]: https://img.shields.io/npm/dw/ahooks.svg?style=flat
Loading

0 comments on commit 5464309

Please sign in to comment.