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 AutoImport from 'unplugin-auto-import/vite'
|
||||||
import { useVueFlow } from '@vue-flow/core'
|
import { useVueFlow } from '@vue-flow/core'
|
||||||
import head from './head'
|
import head from './head'
|
||||||
import { copyChangelogPlugin, copyVueFlowPlugin, files } from './plugins'
|
import { copyVueFlowPlugin, files } from './plugins'
|
||||||
|
|
||||||
const { vueFlowVersion } = useVueFlow()
|
const { vueFlowVersion } = useVueFlow()
|
||||||
|
|
||||||
@@ -72,7 +72,6 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
copyVueFlowPlugin(),
|
copyVueFlowPlugin(),
|
||||||
copyChangelogPlugin(),
|
|
||||||
AutoImport({
|
AutoImport({
|
||||||
imports: ['vue', '@vueuse/core'],
|
imports: ['vue', '@vueuse/core'],
|
||||||
dts: resolve(__dirname, '../auto-imports.d.ts'),
|
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 { resolve } from 'path'
|
||||||
import type { Plugin } from 'vite'
|
|
||||||
|
|
||||||
interface ChangelogFile {
|
interface ChangelogFile {
|
||||||
path: string
|
path: string
|
||||||
@@ -27,21 +26,18 @@ const getAllFiles = function (dirPath: string, needle?: string, arrayOfFiles: Ch
|
|||||||
|
|
||||||
export const files = getAllFiles(resolve(__dirname, '../../../../packages'), 'CHANGELOG')
|
export const files = getAllFiles(resolve(__dirname, '../../../../packages'), 'CHANGELOG')
|
||||||
|
|
||||||
export function copyChangelogPlugin(): Plugin {
|
const changelogDirPath = resolve(__dirname, `../../changelog/`)
|
||||||
return {
|
|
||||||
name: 'copy-changelog-files',
|
|
||||||
config() {
|
|
||||||
files.forEach(({ path, pkgName }) => {
|
|
||||||
const isCore = pkgName === 'core'
|
|
||||||
|
|
||||||
const filePath = resolve(__dirname, `${path}`)
|
if (!existsSync(changelogDirPath)) {
|
||||||
|
mkdirSync(changelogDirPath)
|
||||||
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')
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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