From 9c6b42538e5dc4d512449cf9bed6fd85b6b58b42 Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 19 Nov 2023 19:46:12 +0100 Subject: [PATCH] refactor: use handlebars, split generate script --- .github/ISSUE_TEMPLATE/userstyle.yml | 55 +-- .github/issue-labeler.yml | 2 +- .github/labels.yml | 2 +- .github/pr-labeler.yml | 2 +- deno.json | 3 +- deno.lock | 320 ++++++++++++++---- scripts/generate/labels.ts | 50 +++ scripts/generate/main.ts | 313 ++++------------- scripts/generate/readme-styles.ts | 64 ++++ .../generate/templates/userstyle-issue.yml | 5 +- scripts/generate/templates/userstyle.md | 31 +- scripts/generate/utils.ts | 59 ++++ scripts/lint/file-checker.ts | 2 +- scripts/lint/main.ts | 2 +- scripts/lint/metadata.ts | 4 +- scripts/lint/stylelint.ts | 2 +- scripts/sync-maintainers/main.ts | 10 +- scripts/types.d.ts | 2 - scripts/types/github-issue-forms.d.ts | 55 +++ scripts/types/mod.d.ts | 9 + scripts/{ => types}/usercss-meta.d.ts | 0 scripts/types/userstyles.d.ts | 15 +- scripts/update-types.ts | 29 ++ scripts/userstyles.yml | 2 +- 24 files changed, 634 insertions(+), 404 deletions(-) create mode 100644 scripts/generate/labels.ts create mode 100644 scripts/generate/readme-styles.ts create mode 100644 scripts/generate/utils.ts delete mode 100644 scripts/types.d.ts create mode 100644 scripts/types/github-issue-forms.d.ts create mode 100644 scripts/types/mod.d.ts rename scripts/{ => types}/usercss-meta.d.ts (100%) create mode 100755 scripts/update-types.ts diff --git a/.github/ISSUE_TEMPLATE/userstyle.yml b/.github/ISSUE_TEMPLATE/userstyle.yml index 9f0e377126..ef00461bbb 100644 --- a/.github/ISSUE_TEMPLATE/userstyle.yml +++ b/.github/ISSUE_TEMPLATE/userstyle.yml @@ -14,59 +14,7 @@ body: label: What userstyles are you seeing the problem on? description: "Don't worry about the `lbl:` prefix, it allows issues to be automatically labeled!" multiple: true - options: - [ - "lbl:advent-of-code", - "lbl:anilist", - "lbl:boringproxy", - "lbl:brave-search", - "lbl:bstats", - "lbl:canvas-lms", - "lbl:chatgpt", - "lbl:chatreplay", - "lbl:chess.com", - "lbl:cinny", - "lbl:codeberg", - "lbl:crowdin", - "lbl:deepl", - "lbl:ecosia", - "lbl:elk", - "lbl:formative", - "lbl:github", - "lbl:gmail", - "lbl:hacker-news", - "lbl:homepage", - "lbl:hoppscotch", - "lbl:ichi.moe", - "lbl:instagram", - "lbl:invidious", - "lbl:invokeai", - "lbl:lastfm", - "lbl:libreddit", - "lbl:linkedin", - "lbl:mastodon", - "lbl:modrinth", - "lbl:nitter", - "lbl:nixos-search", - "lbl:nixos.wiki", - "lbl:paste.rs", - "lbl:pinterest", - "lbl:planet-minecraft", - "lbl:proton", - "lbl:quizlet", - "lbl:reddit", - "lbl:searxng", - "lbl:startpage", - "lbl:stylus", - "lbl:substack", - "lbl:syncthing", - "lbl:tutanota", - "lbl:twitch", - "lbl:vercel", - "lbl:whatsapp-web", - "lbl:wikiwand", - "lbl:youtube", - ] + options: ["replaceme"] validations: required: true - type: textarea @@ -91,3 +39,4 @@ body: attributes: label: Any additional comments? description: Add any information that hasn't been covered in the previous sections! +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-forms.json diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index 30cdaa58e3..3c16d53498 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -48,4 +48,4 @@ twitch: ["(lbl:twitch)"] vercel: ["(lbl:vercel)"] whatsapp-web: ["(lbl:whatsapp-web)"] wikiwand: ["(lbl:wikiwand)"] -youtube: ["(lbl:youtube)"] +youtube: ["(lbl:youtube)"] \ No newline at end of file diff --git a/.github/labels.yml b/.github/labels.yml index 4224f781b3..af35d0abc0 100644 --- a/.github/labels.yml +++ b/.github/labels.yml @@ -148,4 +148,4 @@ color: "#8aadf4" - name: youtube description: YouTube - color: "#8aadf4" + color: "#8aadf4" \ No newline at end of file diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index 7cf6c563b0..6ee8cf8b7d 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -48,4 +48,4 @@ twitch: styles/twitch/**/* vercel: styles/vercel/**/* whatsapp-web: styles/whatsapp-web/**/* wikiwand: styles/wikiwand/**/* -youtube: styles/youtube/**/* +youtube: styles/youtube/**/* \ No newline at end of file diff --git a/deno.json b/deno.json index 25c2c8b7d9..6a4141c8e7 100644 --- a/deno.json +++ b/deno.json @@ -6,6 +6,7 @@ "@actions/core": "npm:@actions/core@1.10.1", "@octokit/rest": "npm:@octokit/rest@20.0.2", "ajv": "npm:ajv@8.12.0", + "handlebars": "npm:handlebars@4.7.8", "less": "npm:less@4.2.0", "usercss-meta": "npm:usercss-meta@0.12.0" }, @@ -14,6 +15,6 @@ "ci:sync-maintainers": "deno run -A ./scripts/sync-maintainers/main.ts", "lint": "deno run -A ./scripts/lint/main.ts", "lint:fix": "deno task lint --fix", - "update-types": "deno run -A 'npm:json-schema-to-typescript' ./scripts/userstyles.schema.json ./scripts/types/userstyles.d.ts" + "update-types": "deno run -A ./scripts/update-types.ts" } } diff --git a/deno.lock b/deno.lock index b638cf7d09..ded5117453 100644 --- a/deno.lock +++ b/deno.lock @@ -6,7 +6,8 @@ "npm:@octokit/rest@20.0.2": "npm:@octokit/rest@20.0.2_@octokit+core@5.0.1", "npm:@types/less": "npm:@types/less@3.0.6", "npm:ajv@8.12.0": "npm:ajv@8.12.0", - "npm:chalk@5.3.0": "npm:chalk@5.3.0", + "npm:handlebars@4.7.8": "npm:handlebars@4.7.8", + "npm:json-schema-to-typescript": "npm:json-schema-to-typescript@13.1.1_glob@7.2.3", "npm:less@4.2.0": "npm:less@4.2.0", "npm:postcss-less": "npm:postcss-less@6.0.0_postcss@8.4.31", "npm:stylelint": "npm:stylelint@15.11.0_@csstools+css-tokenizer@2.2.1_@csstools+css-parser-algorithms@2.3.2__@csstools+css-tokenizer@2.2.1_postcss-selector-parser@6.0.13_postcss@8.4.31", @@ -48,6 +49,15 @@ "js-tokens": "js-tokens@4.0.0" } }, + "@bcherny/json-schema-ref-parser@10.0.5-fork": { + "integrity": "sha512-E/jKbPoca1tfUPj3iSbitDZTGnq6FUFjkH6L8U2oDwSuwK1WhnnVtCG7oFOTg/DDnyoXbQYUiUiGOibHqaGVnw==", + "dependencies": { + "@jsdevtools/ono": "@jsdevtools/ono@7.1.3", + "@types/json-schema": "@types/json-schema@7.0.15", + "call-me-maybe": "call-me-maybe@1.0.2", + "js-yaml": "js-yaml@4.1.0" + } + }, "@csstools/css-parser-algorithms@2.3.2_@csstools+css-tokenizer@2.2.1": { "integrity": "sha512-sLYGdAdEY2x7TSw9FtmdaTrh2wFtRJO5VMbBrA8tEqEod7GEggFmxTSK9XqExib3yMuYNcvcTdCZIP6ukdjAIA==", "dependencies": { @@ -75,6 +85,10 @@ "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", "dependencies": {} }, + "@jsdevtools/ono@7.1.3": { + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "dependencies": {} + }, "@nodelib/fs.scandir@2.1.5": { "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dependencies": { @@ -182,18 +196,45 @@ "@octokit/openapi-types": "@octokit/openapi-types@19.0.2" } }, + "@types/glob@7.2.0": { + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dependencies": { + "@types/minimatch": "@types/minimatch@5.1.2", + "@types/node": "@types/node@18.16.19" + } + }, + "@types/json-schema@7.0.15": { + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dependencies": {} + }, "@types/less@3.0.6": { "integrity": "sha512-PecSzorDGdabF57OBeQO/xFbAkYWo88g4Xvnsx7LRwqLC17I7OoKtA3bQB9uXkY6UkMWCOsA8HSVpaoitscdXw==", "dependencies": {} }, + "@types/lodash@4.14.201": { + "integrity": "sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ==", + "dependencies": {} + }, + "@types/minimatch@5.1.2": { + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dependencies": {} + }, "@types/minimist@1.2.5": { "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", "dependencies": {} }, + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + }, "@types/normalize-package-data@2.4.4": { "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dependencies": {} }, + "@types/prettier@2.7.3": { + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dependencies": {} + }, "ajv@8.12.0": { "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dependencies": { @@ -219,6 +260,10 @@ "color-convert": "color-convert@2.0.1" } }, + "any-promise@1.3.0": { + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dependencies": {} + }, "argparse@2.0.1": { "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dependencies": {} @@ -260,6 +305,10 @@ "fill-range": "fill-range@7.0.1" } }, + "call-me-maybe@1.0.2": { + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "dependencies": {} + }, "callsites@3.1.0": { "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dependencies": {} @@ -285,9 +334,15 @@ "supports-color": "supports-color@5.5.0" } }, - "chalk@5.3.0": { - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dependencies": {} + "cli-color@2.0.3": { + "integrity": "sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==", + "dependencies": { + "d": "d@1.0.1", + "es5-ext": "es5-ext@0.10.62", + "es6-iterator": "es6-iterator@2.0.3", + "memoizee": "memoizee@0.4.15", + "timers-ext": "timers-ext@0.1.7" + } }, "color-convert@1.9.3": { "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", @@ -347,6 +402,13 @@ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dependencies": {} }, + "d@1.0.1": { + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dependencies": { + "es5-ext": "es5-ext@0.10.62", + "type": "type@1.2.0" + } + }, "debug@3.2.7": { "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dependencies": { @@ -400,10 +462,55 @@ "is-arrayish": "is-arrayish@0.2.1" } }, + "es5-ext@0.10.62": { + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "dependencies": { + "es6-iterator": "es6-iterator@2.0.3", + "es6-symbol": "es6-symbol@3.1.3", + "next-tick": "next-tick@1.1.0" + } + }, + "es6-iterator@2.0.3": { + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "dependencies": { + "d": "d@1.0.1", + "es5-ext": "es5-ext@0.10.62", + "es6-symbol": "es6-symbol@3.1.3" + } + }, + "es6-symbol@3.1.3": { + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dependencies": { + "d": "d@1.0.1", + "ext": "ext@1.7.0" + } + }, + "es6-weak-map@2.0.3": { + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "dependencies": { + "d": "d@1.0.1", + "es5-ext": "es5-ext@0.10.62", + "es6-iterator": "es6-iterator@2.0.3", + "es6-symbol": "es6-symbol@3.1.3" + } + }, "escape-string-regexp@1.0.5": { "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dependencies": {} }, + "event-emitter@0.3.5": { + "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "dependencies": { + "d": "d@1.0.1", + "es5-ext": "es5-ext@0.10.62" + } + }, + "ext@1.7.0": { + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "dependencies": { + "type": "type@2.7.2" + } + }, "fast-deep-equal@3.1.3": { "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dependencies": {} @@ -467,12 +574,23 @@ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dependencies": {} }, + "get-stdin@8.0.0": { + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dependencies": {} + }, "glob-parent@5.1.2": { "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dependencies": { "is-glob": "is-glob@4.0.3" } }, + "glob-promise@4.2.2_glob@7.2.3": { + "integrity": "sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw==", + "dependencies": { + "@types/glob": "@types/glob@7.2.0", + "glob": "glob@7.2.3" + } + }, "glob@7.2.3": { "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { @@ -517,6 +635,16 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dependencies": {} }, + "handlebars@4.7.8": { + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dependencies": { + "minimist": "minimist@1.2.8", + "neo-async": "neo-async@2.6.2", + "source-map": "source-map@0.6.1", + "uglify-js": "uglify-js@3.17.4", + "wordwrap": "wordwrap@1.0.0" + } + }, "hard-rejection@2.1.0": { "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dependencies": {} @@ -629,6 +757,10 @@ "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", "dependencies": {} }, + "is-promise@2.2.2": { + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "dependencies": {} + }, "is-what@3.14.1": { "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==", "dependencies": {} @@ -655,6 +787,25 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dependencies": {} }, + "json-schema-to-typescript@13.1.1_glob@7.2.3": { + "integrity": "sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==", + "dependencies": { + "@bcherny/json-schema-ref-parser": "@bcherny/json-schema-ref-parser@10.0.5-fork", + "@types/json-schema": "@types/json-schema@7.0.15", + "@types/lodash": "@types/lodash@4.14.201", + "@types/prettier": "@types/prettier@2.7.3", + "cli-color": "cli-color@2.0.3", + "get-stdin": "get-stdin@8.0.0", + "glob": "glob@7.2.3", + "glob-promise": "glob-promise@4.2.2_glob@7.2.3", + "is-glob": "is-glob@4.0.3", + "lodash": "lodash@4.17.21", + "minimist": "minimist@1.2.8", + "mkdirp": "mkdirp@1.0.4", + "mz": "mz@2.7.0", + "prettier": "prettier@2.8.8" + } + }, "json-schema-traverse@1.0.0": { "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dependencies": {} @@ -702,12 +853,22 @@ "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dependencies": {} }, + "lodash@4.17.21": { + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dependencies": {} + }, "lru-cache@6.0.0": { "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dependencies": { "yallist": "yallist@4.0.0" } }, + "lru-queue@0.1.0": { + "integrity": "sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==", + "dependencies": { + "es5-ext": "es5-ext@0.10.62" + } + }, "make-dir@2.1.0": { "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", "dependencies": { @@ -731,6 +892,19 @@ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dependencies": {} }, + "memoizee@0.4.15": { + "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", + "dependencies": { + "d": "d@1.0.1", + "es5-ext": "es5-ext@0.10.62", + "es6-weak-map": "es6-weak-map@2.0.3", + "event-emitter": "event-emitter@0.3.5", + "is-promise": "is-promise@2.2.2", + "lru-queue": "lru-queue@0.1.0", + "next-tick": "next-tick@1.1.0", + "timers-ext": "timers-ext@0.1.7" + } + }, "meow@10.1.5": { "integrity": "sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw==", "dependencies": { @@ -781,10 +955,26 @@ "kind-of": "kind-of@6.0.3" } }, + "minimist@1.2.8": { + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dependencies": {} + }, + "mkdirp@1.0.4": { + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dependencies": {} + }, "ms@2.1.2": { "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dependencies": {} }, + "mz@2.7.0": { + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dependencies": { + "any-promise": "any-promise@1.3.0", + "object-assign": "object-assign@4.1.1", + "thenify-all": "thenify-all@1.6.0" + } + }, "nanoid@3.3.7": { "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dependencies": {} @@ -797,6 +987,14 @@ "sax": "sax@1.3.0" } }, + "neo-async@2.6.2": { + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dependencies": {} + }, + "next-tick@1.1.0": { + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", + "dependencies": {} + }, "normalize-package-data@3.0.3": { "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", "dependencies": { @@ -810,6 +1008,10 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dependencies": {} }, + "object-assign@4.1.1": { + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dependencies": {} + }, "once@1.4.0": { "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dependencies": { @@ -906,6 +1108,10 @@ "source-map-js": "source-map-js@1.0.2" } }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dependencies": {} + }, "prr@1.0.1": { "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", "dependencies": {} @@ -1153,6 +1359,25 @@ "strip-ansi": "strip-ansi@6.0.1" } }, + "thenify-all@1.6.0": { + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dependencies": { + "thenify": "thenify@3.3.1" + } + }, + "thenify@3.3.1": { + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dependencies": { + "any-promise": "any-promise@1.3.0" + } + }, + "timers-ext@0.1.7": { + "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", + "dependencies": { + "es5-ext": "es5-ext@0.10.62", + "next-tick": "next-tick@1.1.0" + } + }, "to-regex-range@5.0.1": { "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dependencies": { @@ -1175,6 +1400,18 @@ "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", "dependencies": {} }, + "type@1.2.0": { + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", + "dependencies": {} + }, + "type@2.7.2": { + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", + "dependencies": {} + }, + "uglify-js@3.17.4": { + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "dependencies": {} + }, "undici@5.27.2": { "integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==", "dependencies": { @@ -1216,6 +1453,10 @@ "isexe": "isexe@2.0.0" } }, + "wordwrap@1.0.0": { + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dependencies": {} + }, "wrappy@1.0.2": { "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dependencies": {} @@ -1284,74 +1525,13 @@ "https://deno.land/std@0.206.0/assert/mod.ts": "37c49a26aae2b254bbe25723434dc28cd7532e444cf0b481a97c045d110ec085", "https://deno.land/std@0.206.0/assert/unimplemented.ts": "d56fbeecb1f108331a380f72e3e010a1f161baa6956fd0f7cf3e095ae1a4c75a", "https://deno.land/std@0.206.0/assert/unreachable.ts": "4600dc0baf7d9c15a7f7d234f00c23bca8f3eba8b140286aaca7aa998cf9a536", - "https://deno.land/std@0.206.0/collections/_unstable_binary_search_node.ts": "8d99dd95901d73a0edbe105826ef7ce0e1111ce184d2d0410dbfda172c9ebf35", - "https://deno.land/std@0.206.0/collections/_unstable_red_black_node.ts": "62eb878fff714fdb4eb2e16165336618c443b2a09a904fd42c4ea895dadfadc3", "https://deno.land/std@0.206.0/collections/_utils.ts": "5114abc026ddef71207a79609b984614e66a63a4bda17d819d56b0e72c51527e", - "https://deno.land/std@0.206.0/collections/aggregate_groups.ts": "2ed1698695e7b4877afa2281ad10ce3ce67395aa7479e98cc2ebb751add1c4e9", - "https://deno.land/std@0.206.0/collections/associate_by.ts": "64869182eeed3be9222137d071224ac6a01bcc3c5236610306f99e3e3107ec47", - "https://deno.land/std@0.206.0/collections/associate_with.ts": "cf9735d7b4d345275fd3b7420eaba9726a2844e847f2d9e4be9f103f6f3e2c8b", - "https://deno.land/std@0.206.0/collections/binary_heap.ts": "5cba2b4b79aa42c775e4e881a5726f40d9f0e3920e69dfde1c92d6c2c6928f8f", - "https://deno.land/std@0.206.0/collections/binary_search_tree.ts": "fb4508db4be63cbde1f4886abbc2482b4212adea89d8e9f608f9671f726cc059", - "https://deno.land/std@0.206.0/collections/chunk.ts": "f82c52a82ad9338018570c42f6de0fb132fcb14914c31a444e360ac104d7b55b", "https://deno.land/std@0.206.0/collections/deep_merge.ts": "9db788ba56cb05b65c77166b789e58e125dff159b7f41bf4d19dc1cba19ecb8b", - "https://deno.land/std@0.206.0/collections/distinct.ts": "01595bd8e608a5e2de8a8631055587e6f01d68861e463eef34f8e295713500b8", - "https://deno.land/std@0.206.0/collections/distinct_by.ts": "3afe11d81eafb30c7c9dbf568d94357f3d88153292c00671b72cd695deae6602", - "https://deno.land/std@0.206.0/collections/drop_last_while.ts": "03dd8c55c362efea4f2738b93f102d7487f68beff7b4e4ed67495046b3fe1e4c", - "https://deno.land/std@0.206.0/collections/drop_while.ts": "74cfa9d6b74b3503d5dc70c8ab96af21e7cb2eaff8b9f11aca2aca403e56aeae", - "https://deno.land/std@0.206.0/collections/filter_entries.ts": "77d3f0b3dddcb43e92fc745dd66d01b4922d0eff2a3e2bd25d9d826889f203d8", - "https://deno.land/std@0.206.0/collections/filter_keys.ts": "a29cfe8730ddb54e9e071ea45e8a82e166c7629d18675652def70c1bf80e2ef6", - "https://deno.land/std@0.206.0/collections/filter_values.ts": "16e1fc456a7969e770ec5b89edf5ac97b295ca534b47c1a83f061b409aad7814", - "https://deno.land/std@0.206.0/collections/find_single.ts": "d941876fbec0c1d8b7f41a52f8c1b03198c5695dfaa8d7a12e7a6317d2e6085b", - "https://deno.land/std@0.206.0/collections/first_not_nullish_of.ts": "08d92c4f9c66ff1b1f64a48fa7c1e557e3e6d43f48a46d53a98c3383041b98ae", - "https://deno.land/std@0.206.0/collections/group_by.ts": "f90f483598b38f0174f946589f3af25b1c3cf89d4f3b14d4f0fbe3aaaca0abdd", - "https://deno.land/std@0.206.0/collections/includes_value.ts": "8284a0b3178465b6565d234c1995117320b248dbcff332f77c5e891a11459e0c", - "https://deno.land/std@0.206.0/collections/intersect.ts": "0b4924e2aceaddd5e55591bd9d648cf75745151795ee8a76beddf4facec77548", - "https://deno.land/std@0.206.0/collections/join_to_string.ts": "a487ccc99dbac988698cf5b7c6cc4bb50eefd1784042d0b958a77af413683fe0", - "https://deno.land/std@0.206.0/collections/map_entries.ts": "282b0e5141fbe73a45903674597fb10ec2b211fab8cbac85874eebd97f522a62", - "https://deno.land/std@0.206.0/collections/map_keys.ts": "3dd2cf3a940f1432628cb0252b919d268e8bb38fe8bcd78153a440909173ae98", - "https://deno.land/std@0.206.0/collections/map_not_nullish.ts": "8793a340ca245664902a309ac02861b9eb01780f7b78aa5ad329da7d95e011ec", - "https://deno.land/std@0.206.0/collections/map_values.ts": "c88f306b2b3ec84043e16ab4e1b062055ab32cf4d68bb1d7447afaafa0a1b3bf", - "https://deno.land/std@0.206.0/collections/max_by.ts": "9d5940986aac51b2e4feaebef9cd8bf6e1eceeee5edcf3303e334b737f99520d", - "https://deno.land/std@0.206.0/collections/max_of.ts": "aa29268f102159364bc296eea9f45b0d4f1b041ae9d0037c3dce1c43e21e30be", - "https://deno.land/std@0.206.0/collections/max_with.ts": "252fe7788b6dfcf30cf8c4138cf9bae006a5d545408064ff520293ff0e2fe304", - "https://deno.land/std@0.206.0/collections/min_by.ts": "0fcf1973e8e309da83070dc22def47f468e410d7da462a294c5513ae2c5d6479", - "https://deno.land/std@0.206.0/collections/min_of.ts": "7f2b64620f4f54b75badddfac17e0a84660457233d0921b4c9d9ab31bd3323a8", - "https://deno.land/std@0.206.0/collections/min_with.ts": "ecca4ba5da922fb4b1be515949c59f287e580166985f2b12ee711f768004b33f", - "https://deno.land/std@0.206.0/collections/mod.ts": "c745508c522ecaf9fe4717850a2c6e1e13fd175847f0ae4d2c99d2033095879c", - "https://deno.land/std@0.206.0/collections/partition.ts": "28336d4af97eb8a2a2c3ec4ce28597e657e724be5969417eb697ff0860b9711c", - "https://deno.land/std@0.206.0/collections/partition_entries.ts": "7a30b99b64a31af8e9d6da24239f7778b1cff9cd2f240f41aa2f535d647d54f9", - "https://deno.land/std@0.206.0/collections/permutations.ts": "3e3a9d7a8cc806a9ce9ae8fb0c7f3d37d884b3c7429fcaca4bc5d177d92d8217", - "https://deno.land/std@0.206.0/collections/reduce_groups.ts": "0cbb29ec3281f457dd1bd653c4420cef0a92544b51f31f5ae047436ff01712a2", - "https://deno.land/std@0.206.0/collections/running_reduce.ts": "e25f165456b946e7689a27e0e7fbb2f53d8189ef7cd0937b903e737bd37bacc6", - "https://deno.land/std@0.206.0/collections/sample.ts": "6330fb6567573b252a2ed9da475e54c4b98ca06e6266d34e5f0392095020c86b", - "https://deno.land/std@0.206.0/collections/sliding_windows.ts": "d1c8d18d86b8f02b407379e8681881880b7e3e173d152c5d8dc89d458031b740", - "https://deno.land/std@0.206.0/collections/sort_by.ts": "1207755af756a5da04bebff39146c93cbe54f7870a5d67cf6922e871d96a01d5", - "https://deno.land/std@0.206.0/collections/sum_of.ts": "76db7f04a66bdfa4911c4a592b868c854c690d6f0f83140c315f70caf742c761", - "https://deno.land/std@0.206.0/collections/take_last_while.ts": "9adcfe94a3dd56fbd55951099a121267aa42d8ccbc8152ed3aa210f86c74ca57", - "https://deno.land/std@0.206.0/collections/take_while.ts": "cd9a494d56e6a0a9c3f1e1123d1370633f0d4c6525ccf8aa3bd00b006742bddf", - "https://deno.land/std@0.206.0/collections/union.ts": "0577babef67dd38dc584accbcf75605318346046fe4ff476f0f6e2a1b1092391", - "https://deno.land/std@0.206.0/collections/unstable_binary_heap.ts": "c009225d9f9d93e9cd963565186b2d6cdf3fb8404b3ca0c94b4f15c85031d5fe", - "https://deno.land/std@0.206.0/collections/unstable_binary_search_tree.ts": "d9b4817c9af5b5ec1051345bc56bc0a88e03fb726b66eb27c0072860c0f44e34", - "https://deno.land/std@0.206.0/collections/unstable_comparators.ts": "fa7f9a44cea1d270098a2a5a6f8bb30c61b595c1b1f983bd67c6297d766adffa", - "https://deno.land/std@0.206.0/collections/unstable_red_black_tree.ts": "740b6baf26fd8d90564641d0ea15c2aba6b16071a2b91c314909d171649f57b4", - "https://deno.land/std@0.206.0/collections/unzip.ts": "3d3469c616b04200ff6a883e0d6dc82cac4c205aa65742e375afb8816be75b35", - "https://deno.land/std@0.206.0/collections/without_all.ts": "1e3cccb1ed0659455b473c0766d9414b7710d8cef48862c899f445178f66b779", - "https://deno.land/std@0.206.0/collections/zip.ts": "d5def5cf3a0a3fa167956b7eb2ebdc3aca63a41f7ebdfac8c0d1c44fa0dd588d", "https://deno.land/std@0.206.0/flags/mod.ts": "0948466fc437f017f00c0b972a422b3dc3317a790bcf326429d23182977eaf9f", "https://deno.land/std@0.206.0/fmt/colors.ts": "c51c4642678eb690dcf5ffee5918b675bf01a33fba82acf303701ae1a4f8c8d9", "https://deno.land/std@0.206.0/fmt/printf.ts": "b4ca7dc4b2323b2614c7d11b3e6dc80442e5d56c33665cdf9b9de0dabb80f9ec", "https://deno.land/std@0.206.0/fs/_util.ts": "fbf57dcdc9f7bc8128d60301eece608246971a7836a3bb1e78da75314f08b978", - "https://deno.land/std@0.206.0/fs/copy.ts": "ca19e4837965914471df38fbd61e16f9e8adfe89f9cffb0c83615c83ea3fc2bf", - "https://deno.land/std@0.206.0/fs/empty_dir.ts": "0b4a2508232446eed232ad1243dd4b0f07ac503a281633ae1324d1528df70964", - "https://deno.land/std@0.206.0/fs/ensure_dir.ts": "dc64c4c75c64721d4e3fb681f1382f803ff3d2868f08563ff923fdd20d071c40", - "https://deno.land/std@0.206.0/fs/ensure_file.ts": "39ac83cc283a20ec2735e956adf5de3e8a3334e0b6820547b5772f71c49ae083", - "https://deno.land/std@0.206.0/fs/ensure_link.ts": "c15e69c48556d78aae31b83e0c0ece04b7b8bc0951412f5b759aceb6fde7f0ac", - "https://deno.land/std@0.206.0/fs/ensure_symlink.ts": "b389c8568f0656d145ac7ece472afe710815cccbb2ebfd19da7978379ae143fe", - "https://deno.land/std@0.206.0/fs/eol.ts": "f1f2eb348a750c34500741987b21d65607f352cf7205f48f4319d417fff42842", "https://deno.land/std@0.206.0/fs/exists.ts": "cb59a853d84871d87acab0e7936a4dac11282957f8e195102c5a7acb42546bb8", - "https://deno.land/std@0.206.0/fs/expand_glob.ts": "4f98c508fc9e40d6311d2f7fd88aaad05235cc506388c22dda315e095305811d", - "https://deno.land/std@0.206.0/fs/mod.ts": "bc3d0acd488cc7b42627044caf47d72019846d459279544e1934418955ba4898", - "https://deno.land/std@0.206.0/fs/move.ts": "b4f8f46730b40c32ea3c0bc8eb0fd0e8139249a698883c7b3756424cf19785c9", "https://deno.land/std@0.206.0/fs/walk.ts": "c1e6b43f72a46e89b630140308bd51a4795d416a416b4cfb7cd4bd1e25946723", "https://deno.land/std@0.206.0/path/_common/assert_path.ts": "061e4d093d4ba5aebceb2c4da3318bfe3289e868570e9d3a8e327d91c2958946", "https://deno.land/std@0.206.0/path/_common/basename.ts": "0d978ff818f339cd3b1d09dc914881f4d15617432ae519c1b8fdc09ff8d3789a", @@ -1374,7 +1554,6 @@ "https://deno.land/std@0.206.0/path/extname.ts": "2da4e2490f3b48b7121d19fb4c91681a5e11bd6bd99df4f6f47d7a71bb6ecdf2", "https://deno.land/std@0.206.0/path/format.ts": "3457530cc85d1b4bab175f9ae73998b34fd456c830d01883169af0681b8894fb", "https://deno.land/std@0.206.0/path/from_file_url.ts": "e7fa233ea1dff9641e8d566153a24d95010110185a6f418dd2e32320926043f8", - "https://deno.land/std@0.206.0/path/glob.ts": "b8333cbb4aaaeb54ca6d6c43e0b69fb13c9481c69ed7a3c64a3d0d9daf2af769", "https://deno.land/std@0.206.0/path/glob_to_regexp.ts": "74d7448c471e293d03f05ccb968df4365fed6aaa508506b6325a8efdc01d8271", "https://deno.land/std@0.206.0/path/is_absolute.ts": "67232b41b860571c5b7537f4954c88d86ae2ba45e883ee37d3dec27b74909d13", "https://deno.land/std@0.206.0/path/is_glob.ts": "567dce5c6656bdedfc6b3ee6c0833e1e4db2b8dff6e62148e94a917f289c06ad", @@ -1431,8 +1610,6 @@ "https://deno.land/std@0.206.0/path/windows/separator.ts": "ae21f27015f10510ed1ac4a0ba9c4c9c967cbdd9d9e776a3e4967553c397bd5d", "https://deno.land/std@0.206.0/path/windows/to_file_url.ts": "8e9ea9e1ff364aa06fa72999204229952d0a279dbb876b7b838b2b2fea55cce3", "https://deno.land/std@0.206.0/path/windows/to_namespaced_path.ts": "e0f4d4a5e77f28a5708c1a33ff24360f35637ba6d8f103d19661255ef7bfd50d", - "https://deno.land/std@0.206.0/yaml/_dumper/dumper.ts": "717403d0e700de783f2ef5c906b3d7245383e1509fc050e7ff5d4a53a03dbf40", - "https://deno.land/std@0.206.0/yaml/_dumper/dumper_state.ts": "f0d0673ceea288334061ca34b63954c2bb5feb5bf6de5e4cfe9a942cdf6e5efe", "https://deno.land/std@0.206.0/yaml/_error.ts": "b59e2c76ce5a47b1b9fa0ff9f96c1dd92ea1e1b17ce4347ece5944a95c3c1a84", "https://deno.land/std@0.206.0/yaml/_loader/loader.ts": "63ec7f0a265dbbabc54b25a4beefff7650e205160a2d75c7d8f8363b5f84851a", "https://deno.land/std@0.206.0/yaml/_loader/loader_state.ts": "0841870b467169269d7c2dfa75cd288c319bc06f65edd9e42c29e5fced91c7a4", @@ -1456,7 +1633,6 @@ "https://deno.land/std@0.206.0/yaml/_type/timestamp.ts": "706ea80a76a73e48efaeb400ace087da1f927647b53ad6f754f4e06d51af087f", "https://deno.land/std@0.206.0/yaml/_type/undefined.ts": "94a316ca450597ccbc6750cbd79097ad0d5f3a019797eed3c841a040c29540ba", "https://deno.land/std@0.206.0/yaml/_utils.ts": "26b311f0d42a7ce025060bd6320a68b50e52fd24a839581eb31734cd48e20393", - "https://deno.land/std@0.206.0/yaml/mod.ts": "28ecda6652f3e7a7735ee29c247bfbd32a2e2fc5724068e9fd173ec4e59f66f7", "https://deno.land/std@0.206.0/yaml/parse.ts": "1fbbda572bf3fff578b6482c0d8b85097a38de3176bf3ab2ca70c25fb0c960ef", "https://deno.land/std@0.206.0/yaml/schema.ts": "96908b78dc50c340074b93fc1598d5e7e2fe59103f89ff81e5a49b2dedf77a67", "https://deno.land/std@0.206.0/yaml/schema/core.ts": "fa406f18ceedc87a50e28bb90ec7a4c09eebb337f94ef17468349794fa828639", @@ -1465,8 +1641,12 @@ "https://deno.land/std@0.206.0/yaml/schema/failsafe.ts": "d219ab5febc43f770917d8ec37735a4b1ad671149846cbdcade767832b42b92b", "https://deno.land/std@0.206.0/yaml/schema/json.ts": "5f41dd7c2f1ad545ef6238633ce9ee3d444dfc5a18101e1768bd5504bf90e5e5", "https://deno.land/std@0.206.0/yaml/schema/mod.ts": "4472e827bab5025e92bc2eb2eeefa70ecbefc64b2799b765c69af84822efef32", - "https://deno.land/std@0.206.0/yaml/stringify.ts": "fffc09c65c68d3d63f8159e8cbaa3f489bc20a8e55b4fbb61a8c2e9f914d1d02", "https://deno.land/std@0.206.0/yaml/type.ts": "65553da3da3c029b6589c6e4903f0afbea6768be8fca61580711457151f2b30f", + "https://esm.sh/type-fest@4.8.1": "fabf6997a3adf11e45d11e3c4d58d0634ab98f9d72f3116f3694123818ccd457", + "https://esm.sh/v134/type-fest@4.8.1/denonext/source/simplify.d.js": "a3a0888441b04e1ab9ac5db803dc2bba5509a78f916ca78e583d26b47f429e5f", + "https://esm.sh/v134/type-fest@4.8.1/denonext/source/union-to-intersection.d.js": "4dda98575465ccb71439587d666e602980113bf8d01bb42067ca6ffeb4fae0e3", + "https://esm.sh/v134/type-fest@4.8.1/source/simplify.d": "75d5f739975152accd8282ecb89818cc4644e1ee2c73b13055de5e0ad6349f2e", + "https://esm.sh/v134/type-fest@4.8.1/source/union-to-intersection.d": "7be1a6951fbb06a27c1ad9820a5af2571c77adb65d8fb818ef7c7053e6ed14fa", "https://raw.githubusercontent.com/catppuccin/catppuccin/91d6b5433730103c504dcf43583b594e418ee7c1/resources/ports.schema.json": "f1bfc1f4c68af258cd2f1a254d70069b7d254ab0cfe298b9b52bcd78299d8e40" } } diff --git a/scripts/generate/labels.ts b/scripts/generate/labels.ts new file mode 100644 index 0000000000..e1541766da --- /dev/null +++ b/scripts/generate/labels.ts @@ -0,0 +1,50 @@ +import { join } from "std/path/mod.ts"; + +import { REPO_ROOT } from "@/deps.ts"; +import { updateFile } from "@/generate/utils.ts"; +import { UserStylesSchema } from "@/types/mod.d.ts"; + +export const syncIssueLabels = (userstyles: UserStylesSchema.Userstyles) => { + const ISSUE_PREFIX = "lbl:"; + + const issuesLabelerPath = join(REPO_ROOT, ".github/issue-labeler.yml"); + const issuesLabelerContent = Object.entries(userstyles) + .map(([key]) => `${key}: ["(${ISSUE_PREFIX + key})"]`) + .join("\n"); + updateFile(issuesLabelerPath, issuesLabelerContent); + + const userstyleIssuePath = join( + REPO_ROOT, + "scripts/generate/templates/userstyle-issue.yml", + ); + const userstyleIssueContent = Deno.readTextFileSync(userstyleIssuePath); + + const replacedUserstyleIssueContent = userstyleIssueContent.replace( + "$PORTS", + `${ + Object.entries(userstyles) + .map(([key]) => `'${ISSUE_PREFIX + key}'`) + .join(", ") + }`, + ); + Deno.writeTextFileSync( + join(REPO_ROOT, ".github/ISSUE_TEMPLATE/userstyle.yml"), + replacedUserstyleIssueContent, + ); + + const pullRequestLabelerPath = join(REPO_ROOT, ".github/pr-labeler.yml"); + const pullRequestLabelerContent = Object.entries(userstyles) + .map(([key]) => `${key}: styles/${key}/**/*`) + .join("\n"); + updateFile(pullRequestLabelerPath, pullRequestLabelerContent); + + const syncLabels = join(REPO_ROOT, ".github/labels.yml"); + const syncLabelsContent = Object.entries(userstyles) + .map( + ([key, style]) => + `- name: ${key} + description: ${style.name} + color: "#8aadf4"`, + ).join("\n"); + updateFile(syncLabels, syncLabelsContent); +}; diff --git a/scripts/generate/main.ts b/scripts/generate/main.ts index 202db93636..0633874ca1 100755 --- a/scripts/generate/main.ts +++ b/scripts/generate/main.ts @@ -1,177 +1,100 @@ #!/usr/bin/env -S deno run --allow-env --allow-read --allow-write --allow-net -import * as path from "std/path/mod.ts"; -import { parse as parseYaml } from "std/yaml/mod.ts"; -import Ajv from "ajv"; +import { join } from "std/path/mod.ts"; +import Handlebars from "handlebars"; import { portsSchema, REPO_ROOT, schema } from "@/deps.ts"; - -import { - ApplicationLink, - CurrentMaintainers, - FAQ, - Name, - PastMaintainers, - PortCategories, - Usage, - Userstyle, - Userstyles, -} from "@/types.d.ts"; - -const ROOT = new URL(".", import.meta.url).pathname; -const ISSUE_PREFIX = "lbl:"; +import { PortsSchema, UserStylesSchema } from "@/types/mod.d.ts"; +import { syncIssueLabels } from "./labels.ts"; +import { updateFile, updateReadme, validateYaml } from "./utils.ts"; +import { generateStyleReadmes } from "./readme-styles.ts"; type Metadata = { - userstyles: Userstyles; -}; - -type PortMetadata = { - categories: PortCategories; + userstyles: UserStylesSchema.Userstyles; }; +type PortMetadata = { categories: PortsSchema.Categories }; -type CollaboratorsData = { - collaborators: CurrentMaintainers | PastMaintainers | undefined; - heading: string; -}; - -export type MappedPort = Userstyle & { path: string }; - -const ajv = new (Ajv as unknown as (typeof Ajv)["default"])(); -const validate = ajv.compile(schema); -const validatePorts = ajv.compile(portsSchema); +export type MappedPort = UserStylesSchema.Userstyle & { path: string }; const userstylesYaml = Deno.readTextFileSync( - path.join(REPO_ROOT, "scripts/userstyles.yml"), + join(REPO_ROOT, "scripts/userstyles.yml"), ); -const userstylesData = parseYaml(userstylesYaml); -if (!validate(userstylesData)) { - console.log(validate.errors); - Deno.exit(1); -} - const portsYaml = await fetch( "https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.yml", -); -const portsData = parseYaml(await portsYaml.text()); -if (!validatePorts(portsData)) { - console.log(validate.errors); +).then((res) => res.text()); + +const [portsData, userstylesData] = await Promise.all([ + await validateYaml(portsYaml, portsSchema), + await validateYaml(userstylesYaml, schema), +]).catch((e) => { + console.error(e); + Deno.exit(1); +}); + +if (!userstylesData.userstyles) { + console.error("No userstyles found"); Deno.exit(1); } -const categorized = Object.entries(userstylesData.userstyles).reduce( - (acc, [slug, { category, ...port }]) => { +const categorized = Object.entries(userstylesData.userstyles) + .reduce((acc, [slug, { category, ...port }]) => { + // initialize category array if it doesn't exist acc[category] ??= []; + acc[category].push({ path: `styles/${slug}`, category, ...port }); - acc[category].sort((a, b) => { - const aName = typeof a.name === "string" ? a.name : a.name.join(", "); - const bName = typeof b.name === "string" ? b.name : b.name.join(", "); - return aName.localeCompare(bName); - }); + + // Sort by name, first array entry if necessary + acc[category].sort((a, b) => + [a.name].flat()[0].localeCompare([b.name].flat()[0]) + ); return acc; - }, - {} as Record, -); + }, {} as Record); const portListData = portsData.categories .filter((category) => categorized[category.key] !== undefined) .map((category) => { - return { - meta: category, - ports: categorized[category.key], - }; + return { meta: category, ports: categorized[category.key] }; }); -const portContent = portListData - .map( - (data) => - `
-${data.meta.emoji} ${data.meta.name} - -${ - data.ports - .map((port) => { - const name = Array.isArray(port.name) - ? port.name.join(", ") - : port.name; - return `- [${name}](${port.path})`; - }) - .join("\n") - } - -
`, - ) - .join("\n"); - -const updateReadme = ({ - readme, - section, - newContent, -}: { - readme: string; - section: string; - newContent: string; -}): string => { - const preamble = - ""; - const startMarker = ``; - const endMarker = ``; - const wrapped = `${startMarker}\n${preamble}\n${newContent}\n${endMarker}`; +const portContent = Handlebars.compile(`{{#each category}} +
+{{emoji}} {{name}} - if ( - !(readmeContent.includes(startMarker) && readmeContent.includes(endMarker)) - ) { - throw new Error("Markers not found in README.md"); - } - - const pre = readme.split(startMarker)[0]; - const end = readme.split(endMarker)[1]; - return pre + wrapped + end; -}; +{{#each ports}} +- [{{#each name}}{{ this }}{{#unless @last}}, {{/unless}}{{/each}}]({{ path }}) +{{/each}} -const updateFile = (filePath: string, fileContent: string, comment = true) => { - const preamble = comment - ? "# THIS FILE IS AUTOGENERATED. DO NOT EDIT IT BY HAND.\n" - : ""; - Deno.writeTextFileSync(filePath, preamble + fileContent); -}; - -const readmePath = path.join(REPO_ROOT, "README.md"); -let readmeContent = Deno.readTextFileSync(readmePath); -try { - readmeContent = updateReadme({ - readme: readmeContent, +
+{{/each}}`)({ + category: portListData.map(({ meta, ports }) => { + return { + emoji: meta.emoji, + name: meta.name, + ports: ports.map(({ name, path }) => { + return { + name: [name].flat(), + path, + }; + }), + }; + }), +}); + +const readmePath = join(REPO_ROOT, "README.md"); +await updateFile( + readmePath, + updateReadme({ + readme: Deno.readTextFileSync(readmePath), section: "userstyles", newContent: portContent, - }); - updateFile(readmePath, readmeContent, false); -} catch (e) { - console.log("Failed to update the README:", e); -} - -const pullRequestLabelerPath = path.join(REPO_ROOT, ".github/pr-labeler.yml"); -const pullRequestLabelerContent = Object.entries(userstylesData.userstyles) - .map(([key]) => `${key}: styles/${key}/**/*`) - .join("\n"); -updateFile(pullRequestLabelerPath, pullRequestLabelerContent); - -const syncLabels = path.join(REPO_ROOT, ".github/labels.yml"); -const syncLabelsContent = Object.entries(userstylesData.userstyles) - .map( - ([key, style]) => - `- name: ${key} - description: ${style.name} - color: "#8aadf4"`, - ) - .join("\n"); -updateFile(syncLabels, syncLabelsContent); + }), + false, +).catch((e) => console.error(e)); -const issuesLabelerPath = path.join(REPO_ROOT, ".github/issue-labeler.yml"); -const issuesLabelerContent = Object.entries(userstylesData.userstyles) - .map(([key]) => `${key}: ['(${ISSUE_PREFIX + key})']`) - .join("\n"); -updateFile(issuesLabelerPath, issuesLabelerContent); +syncIssueLabels(userstylesData.userstyles); +generateStyleReadmes(userstylesData.userstyles); -const ownersPath = path.join(REPO_ROOT, ".github/CODEOWNERS"); +const ownersPath = join(REPO_ROOT, ".github/CODEOWNERS"); const ownersContent = Object.entries(userstylesData.userstyles) .map(([key, style]) => { const currentMaintainers = style.readme["current-maintainers"] @@ -181,107 +104,3 @@ const ownersContent = Object.entries(userstylesData.userstyles) }) .join("\n"); updateFile(ownersPath, ownersContent); - -const userstyleIssuePath = path.join(ROOT, "templates/userstyle-issue.yml"); -const userstyleIssueContent = Deno.readTextFileSync(userstyleIssuePath); -const replacedUserstyleIssueContent = userstyleIssueContent.replace( - "$PORTS", - `${ - Object.entries(userstylesData.userstyles) - .map(([key]) => `'${ISSUE_PREFIX + key}'`) - .join(", ") - }`, -); -Deno.writeTextFileSync( - path.join(REPO_ROOT, ".github/ISSUE_TEMPLATE/userstyle.yml"), - replacedUserstyleIssueContent, -); - -const heading = (name: Name, link: ApplicationLink) => { - const nameArray = Array.isArray(name) ? name : [name]; - const linkArray = Array.isArray(link) ? link : [link]; - - if (nameArray.length !== linkArray.length) { - throw new Error( - 'The "name" and "app-link" arrays must have the same length', - ); - } - - return `Catppuccin for ${ - nameArray - .map((name, index) => `${name}`) - .join(", ") - }`; -}; - -const usageContent = (usage?: Usage) => { - return !usage ? "" : `## Usage \n${usage}`; -}; - -const faqContent = (faq?: FAQ) => { - if (!faq) { - return ""; - } - return `## 🙋 FAQ -${ - faq - .map(({ question, answer }) => `- Q: ${question} \n\tA: ${answer}`) - .join("\n") - }`; -}; - -const collaboratorsContent = (allCollaborators: CollaboratorsData[]) => { - return allCollaborators - .filter(({ collaborators }) => collaborators !== undefined) - .map(({ collaborators, heading }) => { - const collaboratorBody = collaborators - ?.map(({ name, url }) => `- [${name ?? url.split("/").pop()}](${url})`) - .join("\n"); - return `${heading}\n${collaboratorBody}`; - }) - .join("\n\n"); -}; - -const updateStylesReadmeContent = ( - readme: string, - key: string, - userstyle: Userstyle, -) => { - return readme - .replace("$TITLE", heading(userstyle.name, userstyle.readme["app-link"])) - .replaceAll("$LOWERCASE-PORT", key) - .replace("$USAGE", usageContent(userstyle.readme.usage)) - .replace("$FAQ", faqContent(userstyle.readme.faq)) - .replace( - "$COLLABORATORS", - collaboratorsContent([ - { - collaborators: userstyle.readme["current-maintainers"], - heading: "## 💝 Current Maintainer(s)", - }, - { - collaborators: userstyle.readme["past-maintainers"], - heading: "## 💖 Past Maintainer(s)", - }, - ]), - ); -}; - -const stylesReadmePath = path.join(ROOT, "templates/userstyle.md"); -const stylesReadmeContent = Deno.readTextFileSync(stylesReadmePath); -for (const [key, userstyle] of Object.entries(userstylesData.userstyles)) { - try { - console.log(`Generating README for ${key}`); - readmeContent = updateStylesReadmeContent( - stylesReadmeContent, - key, - userstyle, - ); - Deno.writeTextFileSync( - path.join(REPO_ROOT, "styles", key, "README.md"), - readmeContent, - ); - } catch (e) { - console.log(`Failed to update ${userstyle} README:`, e); - } -} diff --git a/scripts/generate/readme-styles.ts b/scripts/generate/readme-styles.ts new file mode 100644 index 0000000000..50ea7d88f8 --- /dev/null +++ b/scripts/generate/readme-styles.ts @@ -0,0 +1,64 @@ +import { UserStylesSchema } from "@/types/mod.d.ts"; +import { join } from "std/path/mod.ts"; +import { REPO_ROOT } from "@/deps.ts"; +import Handlebars from "handlebars"; + +const heading = ( + name: UserStylesSchema.Name, + link: UserStylesSchema.ApplicationLink, +) => { + const [nameArray, linkArray] = [[name].flat(), [link].flat()]; + + if (nameArray.length !== linkArray.length) { + throw new Error( + 'The "name" and "app-link" arrays must have the same length', + ); + } + + return nameArray.map((title, i) => { + return { title, url: linkArray[i] }; + }); +}; + +const extractName = ( + collaborators?: + | UserStylesSchema.CurrentMaintainers + | UserStylesSchema.PastMaintainers, +) => { + if (!collaborators) return; + return collaborators.map((c) => { + c.name ??= c.url.split("/").pop(); + return c; + }); +}; + +export const generateStyleReadmes = ( + userstyles: UserStylesSchema.Userstyles, +) => { + const stylesReadmePath = join( + REPO_ROOT, + "scripts/generate/templates/userstyle.md", + ); + const stylesReadmeContent = Deno.readTextFileSync(stylesReadmePath); + + Object.entries(userstyles).map(([slug, { name, readme }]) => { + // can't generate a readme if there's no readme + if (!readme) return; + + console.log(`Generating README for ${slug}`); + const readmeContent = Handlebars.compile(stylesReadmeContent)({ + heading: heading(name, readme["app-link"]), + slug, + usage: readme.usage, + faq: readme.faq, + collaborators: { + currentMaintainers: extractName(readme["current-maintainers"]), + pastMaintainers: extractName(readme["past-maintainers"]), + }, + }); + Deno.writeTextFile( + join(REPO_ROOT, "styles", slug.toString(), "README.md"), + readmeContent, + ).catch((e) => console.error(e)); + }); +}; diff --git a/scripts/generate/templates/userstyle-issue.yml b/scripts/generate/templates/userstyle-issue.yml index 68482e0461..ef00461bbb 100644 --- a/scripts/generate/templates/userstyle-issue.yml +++ b/scripts/generate/templates/userstyle-issue.yml @@ -14,7 +14,7 @@ body: label: What userstyles are you seeing the problem on? description: "Don't worry about the `lbl:` prefix, it allows issues to be automatically labeled!" multiple: true - options: [$PORTS] + options: ["replaceme"] validations: required: true - type: textarea @@ -38,4 +38,5 @@ body: - type: textarea attributes: label: Any additional comments? - description: Add any information that hasn't been covered in the previous sections! \ No newline at end of file + description: Add any information that hasn't been covered in the previous sections! +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-forms.json diff --git a/scripts/generate/templates/userstyle.md b/scripts/generate/templates/userstyle.md index dfe5f242cc..808d07166f 100644 --- a/scripts/generate/templates/userstyle.md +++ b/scripts/generate/templates/userstyle.md @@ -4,13 +4,13 @@

Logo
- $TITLE + Catppuccin for {{#each heading}}{{ this.title }}{{#unless @last}}, {{/unless}}{{/each}}

- - + +

@@ -36,11 +36,30 @@ -$USAGE +{{#if usage}} +## Usage +{{{ usage }}} +{{/if}} -$FAQ +{{#if faq}} +## 🙋 FAQ +{{#each faq}} +- Q: {{{ question }}}\ + A: {{{ answer }}} +{{/each}} +{{/if}} -$COLLABORATORS +## 💝 Current Maintainer(s) +{{#each collaborators.currentMaintainers}} +- [{{name}}]({{url}}) +{{/each}} + +{{#if collaborators.pastMaintainers}} +## 💝 Past Maintainer(s) +{{#each collaborators.pastMaintainers}} +- [{{name}}]({{url}}) +{{/each}} +{{/if}}   diff --git a/scripts/generate/utils.ts b/scripts/generate/utils.ts new file mode 100644 index 0000000000..6555e13f20 --- /dev/null +++ b/scripts/generate/utils.ts @@ -0,0 +1,59 @@ +import Ajv, { Schema } from "ajv"; +import { parse } from "std/yaml/parse.ts"; + +export const updateFile = ( + filePath: string, + fileContent: string, + comment = true, +) => { + const preamble = comment + ? "# THIS FILE IS AUTOGENERATED. DO NOT EDIT IT BY HAND.\n" + : ""; + return Deno.writeTextFile(filePath, preamble + fileContent); +}; + +export const updateReadme = ({ + readme, + section, + newContent, +}: { + readme: string; + section: string; + newContent: string; +}): string => { + const preamble = + ""; + const startMarker = ``; + const endMarker = ``; + const wrapped = `${startMarker}\n${preamble}\n${newContent}\n${endMarker}`; + + if ( + !(readme.includes(startMarker) && readme.includes(endMarker)) + ) { + throw new Error("Markers not found in README.md"); + } + + const pre = readme.split(startMarker)[0]; + const end = readme.split(endMarker)[1]; + return pre + wrapped + end; +}; + +/** + * @param content A string of YAML content + * @param schema A JSON schema + * @returns A promise that resolves to the parsed YAML content, verified against the schema. Rejects if the content is invalid. + */ +export const validateYaml = ( + content: string, + schema: Schema, +): Promise => { + return new Promise((resolve, reject) => { + const ajv = new Ajv.default(); + const validate = ajv.compile(schema); + const data = parse(content); + + if (!validate(data)) return reject(validate.errors); + + return resolve(data); + }); +}; diff --git a/scripts/lint/file-checker.ts b/scripts/lint/file-checker.ts index c008662196..2af304bade 100644 --- a/scripts/lint/file-checker.ts +++ b/scripts/lint/file-checker.ts @@ -1,4 +1,4 @@ -import { exists } from "std/fs/mod.ts"; +import { exists } from "std/fs/exists.ts"; import { join, relative } from "std/path/mod.ts"; import core from "@actions/core"; diff --git a/scripts/lint/main.ts b/scripts/lint/main.ts index 7b6deb8706..fbc9f21862 100755 --- a/scripts/lint/main.ts +++ b/scripts/lint/main.ts @@ -1,6 +1,6 @@ #!/usr/bin/env -S deno run -A -import { walk } from "std/fs/mod.ts"; +import { walk } from "std/fs/walk.ts"; import { parse as parseFlags } from "std/flags/mod.ts"; import { basename, dirname, join, relative } from "std/path/mod.ts"; diff --git a/scripts/lint/metadata.ts b/scripts/lint/metadata.ts index 95c547e695..5054c2e192 100644 --- a/scripts/lint/metadata.ts +++ b/scripts/lint/metadata.ts @@ -1,9 +1,9 @@ -// @deno-types="../usercss-meta.d.ts"; +// @deno-types="@/types/usercss-meta.d.ts"; import usercssMeta from "usercss-meta"; import { log } from "./logger.ts"; import * as color from "std/fmt/colors.ts"; import { sprintf } from "std/fmt/printf.ts"; -import type { WalkEntry } from "std/fs/mod.ts"; +import type { WalkEntry } from "std/fs/walk.ts"; import { relative } from "std/path/mod.ts"; import { REPO_ROOT } from "@/deps.ts"; diff --git a/scripts/lint/stylelint.ts b/scripts/lint/stylelint.ts index 552f71d46f..77bb0cceb9 100644 --- a/scripts/lint/stylelint.ts +++ b/scripts/lint/stylelint.ts @@ -1,4 +1,4 @@ -import { deepMerge } from "std/collections/mod.ts"; +import { deepMerge } from "std/collections/deep_merge.ts"; import * as color from "std/fmt/colors.ts"; import stylelint from "npm:stylelint"; diff --git a/scripts/sync-maintainers/main.ts b/scripts/sync-maintainers/main.ts index 9eec4d8d6c..b31fe5266f 100755 --- a/scripts/sync-maintainers/main.ts +++ b/scripts/sync-maintainers/main.ts @@ -2,18 +2,18 @@ import * as assert from "std/assert/mod.ts"; import * as path from "std/path/mod.ts"; -import { parse as parseYaml } from "std/yaml/mod.ts"; +import { parse as parseYaml } from "std/yaml/parse.ts"; import Ajv from "ajv"; import { Octokit } from "@octokit/rest"; import { REPO_ROOT, schema } from "@/deps.ts"; -import { Userstyle, UserstylesSchema } from "@/types.d.ts"; +import { UserStylesSchema } from "../types/mod.d.ts"; const octokit = new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") }); const team = { org: "catppuccin", team_slug: "userstyles-maintainers" }; const ajv = new Ajv.default(); -const validate = ajv.compile(schema); +const validate = ajv.compile(schema); const userstylesYaml = Deno.readTextFileSync( path.join(REPO_ROOT, "scripts/userstyles.yml"), @@ -30,7 +30,9 @@ if (userstylesData.userstyles === undefined) { // lowercase usernames of all the "current-maintainers" in the file const maintainers = [ ...new Set( - Object.values(userstylesData.userstyles).flatMap((style: Userstyle) => + Object.values(userstylesData.userstyles).flatMap(( + style: UserStylesSchema.Userstyle, + ) => style.readme["current-maintainers"].map((m) => { const username = m.url.split("github.com/")?.pop(); // check that they follow github.com/username pattern diff --git a/scripts/types.d.ts b/scripts/types.d.ts deleted file mode 100644 index 4554da8ee9..0000000000 --- a/scripts/types.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./types/userstyles.d.ts"; -export type { Categories as PortCategories } from "catppuccin-repo/resources/generate/types.d.ts"; diff --git a/scripts/types/github-issue-forms.d.ts b/scripts/types/github-issue-forms.d.ts new file mode 100644 index 0000000000..e925d4d246 --- /dev/null +++ b/scripts/types/github-issue-forms.d.ts @@ -0,0 +1,55 @@ +// deno-fmt-ignore-file + +/** + * A form item + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#about-githubs-form-schema + */ +export type FormItem = { + [k: string]: unknown; +} & { + [k: string]: unknown; +} & { + [k: string]: unknown; +} & { + [k: string]: unknown; +} & { + [k: string]: unknown; +}; +export type Assignee = string; + +export interface GitHubIssueFormsConfigFileSchema { + /** + * An issue template name + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + */ + name: string; + /** + * An issue template description + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + */ + description: string; + /** + * An issue template body + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + * + * @minItems 1 + */ + body: [FormItem, ...FormItem[]]; + /** + * An issue template assignees + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + */ + assignees?: Assignee | [Assignee, ...Assignee[]]; + /** + * An issue template labels + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + * + * @minItems 1 + */ + labels?: [string, ...string[]]; + /** + * An issue template title + * https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax + */ + title?: string; +} diff --git a/scripts/types/mod.d.ts b/scripts/types/mod.d.ts new file mode 100644 index 0000000000..9f5add9053 --- /dev/null +++ b/scripts/types/mod.d.ts @@ -0,0 +1,9 @@ +export * as UserStylesSchema from "./userstyles.d.ts"; +export * as PortsSchema from "catppuccin-repo/resources/generate/types.d.ts"; + +import { Entries } from "https://esm.sh/type-fest@4.8.1"; +declare global { + interface ObjectConstructor { + entries(o: T): Entries; + } +} diff --git a/scripts/usercss-meta.d.ts b/scripts/types/usercss-meta.d.ts similarity index 100% rename from scripts/usercss-meta.d.ts rename to scripts/types/usercss-meta.d.ts diff --git a/scripts/types/userstyles.d.ts b/scripts/types/userstyles.d.ts index 806e590cb6..677a9bf594 100644 --- a/scripts/types/userstyles.d.ts +++ b/scripts/types/userstyles.d.ts @@ -1,9 +1,4 @@ -/* eslint-disable */ -/** - * This file was automatically generated by json-schema-to-typescript. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run json-schema-to-typescript to regenerate this file. - */ +// deno-fmt-ignore-file /** * The name of the userstyle(s). @@ -74,7 +69,7 @@ export type FAQ = [ question: Question; answer: Answer; [k: string]: unknown; - }[], + }[] ]; /** * A question that a user may have about the userstyle. @@ -99,7 +94,7 @@ export type CurrentMaintainers = [ name?: DisplayName; url: GitHubProfile; [k: string]: unknown; - }[], + }[] ]; /** * The display name of the collaborator to show in the userstyle README. @@ -124,7 +119,7 @@ export type PastMaintainers = [ name?: DisplayName; url: GitHubProfile; [k: string]: unknown; - }[], + }[] ]; /** * Represents all maintainers and contributors to all userstyles. @@ -141,7 +136,7 @@ export type AllCollaborators = [ name?: DisplayName; url: GitHubProfile; [k: string]: unknown; - }[], + }[] ]; export interface UserstylesSchema { diff --git a/scripts/update-types.ts b/scripts/update-types.ts new file mode 100755 index 0000000000..7ef4cb5c80 --- /dev/null +++ b/scripts/update-types.ts @@ -0,0 +1,29 @@ +#!/usr/bin/env -S deno run -A + +import { join } from "std/path/mod.ts"; +import { compile, Options } from "npm:json-schema-to-typescript"; +import { REPO_ROOT } from "@/deps.ts"; + +const options = { + bannerComment: "// deno-fmt-ignore-file", +} satisfies Partial; + +const TYPES_ROOT = join(REPO_ROOT, "scripts/types"); + +import UserStylesSchemaJSON from "./userstyles.schema.json" assert { + type: "json", +}; + +compile( + // deno-lint-ignore no-explicit-any + UserStylesSchemaJSON as any, + "UserstylesSchema", + options, +).then((ts) => Deno.writeTextFileSync(join(TYPES_ROOT, "userstyles.d.ts"), ts)); + +fetch("https://json.schemastore.org/github-issue-forms.json") + .then((res) => res.json()) + .then((schema) => compile(schema, "github-issue-forms.json", options)) + .then((ts) => + Deno.writeTextFileSync(join(TYPES_ROOT, "github-issue-forms.d.ts"), ts) + ); diff --git a/scripts/userstyles.yml b/scripts/userstyles.yml index 0721660d62..a7347e8e16 100644 --- a/scripts/userstyles.yml +++ b/scripts/userstyles.yml @@ -109,7 +109,7 @@ userstyles: category: leisure color: blue readme: - app-link: ["https://anilist.co", "https://anichart.net"] + app-link: ["https://anilist.co", "https://anichart.net", ""] usage: |+ > [!NOTE] > This theme applies to [AniChart](https://anichart.net/) as well, which is an extension of AniList.