mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
fix(npm-to-yarn): add missing npm-to-yarn converter for Bun (#10803)
This commit is contained in:
parent
56ccf19063
commit
9800180f57
4 changed files with 46 additions and 4 deletions
|
@ -20,7 +20,7 @@ import type {Transformer} from 'unified';
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
type Plugin<T> = any; // TODO fix this asap
|
||||
|
||||
type KnownConverter = 'yarn' | 'pnpm';
|
||||
type KnownConverter = 'yarn' | 'pnpm' | 'bun';
|
||||
|
||||
type CustomConverter = [name: string, cb: (npmCode: string) => string];
|
||||
|
||||
|
@ -90,7 +90,7 @@ const transformNode = (
|
|||
code: npmToYarn(npmCode, converter),
|
||||
node,
|
||||
value: converter,
|
||||
label: converter === 'yarn' ? 'Yarn' : converter,
|
||||
label: getLabelForConverter(converter),
|
||||
});
|
||||
}
|
||||
const [converterName, converterFn] = converter;
|
||||
|
@ -101,6 +101,17 @@ const transformNode = (
|
|||
});
|
||||
}
|
||||
|
||||
function getLabelForConverter(converter: KnownConverter) {
|
||||
switch (converter) {
|
||||
case 'yarn':
|
||||
return 'Yarn';
|
||||
case 'bun':
|
||||
return 'Bun';
|
||||
default:
|
||||
return converter;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
type: 'mdxJsxFlowElement',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue