### Build and Start Example Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-graphql-debug/README.md Builds the example application, sets up the WordPress environment, and starts the Next.js development server. This command orchestrates multiple setup steps. ```shell pnpm example:build ``` -------------------------------- ### Manage Example Project with npm Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/astro/template-hierarchy-data-fetching-urql/README.md Commands to set up, start, stop, and reset the local WordPress server and Astro development server for the WP Template Hierarchy example. Ensure Docker Desktop is installed before running setup. ```shell npm run example:setup # Installs dependencies and configures the local WP server. npm run example:start # Starts the WP server and Astro development server. npm run example:stop # Stops the local WP server. npm run example:prune # Resets the WP server and re-runs setup. ``` -------------------------------- ### Setup Repository and Packages Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hwp-preview-wpgraphql/README.md Commands to clone the repository and install project dependencies using npm. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit && npm install ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-filesystem-routing/README.md Commands to build and start the Next.js example application. This process includes setting up the WordPress environment, importing the database, and running the Next.js development server. ```Bash cd examples/next/apollo-client-filesystem-routing npm run example:build ``` -------------------------------- ### Setup HWP CLI Environment Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/basic-cli/README.md Commands to copy the environment configuration, set the WordPress URL, and install project dependencies using pnpm. ```bash cp .env.example .env WP_URL=http://localhost:8889 # Change this to your WordPress site URL pnpm install ``` -------------------------------- ### Setup and Build Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hwp-preview-rest/README.md Commands to clone the repository, install Node.js dependencies, navigate to the example directory, and build/start the Next.js application with wp-env. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit npm install cd examples/next/hwp-preview-rest npm run example:build ``` -------------------------------- ### Setup and Run WP Toolkit Example with npm Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/sveltekit/template-hierarchy-data-fetching-urql/README.md Commands to set up, start, and stop the local WordPress server and SvelteKit development environment. Includes a command to reset the WP server. Docker Desktop is a prerequisite for running WordPress locally. ```bash npm run example:setup npm run example:start npm run example:stop npm run example:prune ``` -------------------------------- ### Manage Example Environment with npm Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/template-hierarchy-data-fetching/README.md These commands are used to set up, start, stop, and reset the local WordPress server and Nuxt development environment for the example. Ensure Docker Desktop is installed before running setup. ```bash npm run example:setup ``` ```bash npm run example:start ``` ```bash npm run example:stop ``` ```bash npm run example:prune ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hwp-preview-wpgraphql/README.md Command to build and start the Next.js example application, which includes setting up the WordPress environment via wp-env. ```bash cd examples/next/hwp-preview-wpgraphql npm run example:build ``` -------------------------------- ### Project Setup and Build Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/client-app-router-fetch-data/README.md Provides essential bash commands for cloning the repository, installing project dependencies using pnpm, and building/starting the Next.js application with wp-env integration. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit pnpm install cd examples/next/client-app-router-fetch-data pnpm example:build ``` -------------------------------- ### Quick Start: Build and Launch Example Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/nuxt-headlesswp-gravity-forms/README.md Executes a single command to build the example, which includes unzipping media files, starting the WordPress environment, importing the database, and launching the Nuxt development server. ```bash npm run example:build ``` -------------------------------- ### Build and Start Next.js GraphQL Proxy Debug Example Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-graphql-debug/README.md Navigates into the example directory, builds the application, and starts the Next.js development server. This command is specific to the GraphQL proxy debug example. ```shell cd examples/next/graphql-proxy-debug pnpm example:build ``` -------------------------------- ### Project Setup and Execution Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-sitemap-apollo/README.md A sequence of bash commands to clone the project repository, install dependencies using pnpm, and build/start the Next.js example application. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit && pnpm install cd examples/next/proxied-sitemap-apollo pnpm example:build ``` -------------------------------- ### HWPToolkit Example Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-filesystem-routing/README.md Reference for core example commands used to manage the development environment. These commands cover building, running, and stopping the application. ```APIDOC example:build - Prepares the environment by unzipping images, starting WordPress, importing the database, and starting the application. example:dev - Runs the Next.js development server. example:dev:install - Installs the required Next.js packages. example:start - Starts WordPress and the Next.js development server. example:stop - Stops the WordPress environment. example:prune - Rebuilds and restarts the application by destroying and recreating the WordPress environment. ``` -------------------------------- ### Build and Start Next.js App with WP-Env Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/client-multisite-app-router-fetch-data/README.md Steps to navigate to the example directory, build, and start the application. This process includes unzipping uploads, starting wp-env, importing the database, configuring multisite, and running the Next.js dev server. ```shell cd examples/next/client-multisite-app-router-fetch-data pnpm example:build ``` -------------------------------- ### Setup Repository and Packages Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-filesystem-routing/README.md Provides essential commands for cloning the project repository, installing Node.js dependencies, and configuring the environment variables required for the application to connect to the WordPress backend. ```Bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit && npm install ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/custom-sitemap-vanilla-wpgraphql/README.md Navigate to the example directory and run the build command to prepare the environment, start WordPress, import the database, and launch the Next.js application. ```bash cd examples/next/custom-sitemap-vanilla-wpgraphql npm run example:build ``` -------------------------------- ### Build and Start Next.js Example Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hybrid-sitemap-apollo/README.md Commands to build and start the Next.js example application. This process includes unzipping uploads, starting a WordPress environment using wp-env, importing a database, and running the Next.js dev script. ```bash cd examples/next/hybrid-sitemap-apollo pnpm example:build ``` -------------------------------- ### Setup and Install Project Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/nuxt-headlesswp-gravity-forms/README.md Clones the project repository, navigates into the directory, installs npm dependencies, and sets up the environment variable for the WordPress URL. ```bash git clone https://github.com/your-org/nuxt-gravityforms-example.git cd nuxt-gravityforms-example npm install echo "NUXT_PUBLIC_WORDPRESS_URL=http://localhost:8888" > example-app/.env ``` -------------------------------- ### Project Setup and Package Installation Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hybrid-sitemap-apollo/README.md Commands to clone the project repository, navigate into the directory, and install project dependencies using pnpm. This is a standard setup procedure for Node.js projects. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit pnpm install ``` -------------------------------- ### Quick Start: Separate Steps Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/nuxt-headlesswp-gravity-forms/README.md Provides individual commands to start the WordPress environment, import the database, unzip media files, and then launch the Nuxt development server separately. ```bash # Start WP npm run wp:start # Import DB npm run wp:db:import # Unzip uploads npm run wp:images:unzip # Start Nuxt dev server npm run dev ``` -------------------------------- ### WordPress Core Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/client-app-router-fetch-data/README.md Commands for direct interaction with the WordPress environment, including starting, stopping, and destroying the entire WordPress setup. ```shell wp:start Starts the WordPress environment. wp:stop Stops the WordPress environment. wp:destroy Completely removes the WordPress environment. ``` -------------------------------- ### List Installed HWP Plugins Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/basic-cli/README.md Command to list all installed HWP plugins and their current status. It shows plugin names, versions, and activation status. ```bash pnpm plugins ``` -------------------------------- ### Initial Repository Setup Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/custom-sitemap-apollo/README.md Steps to clone the repository and install project dependencies using npm. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit npm install ``` -------------------------------- ### Clone and Install Project Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-graphql-debug/README.md Clones the project repository from GitHub and installs its dependencies. This is the initial setup step for using the toolkit. ```shell git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit pnpm install ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/custom-sitemap-apollo/README.md Commands to navigate to the example directory and build/start the Next.js application. ```bash cd examples/next/custom-sitemap-apollo npm run example:build ``` -------------------------------- ### HWPToolkit WordPress Management Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-filesystem-routing/README.md Commands for managing the WordPress environment, including starting, stopping, and destroying the setup. ```APIDOC wp:start - Starts the WordPress environment. wp:stop - Stops the WordPress environment. wp:destroy - Completely removes the WordPress environment. ``` -------------------------------- ### Build and Start Next.js Example Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/webhooks-isr/README.md Commands to build and start the Next.js example application for webhook ISR testing. This process includes setting up the WordPress environment via wp-env and running the Next.js development server. ```bash cd examples/next/webhooks-isr pnpm example:build ``` -------------------------------- ### Build and Start Next.js Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/wp-theme-rendered-blocks/README.md Commands to build and start the Next.js example application. This process includes setting up a local WordPress development environment using `wp-env` and running the Next.js development server. ```bash # Navigate to the example app directory cd examples/next/wp-theme-rendered-blocks # Build and start the application npm run example:build ``` -------------------------------- ### Project Setup and Configuration Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-data-fetch/README.md Commands and configuration for setting up the project environment, including cloning the repository, installing dependencies, and configuring environment variables for the WordPress URL and privacy policy. ```bash # Clone the repository git clone https://github.com/wpengine/hwptoolkit.git # Navigate to the project directory cd hwptoolkit # Install pnpm packages pnpm install # Create .env file with necessary variables # Ensure NEXT_PUBLIC_WORDPRESS_URL is set to your WordPress instance (e.g., http://localhost:8888) # Ensure NEXT_PRIVACY_POLICY_URI is set to the URI of your privacy policy page # Example using echo command: # echo "NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888\nNEXT_PRIVACY_POLICY_URI=/privacy-policy" > examples/next/apollo-client-data-fetch/example-app/.env ``` ```env NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888 NEXT_PRIVACY_POLICY_URI=/privacy-policy ``` -------------------------------- ### Local Docker Environment Setup Script Source: https://github.com/wpengine/hwptoolkit/blob/main/plugins/hwp-previews/TESTING.md Shell script to set up the local Docker environment for testing, handling necessary configurations and dependencies. ```shell sh bin/local/setup-docker-env.sh ``` -------------------------------- ### Directory Structure for Testing Source: https://github.com/wpengine/hwptoolkit/blob/main/plugins/hwp-previews/TESTING.md Provides an overview of the project's directory structure related to testing, including scripts for environment setup, test execution, and configuration files. ```text bin/ ├── install-test-env.sh # Set up test WP environment ├── run-codeception.sh # Run Codeception tests ├── run-e2e.sh # Run E2E (Playwright) tests ├── run-coverage.sh # Generate coverage reports └── local/ ├── setup-docker-env.sh # Setup Docker environment ├── run-unit-tests.sh # Run unit tests in Docker with Codeception ├── run-e2e-tests.sh # Run e2e tests in Docker with Playwright ├── run-qa.sh # Run php code quality checks with PHPStan, Psalm and PHPCS ├── run-wpunit.sh # Run WPUnit tests in Docker └── run-functional.sh # Run functional tests in Docker tests/ ├── _data/ # Test data (e.g. DB dumps) ├── _envs/ # Environment configs ├── _output/ # Test output (logs, coverage) ├── _support/ # Helper classes, modules ├── wpunit/ # WPUnit (WordPress-aware unit/integration) test cases ├── wpunit.suite.dist.yml └── wpunit/ └── bootstrap.php # Bootstrap for WPUnit tests .env.dist # Example environment variables for testing codeception.dist.yml # Main Codeception config ``` -------------------------------- ### Setup Repository and Packages Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/custom-sitemap-vanilla-wpgraphql/README.md Provides the necessary bash commands to clone the project repository, install npm packages, and configure the environment variables for the Next.js application. ```bash git clone https://github.com/wpengine/hwptoolkit.git cd hwptoolkit && npm install ``` ```bash echo "NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888\nNEXT_PUBLIC_URL=http://localhost:3000" > examples/next/custom-sitemap-vanilla-wpgraphql/example-app/.env ``` -------------------------------- ### Codeception Configuration Example (Min Coverage) Source: https://github.com/wpengine/hwptoolkit/blob/main/plugins/hwp-previews/TESTING.md Illustrates a configuration setting within Codeception for minimum test coverage required for CI checks. ```yml min_coverage: 95% ``` -------------------------------- ### Example Environment Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/webhooks-isr/README.md Commands for managing the Next.js development server and WordPress environment setup. These commands handle initialization, running, and stopping the application stack. ```APIDOC example:build Description: Prepares the environment by unzipping images, starting WordPress, importing the database, and starting the application. Usage: example:build ``` ```APIDOC example:dev Description: Runs the Next.js development server. Usage: example:dev ``` ```APIDOC example:dev:install Description: Installs the required Next.js packages. Usage: example:dev:install ``` ```APIDOC example:start Description: Starts WordPress and the Next.js development server. Usage: example:start ``` ```APIDOC example:stop Description: Stops the WordPress environment. Usage: example:stop ``` ```APIDOC example:prune Description: Rebuilds and restarts the application by destroying and recreating the WordPress environment. Usage: example:prune ``` -------------------------------- ### Create Astro Project with Basics Template Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/astro/template-hierarchy-data-fetching-urql/example-app/README.md Command to initialize a new Astro project using the official 'basics' starter kit. This command leverages npm to execute the Astro CLI and set up a foundational project. ```sh npm create astro@latest -- --template basics ``` -------------------------------- ### Build for Production Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/template-hierarchy-data-fetching/example-app/README.md Builds the Nuxt application for production deployment. This process optimizes the application for performance and creates static assets ready for hosting. ```npm npm run build ``` ```pnpm pnpm build ``` ```yarn yarn build ``` ```bun bun run build ``` -------------------------------- ### JavaScript Fetch Page Content by URI Source: https://github.com/wpengine/hwptoolkit/blob/main/docs/explanation/routing.md A JavaScript example demonstrating how to fetch page content using the URL pathname (URI). This approach is recommended for reliably identifying and retrieving content in headless WordPress setups. ```javascript // pages/posts/[slug].js export async function getProps({ url }) { const content = await fetchPageContent(url.pathname); return { props: { content } }; } ``` -------------------------------- ### Astro Project Structure Overview Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/astro/template-hierarchy-data-fetching-urql/example-app/README.md Illustrates the typical directory and file structure for a basic Astro project. Key directories include 'public' for static assets and 'src' for source code like layouts and pages. ```text / ├── public/ │ └── favicon.svg ├── src/ │ ├── layouts/ │ │ └── Layout.astro │ └── pages/ │ └── index.astro └── package.json ``` -------------------------------- ### Faust.js Resolved Template List Example Source: https://github.com/wpengine/hwptoolkit/blob/main/docs/explanation/routing.md An example of a list of potential templates resolved for a piece of content in Faust.js, ordered by importance. This list guides the frontend application in selecting the appropriate component to render the content. ```json [ "page-my-slug", "page", "page-23", "singular", "index" ] ``` -------------------------------- ### Install Dependencies Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/render-blocks-pages-router/README.md Installs all necessary project dependencies for the Next.js example using npm, as defined in the package.json file. ```bash npm install ``` -------------------------------- ### Install Dependencies (PNPM) Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-graphql-debug/README.md Installs project dependencies using the PNPM package manager. This is a prerequisite for running the application and its examples. ```shell pnpm install ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-authentication/README.md Details the commands required to build and start the Next.js application, which includes setting up the WordPress environment, importing the database, and running the Next.js development server. ```bash cd examples/next/apollo-authentication npm run example:build ``` -------------------------------- ### Start Development Server Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/template-hierarchy-data-fetching/example-app/README.md Starts the Nuxt development server on http://localhost:3000. This command is used to run the application locally during development, allowing for hot-reloading and other development features. ```npm npm run dev ``` ```pnpm pnpm dev ``` ```yarn yarn dev ``` ```bun bun run dev ``` -------------------------------- ### Setup .env File for Next.js Webhook ISR Example Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/webhooks-isr/README.md Commands to create and populate the .env file required for the Next.js webhook ISR example. It sets the WordPress URL and a secret token for webhook validation. ```bash echo "NEXT_PUBLIC_WORDPRESS_URL=http://localhost:8888" > examples/next/webhooks-isr/example-app/.env echo "WEBHOOK_REVALIDATE_SECRET=your_webhook_secret_token" > examples/next/webhooks-isr/example-app/.env ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/template-hierarchy-data-fetching/example-app/README.md Installs project dependencies using various package managers like npm, pnpm, yarn, and bun. Ensure you have the respective package manager installed. ```npm npm install ``` ```pnpm pnpm install ``` ```yarn yarn install ``` ```bun bun install ``` -------------------------------- ### WordPress Core Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-sitemap-apollo/README.md Commands for direct interaction with the WordPress environment, including starting, stopping, and destroying the entire WordPress setup. ```shell wp:start Starts the WordPress environment. wp:stop Stops the WordPress environment. wp:destroy Completely removes the WordPress environment. ``` -------------------------------- ### WP Environment Management Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/hybrid-sitemap-apollo/README.md Commands for controlling the WordPress environment's lifecycle, including starting, stopping, and completely removing the setup. ```APIDOC wp:start Description: Starts the WordPress environment. Usage: pnpm wp:start wp:stop Description: Stops the WordPress environment. Usage: pnpm wp:stop wp:destroy Description: Completely removes the WordPress environment. Usage: pnpm wp:destroy ``` -------------------------------- ### Running Development Server Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/proxied-graphql-debug/example-app/README.md Commands to start the Next.js development server using different package managers (npm, yarn, pnpm, bun). The server is typically accessed at http://localhost:3000. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Astro CLI Commands Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/astro/template-hierarchy-data-fetching-urql/example-app/README.md Common commands for managing and building an Astro project. These commands are typically run from the project's root directory using npm scripts or directly via the Astro CLI. ```APIDOC npm install - Installs project dependencies listed in package.json. npm run dev - Starts the local development server, usually at http://localhost:4321. npm run build - Builds your production-ready site into the './dist/' directory. npm run preview - Previews your production build locally before deploying. npm run astro ... - Executes Astro CLI commands, such as 'astro add' or 'astro check'. npm run astro -- --help - Displays help information and available options for the Astro CLI. ``` -------------------------------- ### WP-ENV Command Reference Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-authentication/README.md Details on using the wp-env command-line tool for managing WordPress environments. This includes starting, stopping, and destroying the WordPress setup. ```shell npm run wp-env Use any other wp-env command. ``` -------------------------------- ### Preview Production Build Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/nuxt/template-hierarchy-data-fetching/example-app/README.md Locally previews the production build of the Nuxt application. This command is useful for testing the production version before deploying it to a live environment. ```npm npm run preview ``` ```pnpm pnpm preview ``` ```yarn yarn preview ``` ```bun bun run preview ``` -------------------------------- ### Troubleshooting WordPress Database Issues Source: https://github.com/wpengine/hwptoolkit/blob/main/plugins/hwp-previews/TESTING.md Reinstall WordPress within the Docker container to resolve database-related problems. This command performs a fresh installation with specified parameters. ```shell docker exec hwp-previews-wordpress-1 wp core install \ --url=http://localhost \ --title="Test Site" \ --admin_user=admin \ --admin_password=admin \ --admin_email=admin@example.com \ --allow-root ``` -------------------------------- ### Build and Start Application Source: https://github.com/wpengine/hwptoolkit/blob/main/examples/next/apollo-client-data-fetch/README.md Commands to build and start the Next.js application. This process includes setting up the WordPress environment, importing the database, and running the Next.js development server. ```bash # Navigate to the example application directory cd examples/next/apollo-client-data-fetch # Build and start the application pnpm example:build # This command performs the following actions: # - Unzips wp-env/uploads.zip to wp-env/uploads # - Starts wp-env (WordPress development environment) # - Imports the database from wp-env/db/database.sql # - Installs Next.js dependencies for example-app # - Runs the Next.js dev script ```