chore(docs): use regular script for changelog page gen
This commit is contained in:
@@ -9,7 +9,7 @@ import Components from 'unplugin-vue-components/vite'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import { useVueFlow } from '@vue-flow/core'
|
||||
import head from './head'
|
||||
import { copyChangelogPlugin, copyVueFlowPlugin, files } from './plugins'
|
||||
import { copyVueFlowPlugin, files } from './plugins'
|
||||
|
||||
const { vueFlowVersion } = useVueFlow()
|
||||
|
||||
@@ -72,7 +72,6 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
|
||||
},
|
||||
plugins: [
|
||||
copyVueFlowPlugin(),
|
||||
copyChangelogPlugin(),
|
||||
AutoImport({
|
||||
imports: ['vue', '@vueuse/core'],
|
||||
dts: resolve(__dirname, '../auto-imports.d.ts'),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { copyFile, readdirSync, statSync } from 'fs'
|
||||
import { copyFile, existsSync, mkdirSync, readdirSync, statSync } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
import type { Plugin } from 'vite'
|
||||
|
||||
interface ChangelogFile {
|
||||
path: string
|
||||
@@ -27,21 +26,18 @@ const getAllFiles = function (dirPath: string, needle?: string, arrayOfFiles: Ch
|
||||
|
||||
export const files = getAllFiles(resolve(__dirname, '../../../../packages'), 'CHANGELOG')
|
||||
|
||||
export function copyChangelogPlugin(): Plugin {
|
||||
return {
|
||||
name: 'copy-changelog-files',
|
||||
config() {
|
||||
files.forEach(({ path, pkgName }) => {
|
||||
const isCore = pkgName === 'core'
|
||||
const changelogDirPath = resolve(__dirname, `../../changelog/`)
|
||||
|
||||
const filePath = resolve(__dirname, `${path}`)
|
||||
|
||||
copyFile(filePath, resolve(__dirname, `../../changelog/${isCore ? 'index' : pkgName}.md`), () => {})
|
||||
|
||||
console.log(`Copied ${filePath} to ${resolve(__dirname, `../../changelog/${isCore ? 'index' : pkgName}.md`)}`)
|
||||
})
|
||||
|
||||
console.log('Copied changelog files')
|
||||
},
|
||||
}
|
||||
if (!existsSync(changelogDirPath)) {
|
||||
mkdirSync(changelogDirPath)
|
||||
}
|
||||
|
||||
files.forEach(({ path, pkgName }) => {
|
||||
const isCore = pkgName === 'core'
|
||||
|
||||
const filePath = resolve(__dirname, `${path}`)
|
||||
|
||||
copyFile(filePath, `${changelogDirPath}/${isCore ? 'index' : pkgName}.md`, () => {})
|
||||
|
||||
console.log(`Copied ${filePath} to ${changelogDirPath}/${isCore ? 'index' : pkgName}.md`)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user