admin: using new update-version script
This commit is contained in:
parent
7096b067da
commit
fa87757253
@ -1,7 +1,7 @@
|
||||
import semver from "semver";
|
||||
import { FetchRequest } from "../utils/index.js";
|
||||
import { atomicWrite } from "./utils/fs.js";
|
||||
import { getGitTag } from "./utils/git.js";
|
||||
import { getGitLog } from "./utils/git.js";
|
||||
import { loadJson, saveJson } from "./utils/json.js";
|
||||
import { resolve } from "./utils/path.js";
|
||||
const cache = {};
|
||||
@ -28,7 +28,18 @@ function writeVersion(version) {
|
||||
// Remote pkg
|
||||
const remotePkgInfo = remoteInfo.versions[remoteVersion];
|
||||
const remoteGitHead = remotePkgInfo.gitHead;
|
||||
const gitHead = await getGitTag(resolve("."));
|
||||
//const gitHead = await getGitTag(resolve("."));
|
||||
let gitHead = "";
|
||||
for (const log of await getGitLog(".")) {
|
||||
if (log.body.startsWith("admin:")) {
|
||||
continue;
|
||||
}
|
||||
gitHead = log.commit;
|
||||
break;
|
||||
}
|
||||
if (gitHead === "") {
|
||||
throw new Error("no meaningful commit found");
|
||||
}
|
||||
// There are new commits, not reflected in the package
|
||||
// published on npm; update the gitHead and version
|
||||
if (gitHead !== remoteGitHead) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"update-version.js","sourceRoot":"","sources":["../../src.ts/_admin/update-version.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,KAAK,GAAwB,EAAG,CAAC;AAEvC,KAAK,UAAU,aAAa,CAAC,IAAY;IACrC,IAAI,CAAC,KAAK,CAAC,IA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OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAC"}
|
@ -15,4 +15,38 @@ export async function getGitTag(filename) {
|
||||
}
|
||||
return hashMatch[1];
|
||||
}
|
||||
export async function getGitLog(filename, limit) {
|
||||
if (limit == null) {
|
||||
limit = 100;
|
||||
}
|
||||
const result = await run("git", ["log", "-n", String(limit), "--", filename]);
|
||||
if (!result.ok) {
|
||||
throw new Error(`git log error`);
|
||||
}
|
||||
let log = result.stdout.trim();
|
||||
if (!log) {
|
||||
return [];
|
||||
}
|
||||
const logs = [{ commit: "", author: "", date: "", body: "" }];
|
||||
for (const line of log.split("\n")) {
|
||||
const hashMatch = line.match(/^commit\s+([0-9a-f]{40})/i);
|
||||
if (hashMatch) {
|
||||
logs.push({ commit: hashMatch[1], author: "", date: "", body: "" });
|
||||
}
|
||||
else {
|
||||
if (line.startsWith("Author:")) {
|
||||
logs[logs.length - 1].author = line.substring(7).trim();
|
||||
}
|
||||
else if (line.startsWith("Date:")) {
|
||||
logs[logs.length - 1].date = line.substring(5).trim();
|
||||
}
|
||||
else {
|
||||
logs[logs.length - 1].body = (logs[logs.length - 1].body + " " + line).trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Nix the bootstrap entry
|
||||
logs.shift();
|
||||
return logs;
|
||||
}
|
||||
//# sourceMappingURL=git.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src.ts/_admin/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB;IAC5C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE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AI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACzD;iBAAM;gBACH,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;aACjF;SACJ;KACL;IAED,0BAA0B;IAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;IAEb,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
@ -104,7 +104,7 @@
|
||||
"types": "./types/wordlistsindex.d.ts"
|
||||
}
|
||||
},
|
||||
"gitHead": "c1f86802fb0d7af9d01c7255d7d5c70d4b6390e1",
|
||||
"gitHead": "1f2318a34a224fc7e4c63fae1c680e1af14895ec",
|
||||
"keywords": [
|
||||
"ethereum",
|
||||
"ethers",
|
||||
|
Loading…
Reference in New Issue
Block a user