Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run version generates broken sidebars when subcategories exist #1115

Closed
aeneasr opened this issue Nov 15, 2018 · 2 comments
Closed

npm run version generates broken sidebars when subcategories exist #1115

aeneasr opened this issue Nov 15, 2018 · 2 comments
Assignees
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.

Comments

@aeneasr
Copy link
Contributor

aeneasr commented Nov 15, 2018

🐛 Bug Report

Running npm run version <x> generates broken sidebars on version 1.5.1.

Have you read the Contributing Guidelines on issues?

Yup

To Reproduce

Sidebar definition sidebar.json


    "ORY Hydra": [
      "hydra/hydra-index",
      {
        "type": "subcategory",
        "label": "Getting Started",
        "ids": [
          "hydra/hydra-5min-tutorial"
        ]
      },
      {
        "type": "subcategory",
        "label": "Guides",
        "ids": [
          "hydra/hydra-oauth2",
          "hydra/hydra-jwks",
          "hydra/hydra-configure-deploy",
          "hydra/hydra-advanced",
          "hydra/hydra-debugging",
          "hydra/hydra-production",
          "hydra/hydra-integration"
        ]
      },
      {
        "type": "subcategory",
        "label": "SDK",
        "ids": [
          "hydra/hydra-sdk-sdk/hydra-sdk-index",
          "hydra/hydra-sdk-sdk/hydra-sdk-api",
          "hydra/hydra-sdk-sdk/hydra-sdk-go",
          "hydra/hydra-sdk-sdk/hydra-sdk-js"
        ]
      },
      {
        "type": "subcategory",
        "label": "Further Reading",
        "ids": [
          "hydra/hydra-limitations",
          "hydra/hydra-dependencies-environment",
          "hydra/hydra-security-architecture",
          "hydra/hydra-faq",
          "hydra/hydra-appendix"
        ]
      }
    ],

yields after running npm run version oryOS.9 in ./versioned_sidebars/version-oryOS.9-sidebar.json

{
  "version-oryOS.9-docs": {
    // ...
    "ORY Hydra": [
      "version-oryOS.9-hydra/hydra-index",
      "version-oryOS.9-[object Object]",
      "version-oryOS.9-[object Object]",
      "version-oryOS.9-[object Object]",
      "version-oryOS.9-[object Object]"
    ],
    // ...

Expected behavior

The sidebar should not contain broken links.

Actual Behavior

The sidebar contains broken links.

Reproducible Demo

  1. git clone https://github.com/ory/docs.git
  2. cd docs
  3. git checkout dd96ee81cf315284ee88dd7d2fe5cb10c60be67d -b reproduceme2
  4. cd website
  5. npm i
  6. npm run version oryOS.9
  7. cat ./website/versioned_sidebars/version-oryOS.9-sidebars.json
@aeneasr
Copy link
Contributor Author

aeneasr commented Nov 15, 2018

Pretty sure this is related to #410 where this has been resolved in part but apparently not for versioned docs.

@endiliey endiliey added the bug An error in the Docusaurus core causing instability or issues with its execution label Nov 20, 2018
@endiliey
Copy link
Contributor

endiliey commented Nov 21, 2018

This is related to incomplete PR of subcategories feature. We should update the logic for https://github.com/facebook/Docusaurus/blob/master/v1/lib/version.js

Specifically

Test Case:

{
  "docs": {
    "My Example Category": [
      "examples",
      {
        "type": "subcategory",
        "label": "My Example Subcategory",
        "ids": [
          "my-examples",
          ...
        ]
      },
    ],
    ...
  }
}

Cutting the version 1.0.0

Current Behavior:

versioned_sidebars/version-1.0.0-sidebars.json

{
  "version-1.0.0-docs": {
    "My Example Category": [
      "version-1.0.0-examples",
      "version-1.0.0-[object Object]",
    ],
    ...
  }
}

Expected Behavior:
versioned_sidebars/version-1.0.0-sidebars.json

{
  "version-1.0.0-docs": {
    "My Example Category": [
      "version-1.0.0-examples",
      {
        "type": "subcategory",
        "label": "My Example Subcategory",
        "ids": [
          "version-1.0.0-my-examples",
          ...
        ]
      },
    ],
    ...
  }
}

Accepting PRs on this 😄

@endiliey endiliey added the good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. label Nov 21, 2018
@endiliey endiliey self-assigned this Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.
Projects
None yet
Development

No branches or pull requests

2 participants