lc-review 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +31 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { appendFile, readFile } from "node:fs/promises";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { supermemo } from "supermemo";
|
|
6
|
+
import { log } from "node:console";
|
|
6
7
|
|
|
7
8
|
//#region src/core.ts
|
|
8
9
|
const logRecordSchema = z.object({
|
|
@@ -100883,6 +100884,7 @@ const ProblemSetSchema = z.object({ data: z.object({ problemsetQuestionListV2: z
|
|
|
100883
100884
|
//#endregion
|
|
100884
100885
|
//#region src/data.ts
|
|
100885
100886
|
const parsedProblemSet = ProblemSetSchema.parse(problems_default);
|
|
100887
|
+
const ALL_PROBLEMS = parsedProblemSet.data.problemsetQuestionListV2.questions;
|
|
100886
100888
|
const PREMIUM_PROBLEMS = new Set(parsedProblemSet.data.problemsetQuestionListV2.questions.filter((q) => q.paidOnly).map((q) => q.id));
|
|
100887
100889
|
|
|
100888
100890
|
//#endregion
|
|
@@ -100964,7 +100966,7 @@ const review = async (logFile, n, premium = false) => {
|
|
|
100964
100966
|
|
|
100965
100967
|
//#endregion
|
|
100966
100968
|
//#region package.json
|
|
100967
|
-
var version = "0.0.
|
|
100969
|
+
var version = "0.0.9";
|
|
100968
100970
|
|
|
100969
100971
|
//#endregion
|
|
100970
100972
|
//#region src/index.ts
|
|
@@ -101016,8 +101018,13 @@ async function main() {
|
|
|
101016
101018
|
case "debug:show-json-log": {
|
|
101017
101019
|
const logFile = args.shift();
|
|
101018
101020
|
if (!logFile) throw new Error("no log file provided");
|
|
101019
|
-
|
|
101020
|
-
|
|
101021
|
+
await showJsonLog(logFile);
|
|
101022
|
+
break;
|
|
101023
|
+
}
|
|
101024
|
+
case "debug:show-problem-info": {
|
|
101025
|
+
const problemNumber = args.shift();
|
|
101026
|
+
if (!problemNumber) throw new Error("no problem number provided");
|
|
101027
|
+
showProblemInfo(problemNumber);
|
|
101021
101028
|
break;
|
|
101022
101029
|
}
|
|
101023
101030
|
default:
|
|
@@ -101054,8 +101061,29 @@ Commands:
|
|
|
101054
101061
|
Debug commands:
|
|
101055
101062
|
|
|
101056
101063
|
debug:show-json-log <log_file>
|
|
101064
|
+
|
|
101065
|
+
debug:show-problem-info <problem_number>
|
|
101057
101066
|
`);
|
|
101058
101067
|
}
|
|
101068
|
+
async function showProblemInfo(problemNumber) {
|
|
101069
|
+
const problem = ALL_PROBLEMS.find((p) => p.id === parseInt(problemNumber));
|
|
101070
|
+
if (!problem) {
|
|
101071
|
+
console.log(`Problem ${problemNumber} not found.`);
|
|
101072
|
+
return;
|
|
101073
|
+
}
|
|
101074
|
+
log(`ID: ${problem.id}`);
|
|
101075
|
+
log(`Title: ${problem.title}`);
|
|
101076
|
+
log(`Difficulty: ${problem.difficulty}`);
|
|
101077
|
+
log(`Paid only: ${problem.paidOnly}`);
|
|
101078
|
+
log(`AC Rate: ${(problem.acRate * 100).toFixed(2)}%`);
|
|
101079
|
+
if (problem.topicTags) log(`Topics: ${problem.topicTags.map((tag) => tag.name).join(", ")}`);
|
|
101080
|
+
log(`URL: https://leetcode.com/problems/${problem.titleSlug}/`);
|
|
101081
|
+
log(`AC rate: ${(problem.acRate * 100).toFixed(2)}%`);
|
|
101082
|
+
}
|
|
101083
|
+
async function showJsonLog(logFile) {
|
|
101084
|
+
const records = await readLogFromFile(logFile);
|
|
101085
|
+
console.log(JSON.stringify(records, null, 2));
|
|
101086
|
+
}
|
|
101059
101087
|
|
|
101060
101088
|
//#endregion
|
|
101061
101089
|
export { };
|