From 64a2091ddba4534a899ece1ac63071c45f74f6e5 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 29 Jan 2024 21:31:00 +0100 Subject: [PATCH] chore(docs): update head --- docs/src/.vitepress/head.ts | 4 ++-- docs/src/.vitepress/plugins/copy.ts | 21 ++++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/src/.vitepress/head.ts b/docs/src/.vitepress/head.ts index 12cb45d4..eee5b0c6 100644 --- a/docs/src/.vitepress/head.ts +++ b/docs/src/.vitepress/head.ts @@ -28,7 +28,7 @@ export default [ { hid: 'og:image', property: 'og:image', - content: `http://${meta.img}`, + content: meta.img, }, ], [ @@ -36,7 +36,7 @@ export default [ { hid: 'og:image:secure_url', property: 'og:image:secure_url', - content: `https://${meta.img}`, + content: meta.img, }, ], [ diff --git a/docs/src/.vitepress/plugins/copy.ts b/docs/src/.vitepress/plugins/copy.ts index e62eeb4f..b0f308ff 100644 --- a/docs/src/.vitepress/plugins/copy.ts +++ b/docs/src/.vitepress/plugins/copy.ts @@ -2,7 +2,9 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs' import { resolve } from 'node:path' import type { Plugin } from 'vite' -function getPkgPath(pkgName: string, fileName) { +type Emit = (file: { type: 'asset'; fileName: string; filePath: string; source: string }) => void + +function getPkgPath(pkgName: string, fileName: string) { return resolve(__dirname, `../../../node_modules/@vue-flow/${pkgName}/dist/${fileName}`) } @@ -10,7 +12,7 @@ function getPublicPath(fileName: string) { return resolve(__dirname, `../../public/${fileName}`) } -function copyFiles(emit: any) { +function copyFiles(emit: Emit) { ;['core', 'background', 'controls', 'minimap', 'node-resizer', 'node-toolbar'].forEach((name) => { const fileName = `vue-flow-${name}.mjs` @@ -35,18 +37,7 @@ export function copyVueFlowPlugin(): Plugin { name: 'copy-vue-flow', buildStart() { // use fs to copy files - copyFiles((file: any) => { - // remove existing files - if (existsSync(getPublicPath(file.fileName))) { - writeFileSync(getPublicPath(file.fileName), '') - } - - writeFileSync(getPublicPath(file.fileName), file.source) - }) - }, - watchChange() { - // use fs to copy files - copyFiles((file: any) => { + copyFiles((file) => { // remove existing files if (existsSync(getPublicPath(file.fileName))) { writeFileSync(getPublicPath(file.fileName), '') @@ -56,7 +47,7 @@ export function copyVueFlowPlugin(): Plugin { }) }, generateBundle() { - copyFiles((file: any) => this.emitFile(file)) + copyFiles((file) => this.emitFile(file)) }, } }