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?: string,
defaults?: {
// The default output style for CLI scripts
cliScriptOutputStyle?: string,
// 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[]
}
},
// 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)
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.
Objects are merged deeply.
import { mergeProjectConfig } from "pacwich/config";
export default mergeProjectConfig(
{ defaults: { parallelMax: 4 } },
{ defaults: { shell: "bun" } },
// Factory function receives the accumulated config up to that point
(prevConfig) => ({ defaults: { includeRootWorkspace: true } }),
);
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"
}
}
}

