Skip to content

Commit 7825b44

Browse files
authored
Fixes: Adding missing script and composer install reference (#20)
* fix: adds missing wp-env script * fix: adds composer install step to setup to avoid fatals when loading autoload file * fix: update changelog
1 parent cac7d66 commit 7825b44

File tree

3 files changed

+66
-62
lines changed

3 files changed

+66
-62
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ Prefix the change with one of these keywords:
1616
- _Security_: in case of vulnerabilities.
1717

1818
## [Unreleased]
19+
20+
- _Fixed_: Missing wp-env script and some documentation changes.

README.md

Lines changed: 62 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ This plugin serves as a foundational template for WordPress block development, u
66

77
## Table of Contents
88

9-
- [Core Features & Architecture](#core-features--architecture)
10-
- [Block Architecture](#block-architecture)
11-
- [Unified Block Management](#unified-block-management)
12-
- [Efficient Asset Loading](#efficient-asset-loading)
13-
- [Build System](#build-system)
14-
- [Asset Management](#asset-management)
15-
- [Technical Implementation](#technical-implementation)
16-
- [Development Environment](#development-environment)
17-
- [Prerequisites](#prerequisites)
18-
- [Getting Setup](#getting-setup)
19-
- [Local WordPress Environment](#local-wordpress-environment)
20-
- [Local Site Info](#local-site-info)
21-
- [Troubleshooting](#troubleshooting)
22-
- [Development Commands](#development-commands)
23-
- [Coding Standards](#coding-standards)
24-
- [Project Structure](#project-structure)
9+
- [Core Features & Architecture](#core-features--architecture)
10+
- [Block Architecture](#block-architecture)
11+
- [Unified Block Management](#unified-block-management)
12+
- [Efficient Asset Loading](#efficient-asset-loading)
13+
- [Build System](#build-system)
14+
- [Asset Management](#asset-management)
15+
- [Technical Implementation](#technical-implementation)
16+
- [Development Environment](#development-environment)
17+
- [Prerequisites](#prerequisites)
18+
- [Getting Setup](#getting-setup)
19+
- [Local WordPress Environment](#local-wordpress-environment)
20+
- [Local Site Info](#local-site-info)
21+
- [Troubleshooting](#troubleshooting)
22+
- [Development Commands](#development-commands)
23+
- [Coding Standards](#coding-standards)
24+
- [Project Structure](#project-structure)
2525

2626
## Core Features & Architecture
2727

@@ -31,52 +31,52 @@ This plugin serves as a foundational template for WordPress block development, u
3131

3232
The plugin provides a structured approach to managing multiple block types:
3333

34-
- Static Blocks: Traditional Gutenberg blocks rendered entirely in JavaScript
35-
- Dynamic Blocks: Server-side rendered blocks using PHP for dynamic content
36-
- Interactive Blocks: Client-side interactive blocks with JavaScript functionality
34+
- Static Blocks: Traditional Gutenberg blocks rendered entirely in JavaScript
35+
- Dynamic Blocks: Server-side rendered blocks using PHP for dynamic content
36+
- Interactive Blocks: Client-side interactive blocks with JavaScript functionality
3737

3838
#### Efficient Asset Loading
3939

4040
Each block operates as an independent unit, similar to single-block plugins, with:
4141

42-
- Isolated asset loading - scripts and styles load only when blocks are used
43-
- Separate frontend and editor bundles to optimize performance
44-
- Smart asset versioning through WordPress's build process (the asset.php files automatically track dependencies and versions based on content changes)
42+
- Isolated asset loading - scripts and styles load only when blocks are used
43+
- Separate frontend and editor bundles to optimize performance
44+
- Smart asset versioning through WordPress's build process (the asset.php files automatically track dependencies and versions based on content changes)
4545

4646
### Build System
4747

4848
#### Asset Management
4949

5050
The plugin uses WordPress's modern build system with some notable features:
5151

52-
- Automatic version hashing through `.asset.php` files
53-
- The version numbers in `Enqueues.php` are dynamically generated during build, preventing cache issues and ensuring users always get the latest block versions
54-
- Dependencies are automatically tracked and included in the build process
52+
- Automatic version hashing through `.asset.php` files
53+
- The version numbers in `Enqueues.php` are dynamically generated during build, preventing cache issues and ensuring users always get the latest block versions
54+
- Dependencies are automatically tracked and included in the build process
5555

5656
The build process supports loading an additional script into the block editor for:
5757

58-
- Block variations and modifications
59-
- Custom style variations
60-
- Custom block categories
61-
- Other block related functionality
58+
- Block variations and modifications
59+
- Custom style variations
60+
- Custom block categories
61+
- Other block related functionality
6262

6363
### Technical Implementation
6464

6565
The plugin demonstrates modern WordPress development practices:
6666

67-
- Proper namespacing and class structure
68-
- Clean separation of concerns between editor and frontend code
69-
- WordPress coding standards compliance
70-
- Development tooling for code quality (ESLint, PHP_CodeSniffer, Prettier)
67+
- Proper namespacing and class structure
68+
- Clean separation of concerns between editor and frontend code
69+
- WordPress coding standards compliance
70+
- Development tooling for code quality (ESLint, PHP_CodeSniffer, Prettier)
7171

7272
### Development Environment
7373

7474
The plugin includes a complete development environment with:
7575

76-
- Docker-based local WordPress setup through `wp-env`
77-
- Hot reloading for development
78-
- Automated build processes for production
79-
- Comprehensive linting and formatting tools
76+
- Docker-based local WordPress setup through `wp-env`
77+
- Hot reloading for development
78+
- Automated build processes for production
79+
- Comprehensive linting and formatting tools
8080

8181
This structure provides a robust foundation for building complex block-based solutions while maintaining clean code organization and optimal performance.
8282

@@ -86,10 +86,10 @@ This structure provides a robust foundation for building complex block-based sol
8686

8787
Before you begin, ensure you have the following installed:
8888

89-
- Node.js (v16 or higher)
90-
- Docker (if you intend to use `wp-env`)
91-
- Composer
92-
- Git
89+
- Node.js (v16 or higher)
90+
- Docker (if you intend to use `wp-env`)
91+
- Composer
92+
- Git
9393

9494
## Getting Setup
9595

@@ -100,51 +100,52 @@ git clone https://github.com/troychaplin/multi-block-starter.git
100100
cd multi-block-starter
101101
nvm install
102102
npm install
103+
composer install
103104
```
104105

105106
## Local WordPress Environment
106107

107108
This project includes [@wordpress/env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) as an optional local development environment. You can run the following to start and stop the Docker container:
108109

109-
- `npm run wp-env start`
110-
- `npm run wp-env stop`
110+
- `npm run wp-env start`
111+
- `npm run wp-env stop`
111112

112113
### Local Site Info
113114

114-
- Site: http://localhost:8888
115-
- Admin: http://localhost:8888/wp-admin
116-
- Login: `admin`
117-
- Password: `password`
115+
- Site: http://localhost:8888
116+
- Admin: http://localhost:8888/wp-admin
117+
- Login: `admin`
118+
- Password: `password`
118119

119120
### Troubleshooting
120121

121122
If wp-env issues occur try the following:
122123

123-
- `npm run wp-env stop`
124-
- `npm run wp-env clean`
125-
- `npm run wp-env start`
124+
- `npm run wp-env stop`
125+
- `npm run wp-env clean`
126+
- `npm run wp-env start`
126127

127128
## Development Commands
128129

129-
- `npm start` - Start development mode with hot reloading
130-
- `npm run build` - Build production assets
131-
- `npm run lint:js` - Lint JavaScript files
132-
- `npm run lint:css` - Lint CSS files
133-
- `npm run format` - Format code using WordPress standards
130+
- `npm start` - Start development mode with hot reloading
131+
- `npm run build` - Build production assets
132+
- `npm run lint:js` - Lint JavaScript files
133+
- `npm run lint:css` - Lint CSS files
134+
- `npm run format` - Format code using WordPress standards
134135

135136
## Coding Standards
136137

137138
This project follows WordPress coding standards using:
138139

139-
- PHP_CodeSniffer with WordPress Coding Standards
140-
- ESLint with WordPress configuration
141-
- Prettier for code formatting
140+
- PHP_CodeSniffer with WordPress Coding Standards
141+
- ESLint with WordPress configuration
142+
- Prettier for code formatting
142143

143144
Required VS Code extensions:
144145

145-
- PHP CodeSniffer
146-
- ESLint
147-
- Prettier
146+
- PHP CodeSniffer
147+
- ESLint
148+
- Prettier
148149

149150
### Troubleshooting
150151

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"size": "size-limit",
4040
"packages-update": "wp-scripts packages-update",
4141
"plugin-zip": "wp-scripts plugin-zip",
42-
"prepare": "husky"
42+
"prepare": "husky",
43+
"wp-env": "wp-env"
4344
},
4445
"files": [
4546
"[^.]*"

0 commit comments

Comments
 (0)