Skip to content

Commit 4bf2560

Browse files
release: cli v3.1.0
1 parent 60149a0 commit 4bf2560

26 files changed

Lines changed: 971 additions & 347 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"devDependencies": {
1414
"@changesets/cli": "^2.30.0",
1515
"@types/node": "25.6.0",
16+
"esbuild": "0.28.0",
1617
"knip": "6.4.0",
1718
"oxfmt": "0.44.0",
1819
"oxlint": "1.59.0",

packages/cli/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# patch-pulse
22

3+
## 3.1.0
4+
5+
### Minor Changes
6+
7+
- Automatically respect `.gitignore` when scanning for `package.json` files. Directories listed in `.gitignore` (such as `dist/`, `build/`, `.next/`) are now skipped during workspace traversal, preventing false positives from build output.
8+
9+
A new `includePaths` config option lets you opt specific gitignored directories back into scanning when needed. `ignorePaths` continues to take priority over `includePaths`.
10+
11+
`patchpulse.json` is now a supported config filename and is the preferred format going forward. `patchpulse.config.json` and `.patchpulserc` variants remain supported.
12+
13+
Also updated the README example screenshot.
14+
315
## 3.0.1
416

517
### Patch Changes

packages/cli/assets/example.png

109 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# build output
2+
dist/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "with-gitignore-root",
3+
"private": true
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "app",
3+
"dependencies": {
4+
"react": "^18.2.0"
5+
}
6+
}

packages/cli/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "patch-pulse",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "Check for outdated npm dependencies",
55
"type": "module",
66
"bin": {
@@ -46,7 +46,6 @@
4646
"test:ui": "vitest --ui"
4747
},
4848
"devDependencies": {
49-
"@patch-pulse/shared": "workspace:*",
50-
"esbuild": "0.25.6"
49+
"@patch-pulse/shared": "workspace:*"
5150
}
5251
}

packages/cli/src/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const PACKAGE_MANAGERS: readonly PackageManager[] = [
1515
* The filenames of the configuration files that PatchPulse looks for.
1616
*/
1717
export const CONFIG_FILENAMES: readonly string[] = [
18+
'patchpulse.json',
1819
'patchpulse.config.json',
1920
'.patchpulserc.json',
2021
'.patchpulserc',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// Auto-generated file - do not edit manually
2-
export const VERSION = '3.0.0';
2+
export const VERSION = '3.1.0';

packages/cli/src/services/config.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { type PackageManager } from '../types';
66
export interface PatchPulseConfig {
77
skip?: string[];
88
ignorePaths?: string[];
9+
includePaths?: string[];
910
packageManager?: PackageManager;
1011
noUpdatePrompt?: boolean;
1112
}
@@ -111,6 +112,7 @@ export function mergeConfigs(
111112
const merged: PatchPulseConfig = {
112113
skip: [],
113114
ignorePaths: [],
115+
includePaths: [],
114116
};
115117

116118
// Add file config values
@@ -122,6 +124,10 @@ export function mergeConfigs(
122124
merged.ignorePaths!.push(...fileConfig.ignorePaths);
123125
}
124126

127+
if (fileConfig?.includePaths) {
128+
merged.includePaths!.push(...fileConfig.includePaths);
129+
}
130+
125131
// Add CLI config values (merge instead of override)
126132
if (cliConfig.skip) {
127133
merged.skip!.push(...cliConfig.skip);
@@ -131,9 +137,14 @@ export function mergeConfigs(
131137
merged.ignorePaths!.push(...cliConfig.ignorePaths);
132138
}
133139

140+
if (cliConfig.includePaths) {
141+
merged.includePaths!.push(...cliConfig.includePaths);
142+
}
143+
134144
// Remove duplicates while preserving order
135145
merged.skip = [...new Set(merged.skip!)];
136146
merged.ignorePaths = [...new Set(merged.ignorePaths!)];
147+
merged.includePaths = [...new Set(merged.includePaths!)];
137148

138149
// Handle packageManager (CLI takes precedence)
139150
if (cliConfig.packageManager) {
@@ -172,6 +183,12 @@ function validateConfig(config: any): PatchPulseConfig {
172183
);
173184
}
174185

186+
if (config.includePaths && Array.isArray(config.includePaths)) {
187+
validated.includePaths = config.includePaths.filter(
188+
(item: any) => typeof item === 'string',
189+
);
190+
}
191+
175192
if (typeof config.packageManager === 'string') {
176193
validated.packageManager = config.packageManager;
177194
}
@@ -237,6 +254,41 @@ export function shouldIgnorePath({
237254
});
238255
}
239256

257+
/**
258+
* Checks if a path is explicitly included via config, overriding gitignore.
259+
* ignorePaths still takes priority over includePaths.
260+
*/
261+
export function shouldIncludePath({
262+
path,
263+
config = {},
264+
}: {
265+
path: string;
266+
config: PatchPulseConfig | undefined;
267+
}): boolean {
268+
if (!config.includePaths || config.includePaths.length === 0) {
269+
return false;
270+
}
271+
272+
const normalizedPath = normalizeConfigPath(path);
273+
274+
return config.includePaths.some((pattern) => {
275+
const normalizedPattern = normalizeConfigPath(pattern);
276+
277+
if (
278+
!hasPatternSyntax(normalizedPattern) &&
279+
(normalizedPath === normalizedPattern ||
280+
normalizedPath.startsWith(`${normalizedPattern}/`))
281+
) {
282+
return true;
283+
}
284+
285+
return matchesPattern({
286+
value: normalizedPath,
287+
pattern: normalizedPattern,
288+
});
289+
});
290+
}
291+
240292
function normalizeConfigPath(path: string): string {
241293
return path.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+$/, '');
242294
}

0 commit comments

Comments
 (0)