Verify

The verify feature exists to help detect issues with a project.

Detecting Missing Workspace Dependencies

pacwich uses workspaces' package.json files to detect when a workspace depends on another workspace.

In Bun and pnpm, explicit dependencies are required to import/export from another workspace, by adding "my-workspace": "workspace:*" to package.json dependencies.

However, npm workspaces do not require explicit package.json dependencies, so pacwich cannot detect implicit dependencies without source code analysis.

The verify feature performs simple analysis to detect imports/exports in JS/TS files from other workspaces not listed in a workspace's package.json.

Analysis is only performed on workspace input files. You can further configure the verify command's behavior at the project level or workspace level.

Usage

Adding pacwich verify to your root package.json "prepare" script, a pre-commit hook, or a CI pipeline can be especially helpful to catch issues.

pacwich verify --strict will fail if implicit workspace dependencies are detected.

See the CLI reference or the API reference for more information.

Example output:

$ pacwich verify
[pacwich WARN: VerifyIssue]: Workspace "a" imports "b" but does not declare it as a 
dependency (packages/a/hello.ts:1).
  Add "b": "workspace:*" to the "dependencies" field of packages/a/package.json.
Verify finished with 1 warning.
Re-run with --strict to make warnings fail, or address each warning above.