Skip to content

Commit dc7aa31

Browse files
committed
fix: improve change detection logic in bump-changed-versions script to filter out non-meaningful changes
1 parent 14c8f85 commit dc7aa31

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

scripts/bump-changed-versions.cjs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,33 @@ function hasPackageChanged(packagePath, sinceTag) {
4949
}
5050

5151
// Check if there are any changes in the package directory since the tag
52-
const changes = execSync(
52+
const diff = execSync(
5353
`git diff --name-only ${sinceTag} HEAD -- ${pkgDir}`,
5454
{ encoding: 'utf8', cwd: path.join(__dirname, '..') }
5555
).trim();
5656

57-
if (changes) {
58-
console.log(` ✓ ${packagePath} has changes since ${sinceTag}:`);
59-
changes.split('\n').forEach(file => console.log(` - ${file}`));
57+
if (!diff) {
58+
console.log(` ○ ${packagePath} has no changes since ${sinceTag}`);
59+
return false;
60+
}
61+
62+
const files = diff.split('\n');
63+
64+
// Filter out files that shouldn't trigger a release (Documentation, Tests, etc.)
65+
const meaningfulChanges = files.filter(file => {
66+
const isMarkdown = file.endsWith('.md');
67+
const isTest = file.includes('/tests/') || file.endsWith('.test.ts') || file.endsWith('.spec.ts') || file.endsWith('.check.ts');
68+
const isIgnore = file.endsWith('.npmignore') || file.endsWith('.gitignore');
69+
70+
return !isMarkdown && !isTest && !isIgnore;
71+
});
72+
73+
if (meaningfulChanges.length > 0) {
74+
console.log(` ✓ ${packagePath} has ${meaningfulChanges.length} meaningful changes since ${sinceTag}:`);
75+
meaningfulChanges.forEach(file => console.log(` - ${file}`));
6076
return true;
6177
} else {
62-
console.log(` ○ ${packagePath} has no changes since ${sinceTag}`);
78+
console.log(` ○ ${packagePath} only has documentation, test or ignore changes. Skipping bump.`);
6379
return false;
6480
}
6581
} catch (error) {

0 commit comments

Comments
 (0)