MCPcopy Create free account
hub / github.com/NomicFoundation/hardhat / readAllNewChangsets

Function readAllNewChangsets

scripts/lib/changesets.ts:13–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 * Read all the changesets.
12 */
13export async function readAllNewChangsets() {
14 const allChangesetNames = (await readdir(changesetDir))
15 .filter((file) => file.endsWith(".md"))
16 .map((file) => file.slice(0, -3));
17
18 const changesets = [];
19
20 for (const newChangeSetName of allChangesetNames) {
21 const changesetFilePath = path.join(changesetDir, `${newChangeSetName}.md`);
22
23 const changesetContent = await readFile(changesetFilePath, "utf-8");
24
25 const { content, frontMatter } = parseFrontMatter(changesetContent);
26 const commitHash = await getAddingCommit(changesetFilePath);
27
28 changesets.push({
29 frontMatter,
30 content,
31 path: changesetFilePath,
32 commitHash,
33 });
34 }
35
36 return changesets;
37}
38
39export function parseFrontMatter(markdown: string) {
40 const match = markdown.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);

Callers 2

versionAlphaFunction · 0.90
validateMergeGroupFunction · 0.90

Calls 4

readdirFunction · 0.85
parseFrontMatterFunction · 0.85
getAddingCommitFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected