admin: added diff scripts for build page
This commit is contained in:
parent
aff7addfd9
commit
ee79d7d005
@ -1,13 +1,25 @@
|
|||||||
|
import fs from "fs";
|
||||||
|
|
||||||
import { getVersions } from "./utils/npm.js";
|
import { getVersions } from "./utils/npm.js";
|
||||||
import { resolve } from "./utils/path.js";
|
import { resolve } from "./utils/path.js";
|
||||||
import { getDiff } from "./utils/git.js";
|
import { getDiff } from "./utils/git.js";
|
||||||
|
|
||||||
|
function escver(v: string): string {
|
||||||
|
return v.replace(/\./, "-");
|
||||||
|
}
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
let versions = await getVersions("ethers");
|
let versions = await getVersions("ethers");
|
||||||
versions = versions.filter((h) => (h.version.match(/^6\.[0-9]+\.[0-9]+$/)));
|
versions = versions.filter((h) => (h.version.match(/^6\.[0-9]+\.[0-9]+$/)));
|
||||||
for (let i = 1; i < versions.length; i++) {
|
fs.writeFileSync(resolve("misc/diffs/versions.txt"), versions.map((h) => h.version).join(","));
|
||||||
const tag0 = versions[i - 1].gitHead, tag1 = versions[i].gitHead;
|
for (let i = 0; i < versions.length; i++) {
|
||||||
const diff = await getDiff(resolve("dist/ethers.js"), tag0, tag1);
|
for (let j = i + 1; j < versions.length; j++) {
|
||||||
console.log(diff);
|
const filename = resolve(`misc/diffs/diff-${ escver(versions[i].version) }_${ escver(versions[j].version) }.txt`);
|
||||||
|
if (fs.existsSync(filename)) { continue; }
|
||||||
|
const tag0 = versions[i].gitHead, tag1 = versions[j].gitHead;
|
||||||
|
const diff = await getDiff(resolve("src.ts"), tag0, tag1);
|
||||||
|
console.log({ diff });
|
||||||
|
fs.writeFileSync(filename, diff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -37,6 +37,7 @@ export async function getModifiedTime(filename: string): Promise<null | number>
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GitLog {
|
export interface GitLog {
|
||||||
commit: string;
|
commit: string;
|
||||||
author: string;
|
author: string;
|
||||||
@ -89,3 +90,9 @@ export async function getDiff(filename: string, tag0: string, tag1: string): Pro
|
|||||||
if (!result.ok) { throw new Error(`git log error`); }
|
if (!result.ok) { throw new Error(`git log error`); }
|
||||||
return result.stdout.trim();
|
return result.stdout.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getTags(): Promise<Array<string>> {
|
||||||
|
const result = await run("git", [ "tag" ]);
|
||||||
|
if (!result.ok) { throw new Error(`git log error`); }
|
||||||
|
return result.stdout.trim().split("\n");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user