mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-24 14:36:59 +02:00
feat(npm-to-yarn): add support for PnPm and custom converters (#8690)
Co-authored-by: Ben Gubler <nebrelbug@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
3a73ce5ee1
commit
a8ab309ec8
11 changed files with 416 additions and 70 deletions
|
@ -770,6 +770,14 @@ module.exports = {
|
|||
remarkPlugins: [require('@docusaurus/remark-plugin-npm2yarn')],
|
||||
},
|
||||
blog: {
|
||||
// highlight-start
|
||||
remarkPlugins: [
|
||||
[
|
||||
require('@docusaurus/remark-plugin-npm2yarn'),
|
||||
{converters: ['pnpm']},
|
||||
],
|
||||
],
|
||||
// highlight-end
|
||||
// ...
|
||||
},
|
||||
},
|
||||
|
@ -786,7 +794,12 @@ npm install @docusaurus/remark-plugin-npm2yarn
|
|||
```
|
||||
````
|
||||
|
||||
Using the `{sync: true}` option would make all tab choices synced. Because the choice is stored under the same namespace `npm2yarn`, different `npm2yarn` plugin instances would also sync their choices.
|
||||
#### Configuration {#npm2yarn-remark-plugin-configuration}
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `sync` | `boolean` | `false` | Whether to sync the selected converter across all code blocks. |
|
||||
| `converters` | `array` | `'yarn'`, `'pnpm'` | The list of converters to use. The order of the converters is important, as the first converter will be used as the default choice. |
|
||||
|
||||
## Usage in JSX {#usage-in-jsx}
|
||||
|
||||
|
|
|
@ -55,38 +55,10 @@ npx create-docusaurus@latest my-website facebook
|
|||
|
||||
You can also initialize a new project using your preferred project manager:
|
||||
|
||||
```mdx-code-block
|
||||
<Tabs>
|
||||
<TabItem value="npm">
|
||||
```
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
npm init docusaurus
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
</TabItem>
|
||||
<TabItem value="yarn">
|
||||
```
|
||||
|
||||
```bash
|
||||
yarn create docusaurus
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
</TabItem>
|
||||
<TabItem value="pnpm">
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm create docusaurus
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Run `npx create-docusaurus@latest --help`, or check out its [API docs](./api/misc/create-docusaurus.md) for more information about all available flags.
|
||||
|
@ -193,7 +165,7 @@ npm install
|
|||
|
||||
To check that the update occurred successfully, run:
|
||||
|
||||
```bash npm2yarn
|
||||
```bash
|
||||
npx docusaurus --version
|
||||
```
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ npx @docusaurus/migrate migrate ./v1-website ./v2-website
|
|||
|
||||
3. To view your new website locally, go into your v2 website's directory and start your development server.
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
cd ./v2-website
|
||||
yarn install
|
||||
yarn start
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
:::danger
|
||||
|
|
|
@ -622,13 +622,13 @@ my-project
|
|||
|
||||
Start the development server and fix any errors:
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
cd website
|
||||
yarn start
|
||||
npm start
|
||||
```
|
||||
|
||||
You can also try to build the site for production:
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```bash npm2yarn
|
||||
npm run build
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue