Skip to content

Commit ff02ebd

Browse files
authored
chore: update modules (#376)
1 parent ea12dc5 commit ff02ebd

File tree

83 files changed

+1970
-1724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1970
-1724
lines changed

.eslintrc.json

Lines changed: 0 additions & 166 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@ jobs:
711711
export DOCS_PACKAGE_VERSION="$(cat ./docsVersion.txt)"
712712
echo "Package version: $DOCS_PACKAGE_VERSION"
713713
714-
git apply --ignore-whitespace ./scripts/patches/vitepress+1.3.4.patch
715714
npm run docs:build
716715
- name: Upload docs to GitHub Pages
717716
uses: actions/upload-pages-artifact@v3
@@ -792,7 +791,6 @@ jobs:
792791
export DOCS_PACKAGE_VERSION="$(cat ./docsVersion.txt)"
793792
echo "Package version: $DOCS_PACKAGE_VERSION"
794793
795-
git apply --ignore-whitespace ./scripts/patches/vitepress+1.3.4.patch
796794
npm run docs:build
797795
- name: Upload docs to GitHub Pages
798796
uses: actions/upload-pages-artifact@v3

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install modules
2020
run: npm ci
2121
- name: ESLint
22-
run: npx eslint --ext .js --ext .ts .
22+
run: npx eslint
2323
- name: TypeScript validity
2424
run: npm run test:typescript
2525

@@ -44,6 +44,4 @@ jobs:
4444
CI: true
4545
run: node ./dist/cli/cli.js source download --release latest --skipBuild --noBundle --noUsageExample --updateBinariesReleaseMetadataAndSaveGitBundle
4646
- name: Compile docs
47-
run: |
48-
git apply --ignore-whitespace ./scripts/patches/vitepress+1.3.4.patch
49-
npm run docs:build
47+
run: npm run docs:build

.releaserc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ const homepageUrlWithoutTrailingSlash = homepageUrl.endsWith("/")
2626
? homepageUrl.slice(0, -1)
2727
: homepageUrl;
2828

29+
/* eslint-disable @stylistic/max-len */
2930
const newFooterTemplate = defaultFooterTemplate + "\n---\n\n" +
3031
`Shipped with \`llama.cpp\` release [\`${binariesSourceRelease.split("`").join("")}\`](https://github.com/${defaultLlamaCppGitHubRepo}/releases/tag/${encodeURIComponent(binariesSourceRelease)})\n\n` +
3132
`> To use the latest \`llama.cpp\` release available, run \`npx -n ${cliBinName} source download --release latest\`. ([learn more](${homepageUrlWithoutTrailingSlash}/guide/building-from-source#download-new-release))\n`;
33+
/* eslint-enable @stylistic/max-len */
3234

3335
const githubPluginConfig = {
3436
discussionCategoryName: "Releases" as string | boolean

.vitepress/components/HomePage/utils/getElectronExampleAppDownloadLink.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function getElectronExampleAppDownloadLink() {
3535

3636
const isMacOs = platformInfo?.platform != null
3737
? platformInfo.platform === "macOS"
38-
: (navigator.userAgent.includes("Mac OS X") || navigator.userAgent.includes("Macintosh"))
38+
: (navigator.userAgent.includes("Mac OS X") || navigator.userAgent.includes("Macintosh"));
3939
const isWindows = platformInfo?.platform != null
4040
? platformInfo.platform === "Windows"
4141
: navigator.userAgent.includes("Windows");
@@ -73,17 +73,17 @@ export async function getElectronExampleAppDownloadLink() {
7373
relevantAssets = assets
7474
.filter((asset) => asset.name.includes(".macOS."))
7575
.filter(filterByArchitecture)
76-
.filter((asset) => asset.name.endsWith(".dmg"))
76+
.filter((asset) => asset.name.endsWith(".dmg"));
7777
} else if (isWindows) {
7878
relevantAssets = assets
7979
.filter((asset) => asset.name.includes(".Windows."))
8080
.filter(filterByArchitecture)
81-
.filter((asset) => asset.name.endsWith(".exe"))
81+
.filter((asset) => asset.name.endsWith(".exe"));
8282
} else if (isLinux) {
8383
relevantAssets = assets
8484
.filter((asset) => asset.name.includes(".Linux."))
8585
.filter(filterByArchitecture)
86-
.filter((asset) => asset.name.endsWith(".AppImage"))
86+
.filter((asset) => asset.name.endsWith(".AppImage"));
8787
}
8888

8989
if (relevantAssets.length > 0 && relevantAssets[0]!.browser_download_url != null)

.vitepress/config.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import {createContentLoader, defineConfig, HeadConfig} from "vitepress";
21
import path from "path";
32
import {createRequire} from "node:module";
43
import process from "process";
5-
import fs from "fs-extra";
64
import {fileURLToPath} from "url";
5+
import fs from "fs-extra";
6+
import {createContentLoader, defineConfig, HeadConfig} from "vitepress";
77
import {transformerTwoslash} from "@shikijs/vitepress-twoslash";
88
import ts from "typescript";
99
import envVar from "env-var";
1010
import {Feed} from "feed";
1111
import {rehype} from "rehype";
12-
import {Element as HastElement, Parent} from "hast";
1312
import sharp from "sharp";
1413
import {GitChangelog, GitChangelogMarkdownSection} from "@nolebase/vitepress-plugin-git-changelog/vite";
1514
import {buildEndGenerateOpenGraphImages} from "@nolebase/vitepress-plugin-og-image/vitepress";
16-
import {Resvg, initWasm as initResvgWasm, ResvgRenderOptions} from "@resvg/resvg-wasm";
15+
import {Resvg, initWasm as initResvgWasm, type ResvgRenderOptions} from "@resvg/resvg-wasm";
1716
import {BlogPageInfoPlugin} from "./config/BlogPageInfoPlugin.js";
1817
import {getApiReferenceSidebar} from "./config/apiReferenceSidebar.js";
1918
import {ensureLocalImage} from "./utils/ensureLocalImage.js";
19+
import type {Element as HastElement, Parent} from "hast";
2020

2121
import type {Node as UnistNode} from "unist";
2222
import type {ShikiTransformer} from "shiki";
@@ -34,7 +34,7 @@ const packageVersion = env.get("DOCS_PACKAGE_VERSION")
3434
.default(packageJson.version)
3535
.asString();
3636

37-
const hostname = "https://node-llama-cpp.withcat.ai/"
37+
const hostname = "https://node-llama-cpp.withcat.ai/";
3838
const buildDate = new Date();
3939

4040
const socialPosterLink = hostname + "social.poster.jpg";
@@ -178,7 +178,7 @@ export default defineConfig({
178178
"window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());" +
179179
"gtag('config','G-Q2SWE5Z1ST');"
180180
],
181-
["style", {}],
181+
["style", {}]
182182
],
183183
async transformHead({pageData, head}) {
184184
if (pageData.filePath === "index.md") {
@@ -263,7 +263,7 @@ export default defineConfig({
263263
pageData.frontmatter.editLink = false;
264264
pageData.frontmatter.lastUpdated = false;
265265
pageData.frontmatter.aside = false;
266-
pageData.frontmatter.outline = false
266+
pageData.frontmatter.outline = false;
267267
pageData.frontmatter.nolebase = {
268268
gitChangelog: false
269269
};
@@ -507,7 +507,7 @@ export default defineConfig({
507507
"inter-latin-ext-400-normal.woff2",
508508
"inter-latin-ext-500-normal.woff2",
509509
"inter-latin-ext-600-normal.woff2",
510-
"inter-latin-ext-700-normal.woff2",
510+
"inter-latin-ext-700-normal.woff2"
511511
];
512512

513513
return await Promise.all(
@@ -532,7 +532,7 @@ export default defineConfig({
532532
const innerSvgImages = loadInnerSvgImages();
533533

534534
async function renderSvg(svgPath: string, destPngPath: string, options: ResvgRenderOptions) {
535-
console.info(`Rendering "${svgPath}" to "${destPngPath}"`)
535+
console.info(`Rendering "${svgPath}" to "${destPngPath}"`);
536536

537537
const svgContent = await fs.readFile(svgPath, "utf8");
538538
const svgImages = await innerSvgImages;
@@ -665,7 +665,7 @@ export default defineConfig({
665665
author: {
666666
name: typeof packageJson.author === "string"
667667
? packageJson.author
668-
: (packageJson.author as undefined | { name?: string })?.name
668+
: (packageJson.author as undefined | {name?: string})?.name
669669
},
670670
hub: "https://pubsubhubbub.appspot.com/"
671671
});

.vitepress/config/BlogPageInfoPlugin.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import {MarkdownEnv, Plugin} from "vitepress";
21
import path from "path";
3-
import {htmlEscape} from "../utils/htmlEscape.js";
2+
import {MarkdownEnv, Plugin} from "vitepress";
43
import {getMarkdownRenderer} from "../utils/getMarkdownRenderer.js";
54
import {renderHtmlTag} from "../utils/renderHtmlTag.js";
65
import {ensureLocalImage, resolveImageBuffers, relativeToAbsoluteImageUrls} from "../utils/ensureLocalImage.js";
76

87
export function BlogPageInfoPlugin({
98
include
109
}: {
11-
include(id: string): boolean,
10+
include(id: string): boolean
1211
}): Plugin {
1312
const refIdToUrlPath = new Map<string, string>();
1413
let root = "";
@@ -84,12 +83,13 @@ export function BlogPageInfoPlugin({
8483
const frontmatterCode = code.slice(0, frontmatterEndIndex);
8584
const markdownCode = code.slice(frontmatterEndIndex);
8685

86+
const frontmatterDate = new Date(frontmatter.date);
8787
let newCode = frontmatterCode + (
8888
"# " + frontmatter.title + "\n\n" +
8989
[
9090
"",
9191
'<script setup lang="ts">',
92-
`const articleDate = new Date(${JSON.stringify(new Date(frontmatter.date).toISOString())}).toLocaleDateString("en-US", {`,
92+
`const articleDate = new Date(${JSON.stringify(frontmatterDate.toISOString())}).toLocaleDateString("en-US", {`,
9393
' year: "numeric",',
9494
' month: "long",',
9595
' day: "numeric"',
@@ -118,10 +118,9 @@ export function BlogPageInfoPlugin({
118118
alt: frontmatter.title,
119119
width: width,
120120
height: height,
121-
style: 'background-image: url(' + JSON.stringify(previewUrlPath.absolute) + ');'
121+
style: "background-image: url(" + JSON.stringify(previewUrlPath.absolute) + ");"
122122
});
123-
}
124-
else if (typeof (frontmatter.image as any).url === "string") {
123+
} else if (typeof (frontmatter.image as any).url === "string") {
125124
const {
126125
urlPath, previewUrlPath, width, height
127126
} = await ensureLocalImage((frontmatter.image as any).url, "cover", {
@@ -133,7 +132,7 @@ export function BlogPageInfoPlugin({
133132
alt: (frontmatter.image as any).alt ?? frontmatter.title,
134133
width: width ?? (frontmatter.image as any).width,
135134
height: height ?? (frontmatter.image as any).height,
136-
style: 'background-image: url(' + JSON.stringify(previewUrlPath.absolute) + ');'
135+
style: "background-image: url(" + JSON.stringify(previewUrlPath.absolute) + ");"
137136
});
138137
}
139138
}
@@ -143,7 +142,7 @@ export function BlogPageInfoPlugin({
143142

144143
return newCode;
145144
}
146-
}
145+
};
147146
}
148147

149148
function findFrontmatterEndIndex(mdCode: string): number {

0 commit comments

Comments
 (0)