Skip to content

Commit 549ab79

Browse files
jakeboone02slorber
andauthored
feat(plugin-npm2yarn): Add Bun to default tabs conversions (#10953)
* fix(plugin-npm2yarn): Add Bun as default to align with docs * fix(plugin-npm2yarn): update test snapshot with bunx * fix(plugin-npm2yarn): update test snapshot with bunx-create * fix(plugin-npm2yarn): update screenshot to add pnpm and Bun --------- Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
1 parent e2e85e6 commit 549ab79

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed

packages/docusaurus-remark-plugin-npm2yarn/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module.exports = {
6363
| Property | Type | Default | Description |
6464
| --- | --- | --- | --- |
6565
| `sync` | `boolean` | `false` | Syncing tab choices (Yarn and npm). See https://docusaurus.io/docs/markdown-features/#syncing-tab-choices for details. |
66-
| `converters` | `array` | `'yarn'`, `'pnpm'`, `'bun'` | The list of converters to use. The order of the converters is important, as the first converter will be used as the default choice. |
66+
| `converters` | `array` | `['yarn', 'pnpm', 'bun']` | The list of converters to use. The order of the converters is important, as the first converter will be used as the default choice. |
6767

6868
## Custom converters
6969

-16.6 KB
Loading

packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/__snapshots__/index.test.ts.snap

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ import TabItem from '@theme/TabItem'
2424
$ pnpm add --global docusaurus
2525
\`\`\`
2626
</TabItem>
27+
28+
<TabItem value="bun" label="Bun">
29+
\`\`\`bash
30+
$ bun add --global docusaurus
31+
\`\`\`
32+
</TabItem>
2733
</Tabs>
2834
2935
<div className="nested-npm2yarn">
@@ -45,6 +51,12 @@ import TabItem from '@theme/TabItem'
4551
pnpm install
4652
\`\`\`
4753
</TabItem>
54+
55+
<TabItem value="bun" label="Bun">
56+
\`\`\`bash
57+
bun install
58+
\`\`\`
59+
</TabItem>
4860
</Tabs>
4961
</div>
5062
@@ -72,6 +84,12 @@ echo "no npm2yarn here"
7284
yarn add @docusaurus/core
7385
\`\`\`
7486
</TabItem>
87+
88+
<TabItem value="bun" label="Bun">
89+
\`\`\`bash
90+
yarn add @docusaurus/core
91+
\`\`\`
92+
</TabItem>
7593
</Tabs>
7694
"
7795
`;
@@ -99,6 +117,12 @@ import TabItem from '@theme/TabItem';
99117
$ pnpm add --global docusaurus
100118
\`\`\`
101119
</TabItem>
120+
121+
<TabItem value="bun" label="Bun">
122+
\`\`\`bash
123+
$ bun add --global docusaurus
124+
\`\`\`
125+
</TabItem>
102126
</Tabs>
103127
"
104128
`;
@@ -122,6 +146,12 @@ exports[`npm2yarn plugin does not re-import tabs components when already importe
122146
$ pnpm add --global docusaurus
123147
\`\`\`
124148
</TabItem>
149+
150+
<TabItem value="bun" label="Bun">
151+
\`\`\`bash
152+
$ bun add --global docusaurus
153+
\`\`\`
154+
</TabItem>
125155
</Tabs>
126156
127157
import Tabs from '@theme/Tabs';
@@ -263,6 +293,12 @@ import TabItem from '@theme/TabItem'
263293
$ pnpm add --global docusaurus
264294
\`\`\`
265295
</TabItem>
296+
297+
<TabItem value="bun" label="Bun">
298+
\`\`\`bash
299+
$ bun add --global docusaurus
300+
\`\`\`
301+
</TabItem>
266302
</Tabs>
267303
"
268304
`;
@@ -293,6 +329,12 @@ A plugin is usually a npm package, so you install them like other npm packages u
293329
pnpm add docusaurus-plugin-name
294330
\`\`\`
295331
</TabItem>
332+
333+
<TabItem value="bun" label="Bun">
334+
\`\`\`bash
335+
bun add docusaurus-plugin-name
336+
\`\`\`
337+
</TabItem>
296338
</Tabs>
297339
"
298340
`;
@@ -319,6 +361,12 @@ import TabItem from '@theme/TabItem'
319361
pnpm run xxx --arg
320362
\`\`\`
321363
</TabItem>
364+
365+
<TabItem value="bun" label="Bun">
366+
\`\`\`bash
367+
bun run xxx --arg
368+
\`\`\`
369+
</TabItem>
322370
</Tabs>
323371
324372
<Tabs groupId="npm2yarn">
@@ -339,6 +387,12 @@ import TabItem from '@theme/TabItem'
339387
pnpm add package
340388
\`\`\`
341389
</TabItem>
390+
391+
<TabItem value="bun" label="Bun">
392+
\`\`\`bash
393+
bun add package
394+
\`\`\`
395+
</TabItem>
342396
</Tabs>
343397
344398
<Tabs groupId="npm2yarn">
@@ -359,6 +413,12 @@ import TabItem from '@theme/TabItem'
359413
pnpm remove package-name
360414
\`\`\`
361415
</TabItem>
416+
417+
<TabItem value="bun" label="Bun">
418+
\`\`\`bash
419+
bun remove package-name
420+
\`\`\`
421+
</TabItem>
362422
</Tabs>
363423
364424
<Tabs groupId="npm2yarn">
@@ -382,6 +442,13 @@ import TabItem from '@theme/TabItem'
382442
pnpm create docusaurus@latest my-website classic
383443
\`\`\`
384444
</TabItem>
445+
446+
<TabItem value="bun" label="Bun">
447+
\`\`\`bash
448+
bunx create-docusaurus
449+
bunx create-docusaurus@latest my-website classic
450+
\`\`\`
451+
</TabItem>
385452
</Tabs>
386453
"
387454
`;
@@ -412,6 +479,12 @@ Hey
412479
pnpm add test
413480
\`\`\`
414481
</TabItem>
482+
483+
<TabItem value="bun" label="Bun">
484+
\`\`\`bash
485+
bun add test
486+
\`\`\`
487+
</TabItem>
415488
</Tabs>
416489
"
417490
`;
@@ -442,6 +515,12 @@ A plugin is usually a npm package, so you install them like other npm packages u
442515
pnpm add docusaurus-plugin-name
443516
\`\`\`
444517
</TabItem>
518+
519+
<TabItem value="bun" label="Bun">
520+
\`\`\`bash
521+
bun add docusaurus-plugin-name
522+
\`\`\`
523+
</TabItem>
445524
</Tabs>
446525
"
447526
`;

packages/docusaurus-remark-plugin-npm2yarn/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function createImportNode() {
172172
}
173173

174174
const plugin: Plugin<[PluginOptions?]> = (options = {}): Transformer => {
175-
const {sync = false, converters = ['yarn', 'pnpm']} = options;
175+
const {sync = false, converters = ['yarn', 'pnpm', 'bun']} = options;
176176
return async (root) => {
177177
const {visit} = await import('unist-util-visit');
178178

0 commit comments

Comments
 (0)