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

bug: npm2yarn2pnpm not working with docusaurus@2.0.0-beta.21 #75

Closed
1 task done
ndom91 opened this issue Jul 1, 2022 · 4 comments
Closed
1 task done

bug: npm2yarn2pnpm not working with docusaurus@2.0.0-beta.21 #75

ndom91 opened this issue Jul 1, 2022 · 4 comments

Comments

@ndom91
Copy link

ndom91 commented Jul 1, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

The meta tag npm2yarn2pnpm has no affect on bash code blocks. Where I'd previously used npm2yarn, I've installed @sapphire/docusaurus-plugin-npm2yarn2pnpm and added:

  ```bash npm2yarn2pnpm
  npm install react
  ` ``

However, this has no affect, and the codeblock is printed as a normal bash syntaxhighlighted codeblock.

Steps To Reproduce

  1. Install @sapphire/docusaurus-plugin-npm2yarn2pnpm
  2. Add to your docusaurus.config.js
remarkPlugins: [ 
  require("@sapphire/docusaurus-plugin-npm2yarn2pnpm"),
]
  1. Add to your docs files (i.e. index.md)
  ```bash npm2yarn2pnpm
  npm install react
  ` ``

Watch it get rendered as such:

image

Expected behavior

Expect npm, yarn, and pnpm tab component to be rendered

Screenshots

image

Additional context

See for example, this draft PR in my docusaurus project:

  1. Preview Deploy: https://next-auth-2caln0sb0-nextauthjs.vercel.app/getting-started/upgrade-v4
    1a. The very first bash codeblock on this page, npm install next-auth, is supposed to be rendered with the various package manager tabs. But as you can see, it is not.
  2. PR: feat: rm npm2yarn add npm2yarn2pnpm plugin nextauthjs/next-auth#4805
@vladfrangu
Copy link
Member

vladfrangu commented Jul 1, 2022

This isn't a bug per say, check how we're doing it on our website:

https://github.com/sapphiredev/website/blob/335a341357c025ef9b5aa13570d7c95dff73500a/docusaurus.config.js#L3

https://github.com/sapphiredev/website/blob/335a341357c025ef9b5aa13570d7c95dff73500a/docusaurus.config.js#L184

You'll need to destructure the method itself. Can you try that and followup if that fixes it or not? 🙏

@favna
Copy link
Member

favna commented Jul 2, 2022

Adding to that, the difference with the other plugin comes from how we export the plugin. Whereas the npm2yarn plugin uses export = with a note:

To continue supporting require('npm2yarn') without the .default ㄟ(▔,▔)ㄏ

Because we're not limited to a specific setup like docusaurus is we opted to just embrace the modern exports.

@ndom91
Copy link
Author

ndom91 commented Jul 3, 2022

@vladfrangu ah thank you for the tip! Had to be a named import.

Working now!

@vladfrangu
Copy link
Member

Glad to hear it worked! I'll be closing this issue then as it's not a bug, but followup if there's any other issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants