Introducing WooCommerce Monorepo

WooCommerce Admin’s code has now safely landed in Core WooCommerce repository, which has been transformed into a monorepo. This monorepo is now capable of unifying code across the WooCommerce platform into a central repository facilitating an integrated developer experience no matter which part of WooCommerce is being developed.

If you would like to read more about why we have made these changes, we published a post last year providing more context. This post will explain what changes have been made, how it affects developers, and upcoming improvements in the monorepo.

Changes that were made

While folding WooCommerce Admin code and its Javascript packages into the monorepo is the most central change, an opportunity was taken to rethink developer tooling to benefit the experience and handle the task of developing, testing, and releasing multiple projects from the same repository.

  • PNPM – With a multitude of projects with interconnected dependencies, a faster, more efficient build tool with stricter policies on dependencies was required. PNPM fit the bill with its ability to suit the needs of a monorepo.
  • Turborepo – A high-performance build system built for monorepos. It supports very configurable task caching to enable developers to work in a repository with many dependencies while not having to build, test, and lint the entire repository repeatedly.
  • wp-env – Integrating a development environment into WooCommerce allows a seamless development experience that is easy to use for writing features or testing.

Pull down the latest from the monorepo and take a look for yourself.

pnpm install
pnpm exec turbo run build --filter=woocommerce

Turbo commands will allow you to build, test, and lint all of the projects within the monorepo. You can take a look at our readme for more comprehensive documentation on what these commands do and how to use them.

A New File Structure

The WooCommerce monorepo contains plugins, developer tooling, and packages related to the entire WooCommerce platform. Keeping things organised in a logical way is crucial for maintaining code that makes searching for particular logic intuitive. Here is the basic structure simplified.

- woocommerce-monorepo
  |- packages
    |- js
    |- php
  |- plugins
    |- woocommerce
    |- woocommerce-beta-tester
  |- tools
    |- changelogger

Upcoming Changes

The WooCommerce Monorepo is a work in progress as we continue to add functionality and incorporate more of the WooCommerce ecosystem.

  • WooCommerce Admin will completely fold into plugins/woocommerce
  • WooCommerce Admin feature plugin will be deprecated
  • Continue refining the release process for plugins and packages so that automation can lead to more frequent and stable releases.
  • Improve WooCommerce Beta Tester as a tool to aid in developing in the WooCommerce context, especially in regards to modern React based pages.

Give it a spin

And be sure to let us know what you think.


Leave a Reply

Your email address will not be published. Required fields are marked *