xcatliu / pagic

A static site generator powered by Deno + React
https://pagic.org
MIT License
1.65k stars 103 forks source link

Please tell me migration procedure about sidebar (Breaking Change) #36

Closed yoshixmk closed 4 years ago

yoshixmk commented 4 years ago

Describe the bug Can you give me an example of the migration procedure for the sidebar?
Sorry, I tried looking at the code to understand how to set it up, but I didn't understand.

error: Uncaught TypeError: sidebarConfig.map is not a function
  return sidebarConfig.map((sidebarConfigItem) => {
                       ^
    at parseSidebarConfig (sidebar.tsx:54:24)
    at Object.fn (sidebar.tsx:35:31)
    at Pagic.runPlugins (Pagic.ts:301:20)
    at async Pagic.rebuild (Pagic.ts:149:5)
    at async Pagic.build (Pagic.ts:133:5)

To Reproduce When pagic build at https://github.com/yoshixmk/profile, this error occurs. Here is Detail Log by Github Action.

Expected behavior

Context

xcatliu commented 4 years ago

Sorry for the confusing.

Yes there is a breaking change in sidebar

The new sidebar config for your project should be:

export default {
  sidebar: {
    '/': [
      "README.md",
      {
        link: "articles/README.md",
        children: [
          "articles/001-deno-introduction-in-my-company.md",
          "articles/002-news-published-third-party-module.md",
          "articles/003-deno-introduction-at-ts-study-meeting.md",
          "articles/004-deno-introduce-by-yoshixmk-regret-10-things.tsx",
          "articles/005-deno-react-chat.md",
          "articles/006-tege-next-introduction.md",
        ],
      },
      {
        link: "translations/README.md",
        children: [
          "translations/001-perfomance-aspect-of-deno-vs-node-js.md",
          "translations/002-what-is-the-best-deno-web-framework.md",
          "translations/003-registration-form-mongodb.md",
          "translations/004-guide-to-porting-node-modules-to-deno.md",
        ],
      },
    ]
  }
};
xcatliu commented 4 years ago

The new version also support different sidebar in different path, for example:

export default {
  sidebar: {
    '/docs/': [
      "translations/001-perfomance-aspect-of-deno-vs-node-js.md",
      "translations/002-what-is-the-best-deno-web-framework.md"
    ],
    '/news/': [
      "README.md",
      {
        link: "articles/README.md",
        children: [
          "articles/001-deno-introduction-in-my-company.md",
          "articles/002-news-published-third-party-module.md"
        ],
      }
    ]
  }
};

For the above example,

xcatliu commented 4 years ago

I'm writing the documentation of pagic 1.0 There should be a detailed description then.

yoshixmk commented 4 years ago

Thx, it works. I am looking forward to pagic 1.0!!