Configuration: Project Config File
The optional project configuration is the general configuration for a project at a file such as pacwich.project.json or in its package.json file.
Type Definition
type ProjectConfig = {
// The package manager to use for the project
packageManager?: "bun" | "pnpm" | "npm" | "auto",
defaults?: {
// The default output style for CLI scripts
cliScriptOutputStyle?: "grouped" | "prefixed" | "plain" | "none",
// The default maximum number of scripts that can run in parallel
parallelMax?: number | `${number}%` | "auto" | "unbounded" | "default",
// The default shell to use for inline scripts
shell?: "bun" | "system" | "default",
// Whether to include the root workspace in the workspace list
includeRootWorkspace?: boolean,
// The default git base ref for affected workspaces (default: main)
affectedBaseRef?: string
},
verify?: {
workspaceDependencies?: {
// Ignore these input files for verification of workspace dependencies
ignoreInputFiles?: string[],
// Ignore imports/exports from these workspaces
ignoreImportsFromWorkspacePatterns?: string[]
}
},
// Apply workspace configs in bulk by using workspace patterns
workspacePatternConfigs?: {
patterns?: string[],
config?: WorkspaceConfig | WorkspacePatternConfigFactory
}[]
}
Defaults
The values in config.defaults can also be set by environment variables. Configuration values take precedence over environment variables.
config.defaults.cliScriptOutputStyle: The output style to use for workspace scripts. The default is "grouped" when on a TTY, which always falls back to "prefixed" on non-TTY terminals. Otherwise, it is "prefixed". Other options are "plain" and "none".config.defaults.parallelMax: The parallel max valueconfig.defaults.shell: The shell option for inline scriptsconfig.defaults.includeRootWorkspace: Whether to include the root workspace in the project's workspaces listconfig.defaults.affectedBaseRef: The default git base ref for affected workspaces resolution (this ismainwhen not overridden)
Verify
See the verify page for more information on this feature.
verify.workspaceDependencies.ignoreInputFiles: Ignore these input files for verification of workspace dependencies, relative to the project root.verify.workspaceDependencies.ignoreImportsFromWorkspacePatterns: Ignore imports/exports from these workspaces, using workspace patterns.
The same options can be used in workspace configs. Workspace verify configuration is additive with the project-level config.
Workspace Pattern Configs
You can set workspace configs in bulk by using workspace patterns in workspacePatternConfigs.
See the workspace pattern configs page for more information.
Examples:
1. TypeScript/JavaScript file
path/to/your/project/pacwich.project.ts
or
path/to/your/project/pacwich.project.js
import { defineProjectConfig } from "pacwich/config";
export default defineProjectConfig({
defaults: {
parallelMax: 4,
affectedBaseRef: "my-branch"
},
workspacePatternConfigs: [
{
patterns: [
"path:libraries/frontend/**/*"
],
config: {
tags: [
"frontend",
"library"
]
}
}
]
});
mergeProjectConfig Utility
You can use the mergeProjectConfig function to merge multiple project configurations left to right, with each subsequent config taking precedence.
Fields under defaults merge individually, workspacePatternConfigs entries are concatenated, and verify arrays are concatenated while keeping items unique.
import { mergeProjectConfig } from "pacwich/config";
export default mergeProjectConfig(
{
packageManager: "bun",
defaults: { parallelMax: 4, shell: "system" },
workspacePatternConfigs: [
{ patterns: ["path:packages/apps/**/*"], config: { tags: ["app"] } },
],
verify: {
workspaceDependencies: {
ignoreInputFiles: ["scripts/codegen/**/*"],
ignoreImportsFromWorkspacePatterns: ["tag:legacy"],
},
},
},
{
// fields under defaults merge individually: parallelMax overridden, shell kept
defaults: { parallelMax: 8 },
// appended after the first config's entries
workspacePatternConfigs: [
{ patterns: ["tag:app"], config: { tags: ["deployable"] } },
],
verify: {
workspaceDependencies: {
// "scripts/codegen/**/*" deduplicated, "legacy/**/*.ts" appended
ignoreInputFiles: ["scripts/codegen/**/*", "legacy/**/*.ts"],
},
},
},
// factory form reads the accumulated config so far
(prevConfig) => ({
defaults: { includeRootWorkspace: prevConfig.packageManager === "bun" },
}),
);
// result: {
// packageManager: "bun",
// defaults: { parallelMax: 8, shell: "system", includeRootWorkspace: true },
// workspacePatternConfigs: [<app entry>, <deployable entry>],
// verify: {
// workspaceDependencies: {
// ignoreInputFiles: ["scripts/codegen/**/*", "legacy/**/*.ts"],
// ignoreImportsFromWorkspacePatterns: ["tag:legacy"],
// },
// },
// }
2. JSON/JSONC file
path/to/your/project/pacwich.project.json
or
path/to/your/project/pacwich.project.jsonc
{
"defaults": {
"parallelMax": 4,
"affectedBaseRef": "my-branch"
},
"workspacePatternConfigs": [
{
"patterns": [
"path:libraries/frontend/**/*"
],
"config": {
"tags": [
"frontend",
"library"
]
}
}
]
}
3. package.json
path/to/your/project/package.json
{
"name": "my-project",
"description": "My project root",
"workspaces": [
"packages/*"
],
"pacwich-project": {
"defaults": {
"parallelMax": "50%",
"shell": "bun",
"includeRootWorkspace": true,
"affectedBaseRef": "my-branch"
}
}
}

