Skip to content

polish(v2): use npm-to-yarn for the npm2yarn remark plugin - #2428

Merged
yangshun merged 5 commits into
meta:masterfrom
bgub:npm-to-yarn
Mar 24, 2020
Merged

yangshun merged 5 commits into
meta:masterfrom
bgub:npm-to-yarn

Conversation

@bgub

@bgub bgub commented Mar 19, 2020 •

Copy link
Copy Markdown
Contributor

Motivation

Docusaurus' previous NPM-Yarn code tab generation was very basic and missed many conversions. I extracted some of the logic into a new npm package (npm-to-yarn) and made the code more robust.

Have you read the Contributing Guidelines on pull requests?

Yep

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

When serving on localhost, NPM to Yarn code tab generation works in almost all cases (though for some reason, it seems to fail, as did the last implementation, on one-line codeblocks? I think it's a problem with the Remark plugin)

Actually, the problems I observed previously aren't there any more. Conversions seem to be working perfectly

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

None yet

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Hi @nebrelbug!

Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@docusaurus-bot

docusaurus-bot commented Mar 19, 2020 •

Copy link
Copy Markdown
Contributor

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Mar 19, 2020
@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@bgub

bgub commented Mar 20, 2020

Copy link
Copy Markdown
Contributor Author

Strangely, the bottom two npm2yarn codeblocks on the Installation page do not convert when running a local server on my device, but do convert correctly on the deploy preview (which I can confirm is using my changes).

This is with the most recent changes, and testing both /docs/ and /docs/next

@bgub

bgub commented Mar 20, 2020

Copy link
Copy Markdown
Contributor Author

After fixing a few bugs in my NPM package, I can confirm that I didn't see any failed conversions while browsing the docs (except the codeblock that says npm docusaurus --version, which isn't actually correct)

@bgub
bgub marked this pull request as ready for review March 23, 2020 22:43
@bgub
bgub requested a review from yangshun as a code owner March 23, 2020 22:43
@yangshun yangshun changed the title Use npm-to-yarn for the npm2yarn remark plugin polish(v2): use npm-to-yarn for the npm2yarn remark plugin Mar 24, 2020
@yangshun yangshun added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Mar 24, 2020

@yangshun yangshun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo thank you!

@yangshun
yangshun merged commit a8a4fe4 into meta:master Mar 24, 2020
@Josh-Cena Josh-Cena mentioned this pull request Nov 12, 2021
7 tasks done
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* Use npm-to-yarn for the Bash npm2yarn Remark plugin

* Update npm-to-yarn version with fix

* Update npm-to-yarn yet another time to fix another -g/--global bug

* Update remark-npm2yarn.js

Co-authored-by: Yangshun Tay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants