Upgrade to Vitepress 1.0.0-beta.7

Also uses their out-of-box `pageClass`.

Also removes our Sitemap in favor of theirs, although this was not working for me so it's commented out for now.

Also makes `npm run build` normal again, please use `npm run test` for full pre-PR testing.
This commit is contained in:
Soitora 2023-07-30 03:12:47 +02:00
parent a36bc7a047
commit d5285cc0a7
No known key found for this signature in database
GPG Key ID: A6D711EB4F2CCD97
7 changed files with 57 additions and 120 deletions

View File

@ -34,7 +34,7 @@ $ npm run build
$ npm run preview $ npm run preview
``` ```
**Please make sure to have `npm run build` pass successfully before submitting a PR.** Although the same tests will be run against your PR on the CI server, it is better to have it working locally. **Please make sure to have `npm run test` pass successfully before submitting a PR.** Although the same tests will be run against your PR on the CI server, it is better to have it working locally.
It is also recommended you lint your files before the PR. It is also recommended you lint your files before the PR.

View File

@ -22,9 +22,9 @@
"@mdit/plugin-tab": "^0.4.8", "@mdit/plugin-tab": "^0.4.8",
"@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0", "@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.45.0", "eslint": "^8.46.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
"eslint-plugin-vue": "^9.15.1", "eslint-plugin-vue": "^9.16.0",
"feed": "^4.2.2", "feed": "^4.2.2",
"lint-staged": "^13.2.3", "lint-staged": "^13.2.3",
"markdown-it-mdi": "^0.1.0", "markdown-it-mdi": "^0.1.0",
@ -32,12 +32,11 @@
"markdownlint-cli": "^0.35.0", "markdownlint-cli": "^0.35.0",
"prettier": "^3.0.0", "prettier": "^3.0.0",
"sentences-per-line": "^0.2.1", "sentences-per-line": "^0.2.1",
"sitemap": "^7.1.1",
"stylelint": "^15.10.2", "stylelint": "^15.10.2",
"stylelint-stylus": "^0.18.0", "stylelint-stylus": "^0.18.0",
"stylus": "^0.59.0", "stylus": "^0.59.0",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vitepress": "^1.0.0-beta.6", "vitepress": "^1.0.0-beta.7",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-eslint-parser": "^9.3.1" "vue-eslint-parser": "^9.3.1"
} }
@ -449,9 +448,9 @@
} }
}, },
"node_modules/@eslint/eslintrc": { "node_modules/@eslint/eslintrc": {
"version": "2.1.0", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz",
"integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"ajv": "^6.12.4", "ajv": "^6.12.4",
@ -516,9 +515,9 @@
} }
}, },
"node_modules/@eslint/js": { "node_modules/@eslint/js": {
"version": "8.44.0", "version": "8.46.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz",
"integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -812,7 +811,9 @@
"version": "17.0.45", "version": "17.0.45",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"dev": true "dev": true,
"optional": true,
"peer": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {
"version": "2.4.1", "version": "2.4.1",
@ -820,15 +821,6 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true "dev": true
}, },
"node_modules/@types/sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@types/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "7.5.0", "version": "7.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz",
@ -1480,12 +1472,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/arg": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
"dev": true
},
"node_modules/argparse": { "node_modules/argparse": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -2354,27 +2340,27 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "8.45.0", "version": "8.46.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz",
"integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0", "@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.0", "@eslint/eslintrc": "^2.1.1",
"@eslint/js": "8.44.0", "@eslint/js": "^8.46.0",
"@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/config-array": "^0.11.10",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8", "@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0", "ajv": "^6.12.4",
"chalk": "^4.0.0", "chalk": "^4.0.0",
"cross-spawn": "^7.0.2", "cross-spawn": "^7.0.2",
"debug": "^4.3.2", "debug": "^4.3.2",
"doctrine": "^3.0.0", "doctrine": "^3.0.0",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"eslint-scope": "^7.2.0", "eslint-scope": "^7.2.2",
"eslint-visitor-keys": "^3.4.1", "eslint-visitor-keys": "^3.4.2",
"espree": "^9.6.0", "espree": "^9.6.1",
"esquery": "^1.4.2", "esquery": "^1.4.2",
"esutils": "^2.0.2", "esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
@ -2657,17 +2643,17 @@
} }
}, },
"node_modules/eslint-plugin-vue": { "node_modules/eslint-plugin-vue": {
"version": "9.15.1", "version": "9.16.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.15.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-9.16.0.tgz",
"integrity": "sha512-CJE/oZOslvmAR9hf8SClTdQ9JLweghT6JCBQNrT2Iel1uVw0W0OLJxzvPd6CxmABKCvLrtyDnqGV37O7KQv6+A==", "integrity": "sha512-SonAuvQXFm9HBV9ww/YkYZVYPMR8ptxxuJwcKGnG9A65SyvNANP9MKlfnC49L6DIwt/YEQZwZWEMHOkL1d5s1A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.3.0", "@eslint-community/eslint-utils": "^4.4.0",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"nth-check": "^2.0.1", "nth-check": "^2.1.1",
"postcss-selector-parser": "^6.0.9", "postcss-selector-parser": "^6.0.13",
"semver": "^7.3.5", "semver": "^7.5.4",
"vue-eslint-parser": "^9.3.0", "vue-eslint-parser": "^9.3.1",
"xml-name-validator": "^4.0.0" "xml-name-validator": "^4.0.0"
}, },
"engines": { "engines": {
@ -2678,9 +2664,9 @@
} }
}, },
"node_modules/eslint-scope": { "node_modules/eslint-scope": {
"version": "7.2.1", "version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.1.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
"integrity": "sha512-CvefSOsDdaYYvxChovdrPo/ZGt8d5lrJWleAc1diXRKhHGiTYEI26cvo8Kle/wGnsizoCJjK73FMg1/IkIwiNA==", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esrecurse": "^4.3.0", "esrecurse": "^4.3.0",
@ -2694,9 +2680,9 @@
} }
}, },
"node_modules/eslint-visitor-keys": { "node_modules/eslint-visitor-keys": {
"version": "3.4.1", "version": "3.4.2",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz",
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -5769,25 +5755,6 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/sitemap": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/sitemap/-/sitemap-7.1.1.tgz",
"integrity": "sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==",
"dev": true,
"dependencies": {
"@types/node": "^17.0.5",
"@types/sax": "^1.2.1",
"arg": "^5.0.0",
"sax": "^1.2.4"
},
"bin": {
"sitemap": "dist/cli.js"
},
"engines": {
"node": ">=12.0.0",
"npm": ">=5.6.0"
}
},
"node_modules/slash": { "node_modules/slash": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@ -6682,9 +6649,9 @@
} }
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "4.4.6", "version": "4.4.7",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.6.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.7.tgz",
"integrity": "sha512-EY6Mm8vJ++S3D4tNAckaZfw3JwG3wa794Vt70M6cNJ6NxT87yhq7EC8Rcap3ahyHdo8AhCmV9PTk+vG1HiYn1A==", "integrity": "sha512-6pYf9QJ1mHylfVh39HpuSfMPojPSKVxZvnclX1K1FyZ1PXDOcLBibdq5t1qxJSnL63ca8Wf4zts6mD8u8oc9Fw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esbuild": "^0.18.10", "esbuild": "^0.18.10",
@ -6767,9 +6734,9 @@
} }
}, },
"node_modules/vitepress": { "node_modules/vitepress": {
"version": "1.0.0-beta.6", "version": "1.0.0-beta.7",
"resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-beta.6.tgz", "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.0.0-beta.7.tgz",
"integrity": "sha512-xK/ulKgQpKZVbvlL4+/vW49VG7ySi5nmSoKUNH1G4kM+Cj9JwYM+PDJO7jSJROv8zW99G0ise+maDYnaLlbGBQ==", "integrity": "sha512-P9Rw+FXatKIU4fVdtKxqwHl6fby8E/8zE3FIfep6meNgN4BxbWqoKJ6yfuuQQR9IrpQqwnyaBh4LSabyll6tWg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@docsearch/css": "^3.5.1", "@docsearch/css": "^3.5.1",
@ -6783,7 +6750,7 @@
"mark.js": "8.11.1", "mark.js": "8.11.1",
"minisearch": "^6.1.0", "minisearch": "^6.1.0",
"shiki": "^0.14.3", "shiki": "^0.14.3",
"vite": "^4.4.6", "vite": "^4.4.7",
"vue": "^3.3.4" "vue": "^3.3.4"
}, },
"bin": { "bin": {

View File

@ -12,8 +12,9 @@
"url": "https://github.com/tachiyomiorg/website/issues" "url": "https://github.com/tachiyomiorg/website/issues"
}, },
"scripts": { "scripts": {
"test": "npm run lint && npm run build && npm run preview",
"dev": "vitepress dev src", "dev": "vitepress dev src",
"build": "npm run lint && vitepress build src", "build": "vitepress build src",
"preview": "vitepress preview src", "preview": "vitepress preview src",
"lint": "npm run lint:es && npm run lint:prettier && npm run lint:mdl && npm run lint:style", "lint": "npm run lint:es && npm run lint:prettier && npm run lint:mdl && npm run lint:style",
"lint:fix": "npm run lint:es:fix && npm run lint:prettier:fix && npm run lint:style:fix", "lint:fix": "npm run lint:es:fix && npm run lint:prettier:fix && npm run lint:style:fix",
@ -35,9 +36,9 @@
"@mdit/plugin-tab": "^0.4.8", "@mdit/plugin-tab": "^0.4.8",
"@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0", "@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.45.0", "eslint": "^8.46.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
"eslint-plugin-vue": "^9.15.1", "eslint-plugin-vue": "^9.16.0",
"feed": "^4.2.2", "feed": "^4.2.2",
"lint-staged": "^13.2.3", "lint-staged": "^13.2.3",
"markdown-it-mdi": "^0.1.0", "markdown-it-mdi": "^0.1.0",
@ -45,12 +46,11 @@
"markdownlint-cli": "^0.35.0", "markdownlint-cli": "^0.35.0",
"prettier": "^3.0.0", "prettier": "^3.0.0",
"sentences-per-line": "^0.2.1", "sentences-per-line": "^0.2.1",
"sitemap": "^7.1.1",
"stylelint": "^15.10.2", "stylelint": "^15.10.2",
"stylelint-stylus": "^0.18.0", "stylelint-stylus": "^0.18.0",
"stylus": "^0.59.0", "stylus": "^0.59.0",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vitepress": "^1.0.0-beta.6", "vitepress": "^1.0.0-beta.7",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-eslint-parser": "^9.3.1" "vue-eslint-parser": "^9.3.1"
}, },

View File

@ -1,22 +0,0 @@
import { createContentLoader } from "vitepress";
import type { SiteConfig } from "vitepress";
import { createWriteStream } from "node:fs";
import { resolve } from "node:path";
import { SitemapStream } from "sitemap";
const generateSitemap = async (context: SiteConfig, hostname: string) => {
const { outDir } = context;
const sitemap = new SitemapStream({ hostname: hostname });
const pages = await createContentLoader("**/*.md").load();
const writeStream = createWriteStream(resolve(outDir, "sitemap.xml"));
sitemap.pipe(writeStream);
pages.forEach((page) => sitemap.write(page.url.replace(/index$/g, "").replace(/^\/src/, "")));
sitemap.end();
await new Promise((r) => writeStream.on("finish", r));
};
export default generateSitemap;

View File

@ -7,7 +7,6 @@ import head from "./head";
import "./icons"; import "./icons";
import generateMeta from "./hooks/generateMeta"; import generateMeta from "./hooks/generateMeta";
import generateSitemap from "./hooks/generateSitemap";
import generateFeed from "./hooks/generateFeed"; import generateFeed from "./hooks/generateFeed";
const hostname: string = "https://kodo.moe"; const hostname: string = "https://kodo.moe";
@ -23,12 +22,14 @@ export default ({ mode }) => {
lang: "en-US", lang: "en-US",
title: "Tachiyomi", title: "Tachiyomi",
description: "Read your favorite manga, webtoons, comics, and more easier than ever on your Android.", description: "Read your favorite manga, webtoons, comics, and more easier than ever on your Android.",
/*sitemap: {
hostname: "https://kodo.moe",
},*/
head, head,
markdown, markdown,
themeConfig: themeConfig, themeConfig: themeConfig,
transformHead: async (context) => generateMeta(context, hostname), transformHead: async (context) => generateMeta(context, hostname),
buildEnd: async (context) => { buildEnd: async (context) => {
generateSitemap(context, hostname);
generateFeed(context, hostname); generateFeed(context, hostname);
}, },
}); });

View File

@ -1,12 +1,15 @@
// https://vitepress.dev/guide/custom-theme // https://vitepress.dev/guide/custom-theme
import { h } from "vue"; import { h } from "vue";
import Theme from "vitepress/theme"; import Theme from "vitepress/theme";
import CustomLayout from "./layouts/CustomLayout.vue";
import "./styles/base.styl"; import "./styles/base.styl";
export default { export default {
extends: Theme, extends: Theme,
Layout: CustomLayout, Layout: () => {
return h(Theme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
});
},
enhanceApp({ app, router, siteData }) { enhanceApp({ app, router, siteData }) {
// ... // ...
}, },

View File

@ -1,12 +0,0 @@
<script setup lang="ts">
import DefaultTheme from 'vitepress/theme'
import { useData } from 'vitepress'
const { frontmatter } = useData()
</script>
<template>
<div :class="frontmatter.pageClass">
<DefaultTheme.Layout />
</div>
</template>