-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
22 changed files
with
326 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: [email protected]` > `Password: demo` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,20 +6,17 @@ This example demonstrates how to use Custom Components in the [Payload](https:// | |
|
||
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 custom-components` | ||
|
||
> \*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: [email protected]` > `Password: demo` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Payload 3 with Custom Server | ||
|
||
Run the following command to create a project from the example: | ||
|
||
- `npx create-payload-app --example custom-server` | ||
|
||
Uses a [Next.js Custom Server](https://nextjs.org/docs/pages/building-your-application/configuring/custom-server) with express. | ||
|
||
Made from official [examples/custom-server](https://github.com/vercel/next.js/tree/canary/examples/custom-server) from Next.js repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,14 @@ The [Payload Draft Preview Example](https://github.com/payloadcms/payload/tree/m | |
|
||
To spin up this example locally, follow these steps: | ||
|
||
1. Clone this repo | ||
2. `cd` into this directory and run `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` | ||
1. Run the following command to create a project from the example: | ||
|
||
> \*If you are running using pnpm within the Payload Monorepo, the `--ignore-workspace` flag is needed so that pnpm generates a lockfile in this example's directory despite the fact that one exists in root. | ||
- `npx create-payload-app --example draft-preview` | ||
|
||
3. `cp .env.example .env` to copy the example environment variables | ||
4. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
5. `open http://localhost:3000/admin` to access the admin panel | ||
6. Login with email `[email protected]` and password `demo` | ||
2. `cp .env.example .env` to copy the example environment variables | ||
3. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
4. `open http://localhost:3000/admin` to access the admin panel | ||
5. Login with email `[email protected]` and password `demo` | ||
|
||
That's it! Changes made in `./src` will be reflected in your app. See the [Development](#development) section for more details. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,16 @@ The [Payload Form Builder Example](https://github.com/payloadcms/payload/tree/ma | |
|
||
## Quick Start | ||
|
||
1. Clone this repo | ||
2. `cd` into this directory and run `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` | ||
1. Run the following command to create a project from the example: | ||
|
||
> \*If you are running using pnpm within the Payload Monorepo, the `--ignore-workspace` flag is needed so that pnpm generates a lockfile in this example's directory despite the fact that one exists in root. | ||
- `npx create-payload-app --example form-builder` | ||
|
||
3. `cp .env.example .env` to copy the example environment variables | ||
2. `cp .env.example .env` to copy the example environment variables | ||
|
||
4. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
3. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
- Press `y` when prompted to seed the database | ||
5. `open http://localhost:3000` to access the home page | ||
6. `open http://localhost:3000/admin` to access the admin panel | ||
4. `open http://localhost:3000` to access the home page | ||
5. `open http://localhost:3000/admin` to access the admin panel | ||
- Login with email `[email protected]` and password `demo` | ||
|
||
That's it! Changes made in `./src` will be | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,16 @@ The [Payload Live Preview Example](https://github.com/payloadcms/payload/tree/ma | |
|
||
## Quick Start | ||
|
||
1. Clone this repo | ||
2. `cd` into this directory and run `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` | ||
1. Run the following command to create a project from the example: | ||
|
||
> \*If you are running using pnpm within the Payload Monorepo, the `--ignore-workspace` flag is needed so that pnpm generates a lockfile in this example's directory despite the fact that one exists in root. | ||
- `npx create-payload-app --example live-preview` | ||
|
||
3. `cp .env.example .env` to copy the example environment variables | ||
2. `cp .env.example .env` to copy the example environment variables | ||
|
||
4. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
3. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
- Press `y` when prompted to seed the database | ||
5. `open http://localhost:3000` to access the home page | ||
6. `open http://localhost:3000/admin` to access the admin panel | ||
4. `open http://localhost:3000` to access the home page | ||
5. `open http://localhost:3000/admin` to access the admin panel | ||
- Login with email `[email protected]` and password `demo` | ||
|
||
That's it! Changes made in `./src` will be reflected in your app. See the [Development](#development) section for more details. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,14 @@ This example demonstrates how to achieve a multi-tenancy in [Payload](https://gi | |
|
||
To spin up this example locally, follow these steps: | ||
|
||
1. Clone this repo | ||
1. `cd` into this directory and run `pnpm i --ignore-workspace`\*, `yarn`, or `npm install` | ||
1. Run the following command to create a project from the example: | ||
|
||
> \*If you are running using pnpm within the Payload Monorepo, the `--ignore-workspace` flag is needed so that pnpm generates a lockfile in this example's directory despite the fact that one exists in root. | ||
- `npx create-payload-app --example multi-tenant` | ||
|
||
1. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
2. `pnpm dev`, `yarn dev` or `npm run dev` to start the server | ||
- Press `y` when prompted to seed the database | ||
1. `open http://localhost:3000` to access the home page | ||
1. `open http://localhost:3000/admin` to access the admin panel | ||
3. `open http://localhost:3000` to access the home page | ||
4. `open http://localhost:3000/admin` to access the admin panel | ||
- Login with email `[email protected]` and password `demo` | ||
|
||
## How it works | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.