docs: show changelogs on docs page

This commit is contained in:
braks
2022-10-25 19:12:16 +02:00
committed by Braks
parent 9089861ce7
commit 787fc225e9
5 changed files with 71 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
import { existsSync, readFileSync } from 'fs'
import { resolve } from 'path'
import type { Plugin } from 'vite'
export function copyVueFlowPlugin(): Plugin {
return {
name: 'copy-vue-flow',
generateBundle() {
;[
{ path: '../../node_modules/@vue-flow/core/dist/', pkgName: 'vue-flow-core.es.js' },
{
path: '../../node_modules/@vue-flow/additional-components/dist/',
pkgName: 'vue-flow-additional-components.es.js',
},
].forEach(({ path, pkgName }) => {
const filePath = resolve(__dirname, `${path}/${pkgName}`)
if (!existsSync(filePath)) {
throw new Error(`${pkgName} not built. ` + `Run "pnpm -w build" first.`)
}
;(this as any).emitFile({
type: 'asset',
fileName: pkgName,
source: readFileSync(filePath, 'utf-8'),
})
})
},
}
}