MCPcopy
hub / github.com/vercel/next-forge / getDiff

Function getDiff

scripts/update.ts:99–129  ·  view source on GitHub ↗
(
  from: { version: string; files: string[] },
  to: { version: string; files: string[] }
)

Source from the content-addressed store, hash-verified

97};
98
99const getDiff = (
100 from: { version: string; files: string[] },
101 to: { version: string; files: string[] }
102) => {
103 const filesToUpdate: string[] = [];
104
105 for (const file of to.files) {
106 if (allInternalContent.some((ic) => file.startsWith(ic))) {
107 continue;
108 }
109
110 if (!from.files.includes(file)) {
111 filesToUpdate.push(file);
112 continue;
113 }
114
115 const result = run(
116 "git",
117 ["diff", from.version, to.version, "--", cleanFileName(file)],
118 { stdio: "pipe", maxBuffer: 1024 * 1024 * 1024 }
119 );
120
121 const hasChanged = result.stdout.toString().trim() !== "";
122
123 if (hasChanged) {
124 filesToUpdate.push(file);
125 }
126 }
127
128 return filesToUpdate;
129};
130
131export const update = async (options: { from?: string; to?: string }) => {
132 try {

Callers 1

updateFunction · 0.85

Calls 2

runFunction · 0.85
cleanFileNameFunction · 0.85

Tested by

no test coverage detected