dumi icon indicating copy to clipboard operation
dumi copied to clipboard

feat: Support glob pattern for `menus.children`

Open oMaten opened this issue 4 years ago • 4 comments

Description

I put my widgets documents under widgets folder. For now, i have to define children property via Node API.

import { defineConfig } from 'dumi';
import fs from 'fs';

export default defineConfig({
  menus: {
    '/widgets': [
      {
        title: 'Widgets List',
        // scan dirs under `widgets` folder
        children: fs.readdirSync('src/widgets').map((dir) => `widgets/${dir}`),
      },
    ],
  },
});

Solution

Maybe it's better to support glob pattern for children field.

import { defineConfig } from 'dumi';
import fs from 'fs';

export default defineConfig({
  menus: {
    '/widgets': [
      {
        title: 'Widgets List',
        // scan dirs under `widgets` folder
        children: 'widgets/*'
      },
    ],
  },
});

oMaten avatar Aug 12 '21 06:08 oMaten

Hello @oMaten. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please be sure to fill in the default template in the Pull Request, provide changelog/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!

你好 @oMaten,我们完全同意你的提议/反馈,欢迎直接在此仓库创建一个 Pull Request 来解决这个问题。请务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。

github-actions[bot] avatar Aug 12 '21 08:08 github-actions[bot]

@PeachScript Hi, Has anybody made a PR for this? if not , i want to have a try.

FireBushtree avatar Dec 20 '22 08:12 FireBushtree

@FireBushtree thanks! But unfortunately the dumi 1.x is no longer updated, and 2.x deprecated the filename usage. So...are you interested in solving other issues?

PeachScript avatar Dec 20 '22 08:12 PeachScript

@PeachScript ok, i am very glad to solve other issuses!

FireBushtree avatar Dec 20 '22 09:12 FireBushtree