MCPcopy Create free account
hub / github.com/aiscript-dev/aiscript / getNewLog

Function getNewLog

scripts/pre-release.mjs:51–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49actions.collectChangeLogs = {
50 async read() {
51 const getNewLog = async () => {
52 const pathes = (await readdir(FILES.chlogs)).map(path => `${FILES.chlogs}/${path}`);
53 const pathesLastUpdate = await Promise.all(
54 pathes.map(async (path) => {
55 const gittime = Number((await exec(
56 `git log -1 --pretty="format:%ct" "${path}"`
57 )).stdout);
58 if (gittime) return { path, lastUpdate: gittime };
59 else {
60 console.log(`Warning: git timestamp of "${path}" was not detected`);
61 return { path, lastUpdate: Infinity }
62 }
63 })
64 );
65 pathesLastUpdate.sort((a, b) => a.lastUpdate - b.lastUpdate);
66 const logPromises = pathesLastUpdate.map(({ path }) => readFile(path, enc));
67 const logs = await Promise.all(logPromises);
68 return logs.map(v => v.trim()).join('\n');
69 };
70 const getOldLog = async () => {
71 const log = await readFile(FILES.chlog, enc);
72 const idx = log.indexOf('#');

Callers 1

readFunction · 0.85

Calls 1

logMethod · 0.45

Tested by

no test coverage detected