fix: include plugin shrinkwraps in dependency reports · openclaw/openclaw@82f69a2
vincentkoc
·
2026-05-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,17 @@ const DEPENDENCY_FILE_PATTERNS = [
|
20 | 20 | /\/package\.json$/u, |
21 | 21 | ]; |
22 | 22 | |
| 23 | +const DEPENDENCY_DIFF_PATHS = [ |
| 24 | +"package.json", |
| 25 | +"package-lock.json", |
| 26 | +"npm-shrinkwrap.json", |
| 27 | +"pnpm-lock.yaml", |
| 28 | +"pnpm-workspace.yaml", |
| 29 | +"extensions/*/npm-shrinkwrap.json", |
| 30 | +"*package.json", |
| 31 | +"patches", |
| 32 | +]; |
| 33 | + |
23 | 34 | function payloadFromLockfile(lockfileText) { |
24 | 35 | return createBulkAdvisoryPayload(collectAllResolvedPackagesFromLockfile(lockfileText)); |
25 | 36 | } |
@@ -175,22 +186,14 @@ export function isDependencyFile(filePath) {
|
175 | 186 | return DEPENDENCY_FILE_PATTERNS.some((pattern) => pattern.test(filePath)); |
176 | 187 | } |
177 | 188 | |
| 189 | +export function dependencyDiffPathspecs() { |
| 190 | +return [...DEPENDENCY_DIFF_PATHS]; |
| 191 | +} |
| 192 | + |
178 | 193 | function gitDiffDependencyFiles(baseRef, cwd) { |
179 | 194 | const output = execFileSync( |
180 | 195 | "git", |
181 | | -[ |
182 | | -"diff", |
183 | | -"--name-status", |
184 | | -baseRef, |
185 | | -"--", |
186 | | -"package.json", |
187 | | -"package-lock.json", |
188 | | -"npm-shrinkwrap.json", |
189 | | -"pnpm-lock.yaml", |
190 | | -"pnpm-workspace.yaml", |
191 | | -"*package.json", |
192 | | -"patches", |
193 | | -], |
| 196 | +["diff", "--name-status", baseRef, "--", ...DEPENDENCY_DIFF_PATHS], |
194 | 197 | { |
195 | 198 | cwd, |
196 | 199 | encoding: "utf8", |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { describe, expect, it } from "vitest"; |
2 | 2 | import { |
3 | 3 | createDependencyChangesReport, |
| 4 | +dependencyDiffPathspecs, |
4 | 5 | isDependencyFile, |
5 | 6 | } from "../../scripts/dependency-changes-report.mjs"; |
6 | 7 | |
@@ -50,4 +51,8 @@ describe("dependency-changes-report", () => {
|
50 | 51 | expect(isDependencyFile("pnpm-lock.yaml")).toBe(true); |
51 | 52 | expect(isDependencyFile("docs/gateway/security/index.md")).toBe(false); |
52 | 53 | }); |
| 54 | + |
| 55 | +it("includes plugin shrinkwrap files in git diff pathspecs", () => { |
| 56 | +expect(dependencyDiffPathspecs()).toContain("extensions/*/npm-shrinkwrap.json"); |
| 57 | +}); |
53 | 58 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。