You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-30Lines changed: 63 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,73 +254,106 @@ Below is a list of available namespaces to use:
254
254
255
255
## 🚀 Demo Projects
256
256
257
-
This repository includes demo projects located in the `/demo` directory to help you get started with using the client. The actual Strapi application is located in the `.strapi-app` directory.
257
+
This repository includes demo projects located in the `/demo` directory to help you get started with using the client. The actual Strapi app is located in the `.strapi-app` directory.
258
258
259
259
### Demo Structure
260
260
261
-
-**`.strapi-app`**: This is the main Strapi application used for the demo projects.
262
-
-**`demo/node-typescript`**: A Node.js project using TypeScript.
263
-
-**`demo/node-javascript`**: A Node.js project using JavaScript.
261
+
-**`.strapi-app`**: the main Strapi app used for the demo projects.
262
+
-**`demo/node-typescript`**: a Node.js project using TypeScript.
263
+
-**`demo/node-javascript`**: a Node.js project using JavaScript.
264
+
-**`demo/next-server-components`**: a Next.js project using TypeScript and server components.
264
265
265
-
### Using Demo Scripts
266
+
### Using Demo Commands
266
267
267
-
The `package.json` includes several scripts to help you manage and run the demo projects. These scripts are designed to streamline the process of setting up and running the demo projects, making it easier for developers to test and interact with the client.
268
+
The repository supports running demo-related commands directly using the format `pnpm demo <command>`.
268
269
269
-
The most important basic commands to get started are:
270
+
To display the entire list of available commands, use `pnpm demo help`
270
271
271
-
-**`demo:setup`**: A comprehensive setup command that installs dependencies, sets up the environment, builds the projects, and seeds the demo application. This is a one-stop command to prepare everything needed to run the demos.
272
+
#### Comprehensive Setup:
273
+
274
+
-**`pnpm demo setup`**
275
+
A complete setup command that installs dependencies, sets up the environment,
276
+
builds the projects, and seeds the database with initial data for the demo app.
277
+
278
+
It is a one-stop command for preparing everything.
272
279
273
280
```bash
274
-
pnpm run demo:setup
281
+
pnpm demosetup
275
282
```
276
283
277
-
-**`demo:run`**: Runs the Strapi application server in development mode. This command is useful for testing and developing.
284
+
#### Development:
285
+
286
+
-**`pnpm demo app:start`**
287
+
Starts the Strapi demo app in development mode. This is useful for testing and making changes to the Strapi backend.
278
288
279
289
```bash
280
-
pnpm run demo:run
290
+
pnpm demo app:start
281
291
```
282
292
283
-
-**`demo:seed:clean`**: Cleans the existing data and re-seeds the Strapi demo application. This command is helpful for resetting the demo data to its initial state.
293
+
#### Database Seeding:
294
+
295
+
-**`pnpm demo app:seed`**
296
+
Seeds the Strapi app with sample data. Use this when you want to populate your Strapi app with default content.
284
297
285
298
```bash
286
-
pnpm run demo:seed:clean
299
+
pnpm demo app:seed
287
300
```
288
301
289
-
The following scripts shouldn't need to be used generally, but are also available to run individual parts of the setup or reset process:
290
-
291
-
-**`demo:build`**: Builds the main project and the TypeScript and JavaScript demo projects. This command ensures that all necessary build steps are completed for the demo projects to run.
302
+
-**`pnpm demo app:seed:clean`**
303
+
Cleans the existing database and re-seeds the Strapi demo app.
304
+
This is helpful if you want to reset the demo data to its initial state.
292
305
293
306
```bash
294
-
pnpm run demo:build
307
+
pnpm demo app:seed:clean
295
308
```
296
309
297
-
-**`demo:install`**: Installs all dependencies for the main project and all demo projects, including TypeScript, JavaScript, HTML, and Next.js demos. This command is essential to prepare the environment for running the demos.
310
+
#### Build and Install:
311
+
312
+
-**`pnpm demo build`**
313
+
Builds the main Strapi app and all demo projects.
314
+
315
+
Use this to prepare the projects for use, ensuring all components are compiled and ready.
298
316
299
317
```bash
300
-
pnpm run demo:install
318
+
pnpm demo build
301
319
```
302
320
303
-
-**`demo:env`**: Sets up the environment for the Strapi demo application by copying the example environment file if it doesn't already exist.
321
+
-**`pnpm demo install`**
322
+
Installs dependencies for the main Strapi app and all demo applications.
323
+
324
+
This command ensures that all required packages are downloaded and ready to go.
304
325
305
326
```bash
306
-
pnpm run demo:env
327
+
pnpm demo install
307
328
```
308
329
309
-
-**`demo:seed`**: Seeds the Strapi application with example data. This script also generates `.env` files with API tokens for the `node-typescript` and `node-javascript` projects.
330
+
#### Environment Setup:
331
+
332
+
-**`pnpm demo app:env:setup`**
333
+
Sets up the `.env` file for the main Strapi app by copying the example `.env.example` file if no `.env` file exists.
334
+
335
+
This ensures the environment is configured appropriately.
310
336
311
337
```bash
312
-
pnpm run demo:seed
338
+
pnpm demo app:env:setup
313
339
```
314
340
315
-
### Adding New Projects
341
+
---
316
342
317
-
If you add new projects to the `/demo` directory, you will need to update the seed script located at `/demo/.strapi-app/scripts/seed.js` with the new project paths to ensure they are properly configured and seeded.
343
+
#### Adding New Projects
318
344
319
-
### Future Plans
345
+
New projects added to the `/demo` directory are automatically picked up by the demo scripts.
346
+
Thus, no explicit configuration updates are required for these commands to work with new demo directories.
320
347
321
-
We plan to expand the demo projects to include:
348
+
**Note:** if a project needs to be built to be used, add a `build` script
349
+
to its `package.json` so that the demo scripts automatically run it.
322
350
323
-
- A basic HTML project.
324
-
- A Next.js project.
351
+
---
352
+
353
+
#### Future Plans
354
+
355
+
We plan to expand the demo projects to include:
325
356
326
-
These additions will provide more examples of how to integrate the client into different types of applications.
357
+
- A basic HTML project
358
+
- A Vue.js project (with or without server components)
0 commit comments