Skip to content

johnhooks/wp-blocks

 
 

Repository files navigation

wp-blocks

A monorepo of tools and blocks for the WordPress Gutenberg editor.

What is this?

A collection of Gutenberg blocks and utilities built using TypeScript.

Included are detailed examples of how to configure block plugins using TypeScript.

Getting started

This project uses pnpm to manage dependencies and turbo to orchestrate the build process of the packages in the monorepo.

git clone https://github.com/wp-blocks/wp-blocks.git
cd wp-blocks
pnpm install
pnpm build
pnpm wp-env:start

See wp-env for details and requirements of usage.

Project structure

examples/ # example plugins and blocks, detailing how to use deferent aspects of the Gutenberg APIs
packages/ # published and internal packages of wp-blocks
scripts/  # internal build scripts

wp-scripts is used as much as possible to keep the build process similar to Gutenberg, though some packages use custom build scripts that are internal to wp-blocks.

The linting and formatting are also similar to Gutenberg, most of the modification are for linting TypeScript.

Gutenberg APIs and TypeScript

Currently Gutenberg's support of TypeScript is incomplete. Some packages provide their own types while others are available from Definitely Typed (though some are outdated). To complicated it further, some packages use ambiguous types like Object or any, which makes property access difficult in TypeScript without a lot of type guards or type assertions.

The answer to this issue to for all @wordpress packages to provide their own explicit type. Though this will be difficult. Support for TypeScript in the WordPress community is tepid and the code base wasn't written with typing in mind. In the meantime this project patches the types where necessary in the types directory.

License

wp-blocks is free software, and is released under the terms of the GNU General Public License version 3. See LICENSE.md for complete license.

About

A library of tools and blocks for the WordPress Gutenberg editor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 54.4%
  • JavaScript 39.9%
  • SCSS 3.3%
  • PHP 2.2%
  • Shell 0.2%