umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.56k stars 1.17k forks source link

feat: Support glob pattern for `menus.children` #823

Open oMaten opened 3 years ago

oMaten commented 3 years ago

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/*'
      },
    ],
  },
});
github-actions[bot] commented 3 years ago

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,提前感谢和期待您的贡献。

FireBushtree commented 1 year ago

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

PeachScript commented 1 year ago

@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?

FireBushtree commented 1 year ago

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