Skip to content

Commit 0c26613

Browse files
Update some v5 and plugin sdk docs (#2210)
* Update some v5 and plugin sdk docs * Update docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md * Preserve initial intent and structure of the tutorial --------- Co-authored-by: Pierre Wizla <pwizla@users.noreply.github.com> Co-authored-by: Pierre Wizla <pwizla+github@gmail.com>
1 parent 5046bca commit 0c26613

File tree

5 files changed

+27
-59
lines changed

5 files changed

+27
-59
lines changed

docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ All of the following available resources will help you upgrade your application
3535
The following questions and their answers should help you cover the most common use cases:
3636

3737
<details style={detailsStyle}>
38-
<summary style={summaryStyle}>How can I handle the upgrade and the installation of the latest dependencies? How can I handle the breaking changes in the code and adapt my code to Strapi 5?</summary>
38+
<summary style={summaryStyle}>How can I handle the upgrade and the installation of the latest dependencies?<br/>How can I handle the breaking changes in the code and adapt my code to Strapi 5?</summary>
3939

40-
Strapi provides a tool, the [upgrade tool](/dev-docs/upgrade-tool). The upgrade tool is a command line tool with some commands that handle the upgrade of the dependencies and the execution of **codemods** <Codemods/>.
40+
Strapi provides an [upgrade tool](/dev-docs/upgrade-tool) to ease the process. The upgrade tool is a command line tool with some commands that handle the upgrade of the dependencies and the execution of **codemods** <Codemods/>.
4141

4242
Follow the <a href="/dev-docs/migration/v4-to-v5/step-by-step">step-by-step guide</a> to learn how to use this tool in the context of upgrading to Strapi 5.
4343

@@ -47,8 +47,8 @@ Strapi 5 docs also provide a [complete breaking changes database](/dev-docs/migr
4747

4848
<details style={detailsStyle}>
4949
<summary style={summaryStyle}>How can I handle the data migration, ensuring that in Strapi 5 the application will still be working?</summary>
50-
<p>Strapi 5 integrates a data migration script that is run once the application starts for the first time in Strapi 5.</p>
51-
<p>However, please <strong>always backup your database file</strong> (found at <code style={codeStyle}>.tmp/data.db</code> by default if using a SQL database) before performing any upgrade, as instructed in the <a href="/dev-docs/migration/v4-to-v5/step-by-step">step-by-step guide</a>.</p>
50+
<p>Strapi 5 integrates a series of data migration scripts that are run once the application starts for the first time in Strapi 5.</p>
51+
<p>However, please <strong>always backup your database</strong> (found at <code style={codeStyle}>.tmp/data.db</code> by default if using a SQL database) before performing any upgrade, as instructed in the <a href="/dev-docs/migration/v4-to-v5/step-by-step">step-by-step guide</a>.</p>
5252
</details>
5353

5454
<details style={detailsStyle}>

docusaurus/docs/dev-docs/migration/v4-to-v5/step-by-step.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Before getting into the upgrade process itself, take the following precautions:
3131

3232
1. **Backup your database**.
3333

34-
If you are using SQLite (the default database provided with Strapi), your database file is named `data.db` and is located in the `.tmp/` folder at the root of your Strapi application.
34+
If you are using SQLite with the default configuration (the default database provided with Strapi), your database file is named `data.db` and is located in the `.tmp/` folder at the root of your Strapi application.
3535

3636
If you are using another type of database, please refer to their official documentation (see [PostgreSQL docs](https://www.postgresql.org/docs/) and [MySQL docs](https://dev.mysql.com/doc/)).
3737

@@ -105,7 +105,7 @@ For each of them, read the indicated breaking change entry and check if some man
105105
1. Some environment variables are handled by the server configuration 👉 see [breaking change](/dev-docs/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options)
106106
2. Custom configuration must meet specific requirements 👉 see [breaking change](/dev-docs/migration/v4-to-v5/breaking-changes/strict-requirements-config-files)
107107
3. **Admin panel customization**:
108-
* The helper-plugin has been deprecated 👉 see [migration reference](/dev-docs/migration/v4-to-v5/additional-resources/helper-plugin)
108+
* The helper-plugin has been removed 👉 see [migration reference](/dev-docs/migration/v4-to-v5/additional-resources/helper-plugin)
109109

110110
👉 Finally, go over the rest of the [breaking changes database](/dev-docs/migration/v4-to-v5/breaking-changes) for any edge case you might be concerned about.
111111

docusaurus/docs/dev-docs/plugins/development/create-a-plugin.md

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ The present guide covers creating a plugin from scratch, linking it to an existi
2323
This guide assumes you want to develop a plugin external to your Strapi project. However, the steps largely remain the same if you want to develop a plugin within your existing project. If you are not [using a monorepo](#working-with-the-plugin-cli-in-a-monorepo-environment) the steps are exactly the same.
2424
:::
2525

26+
:::prerequisites
27+
[yalc](https://www.npmjs.com/package/yalc) must be installed globally (with `npm install -g yalc` or `yarn global add yalc`).
28+
:::
29+
2630
## Getting started with the Plugin SDK
2731

2832
The Plugin SDK helps you creating a plugin, linking it to an existing Strapi project, and building it for publishing.
2933

34+
The full list of commands and their parameters are available in the [Plugin SDK reference](/dev-docs/plugins/development/plugin-sdk). The present page will guide on using the main ones.
35+
3036
### Creating the plugin
3137

3238
To create your plugin, ensure you are in the parent directory of where you want it to be created and run the following command:
@@ -57,33 +63,11 @@ You will be ran through a series of prompts to help you setup your plugin. If yo
5763

5864
### Linking the plugin to your project
5965

60-
Once you created your plugin, you will want to register it with the [yalc](https://github.com/wclr/yalc) repository (it's local to your machine). To do this, run the following command:
61-
62-
<Tabs groupId="yarn-npm">
63-
64-
<TabItem value="yarn" label="Yarn">
66+
In order to test your plugin during its development, the recommended approach is to link it to a Strapi project.
6567

66-
```bash
67-
cd my-strapi-plugin
68-
yarn install
69-
yarn watch:link
70-
```
68+
Linking your plugin to a project is done with the `watch:link` command. The command will output explanations on how to link your plugin to a Strapi project.
7169

72-
</TabItem>
73-
74-
<TabItem value="npm" label="NPM">
75-
76-
```bash
77-
cd my-strapi-plugin
78-
npm install
79-
npm run watch:link
80-
```
81-
82-
</TabItem>
83-
84-
</Tabs>
85-
86-
This will then produce an output explaing how to link your plugin to your Strapi project. Open a new terminal window to do the next steps:
70+
In a new terminal window, run the following commands:
8771

8872
<Tabs groupId="yarn-npm">
8973

@@ -108,30 +92,12 @@ npx yalc add --link my-strapi-plugin && npm run install
10892
</Tabs>
10993

11094
:::note
111-
In the above examples we use the name of the plugin when linking it to the project. This is the name of the package, not the name of the folder.
95+
In the above examples we use the name of the plugin (`my-strapi-plugin`) when linking it to the project. This is the name of the package, not the name of the folder.
11296
:::
11397

114-
Because this plugin is installed via `node_modules` you won't need to explicity add it to your `plugins` [configuration file](/dev-docs/configurations/plugins), so running the [`develop command`](../../cli.md#strapi-develop) will automatically pick up your plugin. However, to improve your experience we recommend you run Strapi with the `--watch-admin` flag so that your admin panel is automatically rebuilt when you make changes to your plugin:
115-
116-
<Tabs groupId="yarn-npm">
117-
118-
<TabItem value="yarn" label="Yarn">
119-
120-
```bash
121-
yarn develop --watch-admin
122-
```
123-
124-
</TabItem>
125-
126-
<TabItem value="npm" label="NPM">
98+
Because this plugin is installed via `node_modules` you won't need to explicity add it to your `plugins` [configuration file](/dev-docs/configurations/plugins), so running the [`develop command`](../../cli.md#strapi-develop) to start your Strapi project will automatically pick up your plugin.
12799

128-
```bash
129-
npm run develop --watch-admin
130-
```
131-
132-
</TabItem>
133-
134-
</Tabs>
100+
Now that your plugin is linked to a project, run `yarn develop` or `npm run develop` to start the Strapi application.
135101

136102
You are now ready to develop your plugin how you see fit! If you are making server changes, you will need to restart your server for them to take effect.
137103

@@ -168,15 +134,15 @@ If you are working with a monorepo environment to develop your plugin, you don't
168134
However, if you are writing admin code, you might add an `alias` that targets the source code of your plugin to make it easier to work with within the context of the admin panel:
169135

170136
```ts
171-
import path from "node:path";
137+
import path from 'node:path';
172138

173139
export default (config, webpack) => {
174140
config.resolve.alias = {
175141
...config.resolve.alias,
176-
"my-strapi-plugin": path.resolve(
142+
'my-strapi-plugin': path.resolve(
177143
__dirname,
178144
// We've assumed the plugin is local.
179-
"../plugins/my-strapi-plugin/admin/src"
145+
'../plugins/my-strapi-plugin/admin/src'
180146
),
181147
};
182148

docusaurus/docs/dev-docs/plugins/development/plugin-sdk.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ npx @strapi/sdk-plugin init
3434

3535
## strapi-plugin build
3636

37-
Bundle the strapi plugin for publishing.
37+
Bundle the Strapi plugin for publishing.
3838

3939
```bash
4040
strapi-plugin build
@@ -52,6 +52,8 @@ strapi-plugin build
5252

5353
Recompiles the plugin automatically on changes and runs `yalc push --publish`.
5454

55+
For testing purposes, it is very convenient to link your plugin to an existing application to experiment with it in real condition. This command is made to help you streamline this process.
56+
5557
```bash
5658
strapi-plugin watch:link
5759
```
@@ -63,7 +65,7 @@ strapi-plugin watch:link
6365

6466
## strapi-plugin watch
6567

66-
Watch and compile the Strapi plugin for local development.
68+
Watch the plugin source code for any change and rebuild it everytime. Useful when implementing your plugin and testing it in an application.
6769

6870
```bash
6971
strapi-plugin watch

docusaurus/yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,9 +1573,9 @@
15731573
react-helmet-async "*"
15741574
react-loadable "npm:@docusaurus/react-loadable@5.5.2"
15751575

1576-
"@docusaurus/plugin-sdkent-redirects@2.4.0":
1576+
"@docusaurus/plugin-client-redirects@2.4.0":
15771577
version "2.4.0"
1578-
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sdkent-redirects/-/plugin-sdkent-redirects-2.4.0.tgz#53117d112ac9cc191deda053af4335e0381b4125"
1578+
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.4.0.tgz#53117d112ac9cc191deda053af4335e0381b4125"
15791579
integrity sha512-HsS+Dc2ZLWhfpjYJ5LIrOB/XfXZcElcC7o1iA4yIVtiFz+LHhwP863fhqbwSJ1c6tNDOYBH3HwbskHrc/PIn7Q==
15801580
dependencies:
15811581
"@docusaurus/core" "2.4.0"

0 commit comments

Comments
 (0)