Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
71ff282
feat: add automated dependency bump checker and changelog validator
cryptodev-2s Nov 6, 2025
8ee555d
refactor: inline package name resolution during diff parsing
cryptodev-2s Nov 6, 2025
084415e
refactor: use example repo name instead of core
cryptodev-2s Nov 6, 2025
2a87c2e
fix: remove useless re-exported types
cryptodev-2s Nov 6, 2025
88d116a
docs: add changelog entry for check-deps command
cryptodev-2s Nov 12, 2025
044b46e
fix: correct changelog entry order - BREAKING first, then deps
cryptodev-2s Dec 2, 2025
ccc66e2
fix: distinguish BREAKING entries when matching changelog entries
cryptodev-2s Dec 2, 2025
48221f2
fix: show correct section name in changelog validation error
cryptodev-2s Dec 2, 2025
045331a
feat: support renamed packages in changelog validation
cryptodev-2s Dec 2, 2025
8af5181
fix: include packageRename in second parseChangelog call
cryptodev-2s Dec 2, 2025
19c3ccd
fix: detect non-scoped package dependency changes
cryptodev-2s Dec 2, 2025
0d1de51
tests: add functional tests (#189)
cryptodev-2s Dec 3, 2025
49b197d
Fix optionalDependencies incorrectly attributed to dependencies section
cryptodev-2s Dec 3, 2025
b53e89c
Fix operator precedence in section boundary check
cryptodev-2s Dec 3, 2025
2f73bd8
Fix default branch check to use defaultBranch parameter instead of ha…
cryptodev-2s Dec 3, 2025
259d980
Reset section state when parsing new file in diff
cryptodev-2s Dec 3, 2025
703e1c3
Fix check-deps command usage in CHANGELOG
cryptodev-2s Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix default branch check to use defaultBranch parameter instead of ha…
…rdcoded values
  • Loading branch information
cryptodev-2s committed Dec 3, 2025
commit 2f73bd8233127045e71e84b775a20092b04b3f24
22 changes: 22 additions & 0 deletions src/check-dependency-bumps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ describe('check-dependency-bumps', () => {
expect(result).toStrictEqual({});
});

it('returns empty object when on custom defaultBranch without fromRef', async () => {
const stdoutWriteSpy = jest.spyOn(stdout, 'write');
jest
.spyOn(repoModule, 'getCurrentBranchName')
.mockResolvedValue('develop');

const result = await checkDependencyBumps({
defaultBranch: 'develop',
projectRoot: '/path/to/project',
stdout,
stderr,
});

expect(result).toStrictEqual({});
expect(stdoutWriteSpy).toHaveBeenCalledWith(
expect.stringContaining('📌 Current branch: develop'),
);
expect(stdoutWriteSpy).toHaveBeenCalledWith(
expect.stringContaining('⚠️ You are on the develop branch'),
);
});

it('auto-detects merge base when fromRef is not provided', async () => {
const stdoutWriteSpy = jest.spyOn(stdout, 'write');
const getStdoutSpy = jest.spyOn(miscUtilsModule, 'getStdoutFromCommand');
Expand Down
6 changes: 3 additions & 3 deletions src/check-dependency-bumps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ export async function checkDependencyBumps({
const currentBranch = await getCurrentBranchName(projectRoot);
stdout.write(`\n📌 Current branch: ${currentBranch}\n`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Some of these messages could be pretty confusing if one of the parameters gets set to an empty string; it might return a warning message that doesn't tip us off to the problem. For example, if currentBranch was an empty string, this would suggest that the next line is the branch name, which it isn't. And with some of the later messages, inputting an empty string as the default branch name would be similarly confusing.

I have a habit of wrapping embedded parameters like this in single-quotes, so it's clear that there is something here in case it gets set to an unexpected value like an empty string, e.g.:

Suggested change
stdout.write(`\n📌 Current branch: ${currentBranch}\n`);
stdout.write(`\n📌 Current branch: '${currentBranch}'\n`);

Perhaps that would be helpful for these messages too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// Skip if we're on main/master
if (currentBranch === 'main' || currentBranch === 'master') {
// Skip if we're on the default branch
if (currentBranch === defaultBranch) {
stdout.write(
'⚠️ You are on the main/master branch. Please specify commits to compare or switch to a feature branch.\n',
`⚠️ You are on the ${defaultBranch} branch. Please specify commits to compare or switch to a feature branch.\n`,
);
return {};
}
Expand Down