/decoupled-kit-js

Pantheon's monorepo for JavaScript SDKs, starter examples, and published npm packages. It makes decoupled on Pantheon feel like magic!

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Pantheon Systems Decoupled Kits

CircleCI

Prerequisites

Welcome to the Pantheon Systems Decoupled Kit Monorepo

This repo is a collection of multiple projects, organized by pnpm workspaces.

Workspaces

There are two main workspaces in the monorepo, starters, and packages, along with a configs workspace and web which houses the documentation.

Starters

Each directory in this workspace represents a starter kit that is mirrored to a standalone repo at release time. Please use the monorepo to develop against the starters.

Packages

The starters have a dependency on one or more of our npm packages, which live in this workspace. Each directory in this workspace represents a library to be published on npm, and to be consumed by the public, and our starter kits.

Setup the Monorepo

To configure the monorepo for development, the following should be installed locally:

  • Node.js version 16 LTS. We recommend using nvm

  • npm version 8.x.x

  • pnpm version 7.17.1

    We recommend using npm. Run the following command to install:

    npm install -g pnpm@7.17.1

Configure the Monorepo

To contribute to this project, follow the directions below. Also see CONTRIBUTING.md for more information.

  1. Fork this repo
  2. Clone your fork to your local machine.
  3. Install dependencies for all packages and starters using the following command. A postinstall script will build the packages:
    pnpm install
  4. Install the husky pre-commit hooks. Run the following command:
    pnpm husky install

Useful Scripts

There are several scripts you can use in the monorepo.

  • To see all available scripts:

    pnpm run
  • Test all projects in the monorepo that have a test script:

    pnpm test
  • Build all packages in the monorepo:

    pnpm build:pkgs
  • Start the nextjs-kit in watch mode:

    pnpm watch:nextjs-kit
  • Build and run the documentation:

    pnpm generate-docs && pnpm start:docs
  • Run commands in a targeted project, folder, or workspace, using the pnpm filter flag.

    For example, to start the Gatsby starter (filter by namespace):

    pnpm --filter gatsby-wordpress-starter develop
  • Lint the starters (filter by directory):

    pnpm --filter './starters/**' lint

If you need to run a command in a specific project, use the alias in the ROOT package.json scripts (pnpm run to see the full list in your terminal), or use a filter. Please do not cd into the project directory and use npm or yarn.


Versions and Releases

Generating a Changeset

To generate a new changeset, run pnpm changeset in the root of the repository. The generated Markdown files in the .changeset directory should be committed to the repository.

Creating and Publishing New Versions

Versions and releases are created as part of our CI process and typically should not be created manually.

Canary Releases

Each push to the canary (default) branch triggers the canary-release.yml GitHub Action workflow which will open a PR back to the repo, and on merge it will release any package with a changeset to the canary tag on GitHub and npm.


Bug Reports and Feature Requests


Further Reading

For more information on contributing to this project, see CONTRIBUTING.md