Skip to content

Commit

Permalink
chore(git-changelog): added types for virtual module
Browse files Browse the repository at this point in the history
Signed-off-by: Neko Ayaka <[email protected]>
  • Loading branch information
nekomeowww committed Dec 28, 2023
1 parent c45cae2 commit 01e5a3c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,22 @@ import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import 'dayjs/locale/zh-cn'
import { computed, ref } from 'vue'
// @ts-expect-error virtual
import ChangelogData from 'virtual:nolebase-git-changelog'
import { useData } from 'vitepress'
import Changelog from 'virtual:nolebase-git-changelog'
import { useRawPath } from '../composables/path'
import { useCommits } from '../composables/commits'
import { renderCommitMessage } from '../utils'
import type { Changelog } from '../../types'
import { useI18n } from '../composables/i18n'
import VerticalTransition from './VerticalTransition.vue'
const changelogData = ChangelogData as Changelog
dayjs.extend(relativeTime)
const toggleViewMore = ref(false)
const rawPath = useRawPath()
const commits = useCommits(changelogData.commits, rawPath)
const commits = useCommits(Changelog.commits, rawPath)
const { t } = useI18n()
const { lang } = useData()
Expand Down
24 changes: 24 additions & 0 deletions packages/vitepress-plugin-git-changelog/src/client/virtual.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
interface Commit {
path: string[][]
tag?: string
release_tag_url?: string
hash: string
hash_url?: string
date: string
message: string
refs?: string
body?: string
author_name: string
author_email: string
author_avatar: string
repo_url?: string
}

interface Changelog {
commits: Commit[]
}

declare module 'virtual:nolebase-git-changelog' {
const changelog: Changelog
export default changelog
}
3 changes: 3 additions & 0 deletions packages/vitepress-plugin-git-changelog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": false,
"types": [
"vite/client"
],
"noImplicitAny": false,
"declaration": false,
"noEmit": false,
Expand Down

0 comments on commit 01e5a3c

Please sign in to comment.