Merge branch 'backstage:master' into feature/catalog-export

This commit is contained in:
1337
2026-05-20 20:32:27 +02:00
committed by GitHub
1172 changed files with 67648 additions and 10161 deletions
+15
View File
@@ -1,5 +1,20 @@
# @backstage/cli-node
## 0.3.2
### Patch Changes
- 357d639: Fixed a bug in `PackageGraph.listChangedPackages` where removed dependencies were not detected during lockfile analysis. The dependency graph from the previous lockfile was not being merged, causing transitive dependency removals to be missed.
- Updated dependencies
- @backstage/errors@1.3.1
- @backstage/cli-common@0.2.2
## 0.3.2-next.1
### Patch Changes
- 357d639: Fixed a bug in `PackageGraph.listChangedPackages` where removed dependencies were not detected during lockfile analysis. The dependency graph from the previous lockfile was not being merged, causing transitive dependency removals to be missed.
## 0.3.2-next.0
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/cli-node",
"version": "0.3.2-next.0",
"version": "0.3.2",
"description": "Node.js library for Backstage CLIs",
"backstage": {
"role": "node-library"
@@ -222,4 +222,51 @@ c-dep@^2:
'origin/master',
);
});
it('detects packages affected by a removed dependency in the lockfile', async () => {
const graph = PackageGraph.fromPackages(testPackages);
mockListChangedFiles.mockResolvedValueOnce(['yarn.lock']);
// The old lockfile (at the ref) has b depending on b-dep
mockReadFileAtRef.mockResolvedValueOnce(`
a@^1:
version: "1.0.0"
b@^1:
version: "1.0.0"
dependencies:
b-dep: ^1
b-dep@^1:
version: "1.0.0"
integrity: sha512-old
c@^1:
version: "1.0.0"
`);
// The current lockfile no longer has b-dep at all
jest.spyOn(Lockfile, 'load').mockResolvedValueOnce(
Lockfile.parse(`
a@^1:
version: "1.0.0"
b@^1:
version: "1.0.0"
c@^1:
version: "1.0.0"
`),
);
await expect(
graph
.listChangedPackages({
ref: 'origin/master',
analyzeLockfile: true,
})
.then(pkgs => pkgs.map(pkg => pkg.name)),
).resolves.toEqual(['b']);
});
});
@@ -393,7 +393,7 @@ export class PackageGraph extends Map<string, PackageGraphNode> {
// Merge the dependency graph from the other lockfile into this one in
// order to be able to detect removals accurately.
{
const otherGraph = thisLockfile.createSimplifiedDependencyGraph();
const otherGraph = otherLockfile.createSimplifiedDependencyGraph();
for (const [name, dependencies] of otherGraph) {
const node = graph.get(name);
if (node) {