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

Function getAvailableVersions

scripts/utils.ts:58–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56export const tempDirName = "next-forge-update";
57
58export const getAvailableVersions = async (): Promise<string[]> => {
59 const changelog = await readFile("CHANGELOG.md", "utf-8");
60 const versionRegex = /# v(\d+\.\d+\.\d+)/g;
61 const matches = [...changelog.matchAll(versionRegex)];
62
63 return matches
64 .map((match) => match[1])
65 .sort((a, b) => {
66 const [aMajor, aMinor, aPatch] = a.split(".").map(Number);
67 const [bMajor, bMinor, bPatch] = b.split(".").map(Number);
68 if (aMajor !== bMajor) {
69 return bMajor - aMajor;
70 }
71 if (aMinor !== bMinor) {
72 return bMinor - aMinor;
73 }
74 return bPatch - aPatch;
75 });
76};

Callers 1

updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected