|
| 1 | +# Development Reference |
| 2 | + |
| 3 | +This project uses **npm**, **Composer**, and **Make** for development and build workflows. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +```bash |
| 8 | +# Fast setup for development (installs dependencies & builds) |
| 9 | +make dev |
| 10 | + |
| 11 | +# Start development server (watches for changes) |
| 12 | +npm start |
| 13 | +``` |
| 14 | + |
| 15 | +## Available Commands |
| 16 | + |
| 17 | +### Build & Watch |
| 18 | + |
| 19 | +| Command | Description | |
| 20 | +| :--- | :--- | |
| 21 | +| `npm start` | Starts the build in watch mode. | |
| 22 | +| `make dev` | **Development Build.** Fast, incremental install (`npm install`) + build. | |
| 23 | +| `make build` | **Production Build.** Clean install (`npm ci`) + build. Slow but safe. | |
| 24 | + |
| 25 | +### Quality Control (Linting & Testing) |
| 26 | + |
| 27 | +| Command | Description | |
| 28 | +| :--- | :--- | |
| 29 | +| `npm run lint:js` | Lints JavaScript and TypeScript files. | |
| 30 | +| `npm run lint:js:fix` | Fixes JS/TS linting errors. | |
| 31 | +| `npm run lint:css` | Lints SCSS files. | |
| 32 | +| `npm run lint:css:fix` | Fixes SCSS linting errors. | |
| 33 | +| `composer run lint` | Lints PHP files (PHPCS). | |
| 34 | +| `composer run format` | Fixes PHP linting errors (PHPCBF). | |
| 35 | +| `composer run phpstan` | Runs static analysis with PHPStan. | |
| 36 | + |
| 37 | +### Distribution |
| 38 | + |
| 39 | +| Command | Description | |
| 40 | +| :--- | :--- | |
| 41 | +| `make zip` | **Production Build.** Runs a clean install (`npm ci`) and creates the ZIP. | |
| 42 | +| `make quick-zip` | **Development Package.** Uses existing `node_modules` (incremental) for faster zipping. | |
| 43 | +| `make clean` | Removes build artifacts (`build/`, `vendor/`, `node_modules/`, `.zip`). | |
| 44 | + |
| 45 | +### Versioning & Changelog |
| 46 | + |
| 47 | +| Command | Description | |
| 48 | +| :--- | :--- | |
| 49 | +| `npm run changelog` | Generates/Updates `CHANGELOG.md` based on commits. | |
| 50 | +| `npm run version` | Internal hook used by `npm version` to update changelog and stage it. | |
| 51 | +| `npm version [major|minor|patch]` | Bumps version in `package.json`, updates `CHANGELOG.md`, and creates a git tag. | |
| 52 | + |
| 53 | +## Local GitHub Actions (act) |
| 54 | + |
| 55 | +To test the release workflow locally, we use [act](https://github.com/nektos/act). |
| 56 | + |
| 57 | +### Prerequisites |
| 58 | +- [Docker](https://www.docker.com/products/docker-desktop/) installed and running. |
| 59 | +- `act` installed: `brew install act` (macOS). |
| 60 | + |
| 61 | +### Usage |
| 62 | +```bash |
| 63 | +# Run the release workflow locally |
| 64 | +make act |
| 65 | +# OR |
| 66 | +npm run test:actions |
| 67 | +``` |
| 68 | + |
| 69 | +## Directory Structure |
| 70 | + |
| 71 | +- `src/` - Source code for blocks (React/TypeScript/SCSS). |
| 72 | +- `inc/` - PHP classes and traits (PSR-4 `Core_Carousel`). |
| 73 | +- `build/` - Compiled assets (generated by `npm run build`). |
| 74 | +- `docs/` - Documentation files. |
| 75 | +- `examples/` - Block patterns and examples. |
0 commit comments