Glossary

Learn some of the basic terms and primitives of pacwich here.

Terms

Project

This is typically the same as the root of your git repository for your monorepo. This is where your top-level package.json file is located and where you've defined workspaces for your package manager, whether via the "workspaces" field in package.json (for Bun or npm) or pnpm-workspace.yaml (for pnpm).

Workspace

A workspace is simply a nested package within your project that has its own package.json file and is matched by the workspaces you declare at the root of your project with your package manager's config.

pacwich simply builds its features to enrich and work with plain workspaces.

Script

In the context of pacwich, a "script" generally refers to an entry in the "scripts" field in a workspace's package.json file by default.

However, pacwich also supports running "inline scripts", one-off shell commands executed from a respective workspace's directory.

Terms in Action

This is a minimal example of a project structure for a Bun or npm monorepo.

Placing workspaces in the packages/ directory is a common convention but not required.

File Tree

my-project/
├── package.json
└── packages/
    ├── my-workspace-a/
    │   └── package.json
    └── my-workspace-b/
        └── package.json

Top-level files

The root package.json, using the "workspaces" field if using Bun or npm:

{
  "name": "my-project",
  "workspaces": [
    "packages/*"
  ]
}

If using pnpm, you would have a pnpm-workspace.yaml file instead of using the "workspaces" field in the root package.json above:

# pnpm-workspace.yaml
packages:
  - 'packages/*'

Workspaces

The workspaces' package.json files:

{
  "name": "my-workspace-a",
  "scripts": {
    "my-script": "echo 'My script for workspace A'"
  }
}
{
  "name": "my-workspace-b",
  "scripts": {
    "my-script": "echo 'My script for workspace B'"
  }
}

If you have the above in your project and have ran your install command, pacwich commands should work right away.