feat(cpa): create project from example using --example CLI arg (#10172)

Adds the ability to create a project using an existing in the Payload
repo example through `create-payload-app`:

For example:
`pnpx create-payload-app --example custom-server` - creates a project
from the
[custom-server](https://github.com/payloadcms/payload/tree/main/examples/custom-server)
example.

This is much easier and faster then downloading the whole repo and
copying the example to another folder.
Note that we don't configure the payload config with the storage / DB
adapter there because examples can be very specific.
This commit is contained in:
Sasha
2024-12-27 20:16:34 +02:00
committed by GitHub
parent 7e0975f970
commit 6b4842d44d
22 changed files with 325 additions and 123 deletions

View File

@@ -6,20 +6,17 @@ This [Payload Auth Example](https://github.com/payloadcms/payload/tree/main/exam
To spin up this example locally, follow the steps below:
1. Clone this repo
1. Navigate into the project directory and install dependencies using your preferred package manager:
1. Run the following command to create a project from the example:
- `pnpm i --ignore-workspace`\*, `yarn`, or `npm install`
- `npx create-payload-app --example auth`
> \*NOTE: The --ignore-workspace flag is needed if you are running this example within the Payload monorepo to avoid workspace conflicts.
1. Start the server:
2. Start the server:
- Depending on your package manager, run `pnpm dev`, `yarn dev` or `npm run dev`
- When prompted, type `y` then `enter` to seed the database with sample data
1. Access the application:
3. Access the application:
- Open your browser and navigate to `http://localhost:3000` to access the homepage.
- Open `http://localhost:3000/admin` to access the admin panel.
1. Login:
4. Login:
- Use the following credentials to log into the admin panel:
> `Email: demo@payloadcms.com` > `Password: demo`