mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 21:22:43 +00:00
refactor(cli): skip issue URL lookup for unplanned problems
This commit is contained in:
1 parent
45bd3f771d
commit
7f6a7d4776
2 files changed
+20
-12
No files matched your search
+16
-8
@@ -18,13 +18,15 @@
|
||||
* renders no badges: the docs MDX `wrapper`
|
||||
* (`apps/docs/components/ProblemBadges.astro`) turns `topics:` and the
|
||||
* `video:` key `videos.ts` writes into the badge row under the description.
|
||||
* - Every page carries its GitHub problem issue as frontmatter `issue:` (the
|
||||
* issue's URL; the `problem`-labelled issue titled `LC <num> · …`), rendered
|
||||
* by the same wrapper as a GitHub badge after the others. Like `topics:` it
|
||||
* is filled once — on create, or on any run that finds it missing — and the
|
||||
* issue list is fetched only on such a run (never on a sync with nothing
|
||||
* new); offline, or with no `gh` auth, the page is written without it and
|
||||
* the next sync retries. Delete the key to refetch it.
|
||||
* - Every planned page (a problem the README plan lists) carries its GitHub
|
||||
* problem issue as frontmatter `issue:` (the URL of the `problem`-labelled
|
||||
* issue titled `LC <num> · …`), rendered by the same wrapper as a GitHub
|
||||
* badge after the others; an unplanned warm-up has no catalog issue and no
|
||||
* key. Like `topics:` it is filled once — on create, or on any run that
|
||||
* finds it missing — and the issue list is fetched only on such a run
|
||||
* (never on a sync with nothing new); offline, or with no `gh` auth, the
|
||||
* page is written without it and the next sync retries. Delete the key to
|
||||
* refetch it.
|
||||
* - Every tag a page carries that no campaign topic teaches (not a key of
|
||||
* `apps/docs/topic-landings.ts`) gets a placeholder guide page in the
|
||||
* Appendix, `appendix/<slug>.mdx`, with `list:` pointing at LeetCode's
|
||||
@@ -436,8 +438,14 @@ function problemIssues(): Promise<Map<number, string> | undefined> {
|
||||
return issueUrls;
|
||||
}
|
||||
|
||||
/** The problem's issue URL, or undefined (warned when GitHub answered but has no such issue). */
|
||||
/**
|
||||
* The problem's issue URL, or undefined (warned when GitHub answered but has
|
||||
* no such issue). Only a problem the README plan lists has a catalog issue;
|
||||
* an unplanned warm-up never will, so it is not looked up — otherwise its
|
||||
* missing key would re-list the issues and re-warn on every sync.
|
||||
*/
|
||||
async function issueUrl(sol: Solution): Promise<string | undefined> {
|
||||
if (!topics.has(sol.num)) return undefined;
|
||||
const urls = await problemIssues();
|
||||
const url = urls?.get(sol.num);
|
||||
if (urls && !url) console.warn(`no problem issue titled "LC ${sol.num} · …" for ${sol.num}.${sol.slug}`);
|
||||
|
||||
Reference in new issue
Block a user