stacks/buddy
fix: read composer.json from the project path, and drop groups the strategy filter emptied
#1444
Merged
glennmichael123
wants to merge
fix/read-where-you-checked
into
main
3 files
+13
-12
Changes to src/buddy.ts | @@ -2187,15 +2187,16 @@ export class Buddy { |
| 2187 | 2187 | } |
| 2188 | 2188 | } |
| 2189 | 2189 | |
| 2190 | | - if (groupUpdates.length > 0) { |
| 2191 | | - |
| 2192 | | - let filteredUpdates = groupUpdates |
| 2193 | | - if (groupConfig.strategy) { |
| 2194 | | - filteredUpdates = this.filterUpdatesByStrategy(groupUpdates, groupConfig.strategy) |
| 2195 | | - } |
| 2190 | + |
| 2191 | + let filteredUpdates = groupUpdates |
| 2192 | + if (groupConfig.strategy) { |
| 2193 | + filteredUpdates = this.filterUpdatesByStrategy(groupUpdates, groupConfig.strategy) |
| 2194 | + } |
| 2196 | 2195 | |
| 2197 | | - |
| 2198 | | - |
| 2196 | + |
| 2197 | + |
| 2198 | + |
| 2199 | + if (filteredUpdates.length > 0) { |
| 2199 | 2200 | |
| 2200 | 2201 | groups.push({ |
| 2201 | 2202 | name: groupConfig.name, |
src/registry/registry-client.tsmodified+1-1Changes to src/registry/registry-client.ts | @@ -952,7 +952,7 @@ export class RegistryClient { |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | |
| 955 | | - const composerJsonPath = path.join(process.cwd(), 'composer.json') |
| 955 | + const composerJsonPath = path.join(this.projectPath, 'composer.json') |
| 956 | 956 | this.logger.info(`🔍 Reading composer.json from: ${composerJsonPath}`) |
| 957 | 957 | |
| 958 | 958 | if (!fs.existsSync(composerJsonPath)) { |
test/buddy-orchestration.test.tsmodified+3-3Changes to test/buddy-orchestration.test.ts | @@ -749,9 +749,9 @@ describe('buddy orchestration', () => { |
| 749 | 749 | expect(fooTypes?.updates.map((update: PackageUpdate) => update.name)).toEqual(['@types/bun-foo']) |
| 750 | 750 | |
| 751 | 751 | |
| 752 | | - |
| 753 | | - const types = groups.find((group: { name: string }) => group.name === 'Types') |
| 754 | | - expect(types?.updates).toEqual([]) |
| 752 | + |
| 753 | + |
| 754 | + expect(groups.find((group: { name: string }) => group.name === 'Types')).toBeUndefined() |
| 755 | 755 | |
| 756 | 756 | const nonMajor = groups.find((group: { name: string }) => group.name === 'Non-Major Updates') |
| 757 | 757 | expect(nonMajor?.updates.map((update: PackageUpdate) => update.name)).toEqual(['react']) |