A customizable gallery block for WordPress with both free and pro versions.
This is a monorepo containing multiple packages managed with npm workspaces:
@galleryberg/galleryberg-gallery-block(packages/galleryberg-gallery-block/) - Free version with tiles, masonry, justified, and square layouts@galleryberg/galleryberg-gallery-block-pro(packages/galleryberg-gallery-block-pro/) - Pro version with mosaic layout and premium features@galleryberg/shared(packages/shared/) - Shared components and utilities used by both versions
# Install pnpm globally (if not already installed)
npm install -g pnpm
# Install all dependencies and link workspace packages
pnpm install
# Start development for all workspaces (parallel)
pnpm start
# Start development for free version only
pnpm run start:galleryberg
# Start development for pro version only
pnpm run start:pro
# Build both versions
pnpm run build:allpnpm start # Start dev mode for all workspaces (parallel)
pnpm run start:galleryberg # Start dev mode for free version only
pnpm run start:pro # Start dev mode for pro version onlypnpm build # Build all workspaces (parallel)
pnpm run build:galleryberg # Build free version only
pnpm run build:pro # Build pro version only
pnpm run build:all # Build both free and pro sequentiallypnpm run lint # Lint all workspaces
pnpm run lint:js # Lint JavaScript in all workspaces
pnpm run lint:css # Lint CSS/SCSS in all workspaces
pnpm run format # Format code in all workspacespnpm run zip:galleryberg # Build and create ZIP for free version
pnpm run zip:pro # Build and create ZIP for pro version
pnpm run zip:both # Build and create ZIPs for both versions
pnpm run release # Lint, build, and create ZIPs (full release)ZIPs are created in the releases/ folder:
galleryberg-gallery-block.zip(Free version)galleryberg-gallery-block-pro.zip(Pro version)
pnpm run clean # Remove all node_modules, build folders, and pnpm-lock.yaml
pnpm run clean:build # Remove only build folders
pnpm run clean:zip # Remove ZIP filesgalleryberg-gallery-block/ # Monorepo root
├── packages/
│ ├── galleryberg-gallery-block/ # Free version
│ │ ├── src/
│ │ │ ├── gallery/ # Gallery block
│ │ │ └── image/ # Image block
│ │ ├── assets/ # Lightbox assets
│ │ ├── build/ # Compiled files
│ │ ├── includes/ # PHP helpers
│ │ ├── galleryberg-gallery-block.php
│ │ ├── readme.txt
│ │ └── package.json
│ │
│ ├── galleryberg-gallery-block-pro/ # Pro version
│ │ ├── src/
│ │ │ └── index.js # Pro entry point
│ │ ├── includes/
│ │ │ ├── bootstrap.php # Pro initialization
│ │ │ └── class-pro-features.php # Pro features manager
│ │ ├── galleryberg-gallery-block-pro.php # Pro main plugin file
│ │ └── package.json
│ │
│ └── shared/ # Shared code
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── utils/ # Styling helpers
│ │ └── index.js # Shared exports
│ └── package.json
│
├── releases/ # Distribution ZIPs
├── package.json # Root package.json
└── README.md # This file
pnpm workspaces automatically link packages together:
// In packages/galleryberg-gallery-block/src/gallery/inspector.js
import { BorderControl, ColorSettings } from "@galleryberg/shared";
// ↑ Automatically resolves to packages/shared/src/When you run pnpm install:
- All workspace dependencies are installed
- Packages are symlinked together using
workspace:*protocol - Shared dependencies are stored in a global content-addressable store
- Hard links are created to save disk space
# Start dev server
pnpm run start:galleryberg
# Make changes in packages/galleryberg-gallery-block/src/
# Build for production
pnpm run build:galleryberg
# Create distribution ZIP
pnpm run zip:galleryberg# Start dev server
pnpm run start:pro
# Make changes in packages/galleryberg-gallery-block-pro/src/
# Build for production
pnpm run build:pro
# Create distribution ZIP
pnpm run zip:pro- Create component in
packages/shared/src/components/ - Export it in
packages/shared/src/index.js - Use it in free or pro packages:
import { MyComponent } from '@galleryberg/shared'
wp-content/plugins/galleryberg-gallery-block/
wp-content/plugins/galleryberg-gallery-block-pro/
You can symlink the packages to your WordPress plugins folder:
# Free version
ln -s /path/to/galleryberg-gallery-block/packages/galleryberg-gallery-block /path/to/wordpress/wp-content/plugins/galleryberg-gallery-block
# Pro version
ln -s /path/to/galleryberg-gallery-block/packages/galleryberg-gallery-block-pro /path/to/wordpress/wp-content/plugins/galleryberg-gallery-block-proGPL-2.0-or-later
- Make changes in appropriate package
- Run
npm run lintto check for errors - Run
npm run build:allto test builds - Create pull request
Happy coding! 🚀