Skip to content

Commit 91fbf3d

Browse files
committed
chore: rename changeLog to changelog
1 parent 6743055 commit 91fbf3d

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

client/composables/changelog.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import type { MaybeRefOrGetter, Ref } from 'vue'
2-
import type { ChangeLog } from '../../types'
2+
import type { Changelog } from '../../types'
33
import { computedAsync } from '@vueuse/core'
44
import { computed } from 'vue'
55
import { useAddonGitLogConfig } from '../options'
66
import { useGitLog } from './gitlog'
77

8-
export function useChangeLog(_path?: MaybeRefOrGetter<string>): Ref<ChangeLog[]> {
8+
export function useChangelog(_path?: MaybeRefOrGetter<string>): Ref<Changelog[]> {
99
const gitLog = useGitLog()
1010
const gitLogOptions = useAddonGitLogConfig()
1111

1212
if (gitLogOptions.value.contributor?.mode !== 'api')
1313
return computed(() => gitLog.value.changeLog)
1414

15-
const contributors = computedAsync<ChangeLog[]>(
15+
const contributors = computedAsync<Changelog[]>(
1616
async () => {
1717
// TODO: Complete the API-based method
1818
return []

node/changeLog.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { ChangeLog } from '../types'
1+
import type { Changelog } from '../types'
22
import { uniq } from '@vueuse/metadata'
33
import { git } from '.'
44

5-
let cache: ChangeLog[] | undefined
5+
let cache: Changelog[] | undefined
66

7-
export async function getChangeLog(maxCount = 200, path?: string) {
7+
export async function getChangelog(maxCount = 200, path?: string) {
88
if (cache)
99
return cache
1010

@@ -13,7 +13,7 @@ export async function getChangeLog(maxCount = 200, path?: string) {
1313
|| i.message.includes('!')
1414
|| i.message.startsWith('feat')
1515
|| i.message.startsWith('fix')
16-
}) as ChangeLog[]
16+
}) as Changelog[]
1717

1818
for (const log of logs) {
1919
if (log.message.includes('chore: release')) {

node/contributor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function getContributors(filePath?: string, options?: GitLogOptions
2828
name: i[0],
2929
email: i[1],
3030
avatar: gravatar.url(i[1]),
31+
github: null,
3132
hash: md5(i[1]),
3233
}
3334
}

node/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import consola from 'consola'
44
import Git from 'simple-git'
55
import { defineValaxyAddon } from 'valaxy'
66
import pkg from '../package.json'
7-
import { getChangeLog } from './changeLog'
7+
import { getChangelog } from './changeLog'
88
import { getContributors } from './contributor'
99

1010
export const git = Git({
@@ -39,12 +39,12 @@ export const addonGitLog = defineValaxyAddon<GitLogOptions>(options => ({
3939
if (!filePath.startsWith(currentWorkingDirectory))
4040
return
4141

42-
if (options?.contributor?.mode === 'log') {
42+
if (options?.contributor?.mode === 'git') {
4343
try {
4444
const contributors = await getContributors(filePath, options)
4545
route.meta.frontmatter.git_log.contributors = contributors
4646

47-
const changeLog = await getChangeLog(process.env.CI ? 1000 : 100, filePath)
47+
const changeLog = await getChangelog(process.env.CI ? 1000 : 100, filePath)
4848
route.meta.frontmatter.git_log.changeLog = changeLog
4949
}
5050
catch (error) {

plugins/changelog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Plugin } from 'vite'
2-
import type { ChangeLog as ChangeLogType } from '../types'
2+
import type { Changelog as ChangelogType } from '../types'
33

44
const ID = 'virtual:git-log/changelog'
55

6-
export function ChangeLog(data: ChangeLogType[]): Plugin {
6+
export function Changelog(data: ChangelogType[]): Plugin {
77
return {
88
name: 'git-log-changelog',
99
resolveId(id) {

plugins/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { Plugin } from 'vite'
22
import process from 'node:process'
3-
import { getChangeLog } from '../node/changeLog'
3+
import { getChangelog } from '../node/changeLog'
44
import { getContributors } from '../node/contributor'
5-
import { ChangeLog } from './changelog'
5+
import { Changelog } from './changelog'
66
import { Contributors } from './contributors'
77

88
// eslint-disable-next-line antfu/no-top-level-await
99
const [changeLog, contributions] = await Promise.all([
10-
getChangeLog(process.env.CI ? 1000 : 100),
10+
getChangelog(process.env.CI ? 1000 : 100),
1111
getContributors(),
1212
])
1313

14-
export const GitLogVitePlugins: Plugin[] = [ChangeLog(changeLog), Contributors(contributions)]
14+
export const GitLogVitePlugins: Plugin[] = [Changelog(changeLog), Contributors(contributions)]

types/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { CommitInfo, ContributorInfo } from '@vueuse/metadata'
33
export interface GitLogOptions {
44
repositoryUrl?: string
55
contributor?: {
6-
mode?: 'log' | 'api'
6+
mode?: 'git' | 'api'
77
logArgs?: string
88
}
99
}
@@ -13,15 +13,15 @@ export interface Contributor extends ContributorInfo {
1313
email: string
1414
avatar: string
1515
count: number
16-
github?: string | null
16+
github: string | null
1717
}
1818

19-
export interface ChangeLog extends CommitInfo {
19+
export interface Changelog extends CommitInfo {
2020

2121
}
2222

2323
export interface GitLog {
2424
contributors: Contributor[]
25-
changeLog: ChangeLog[]
25+
changeLog: Changelog[]
2626
path: string
2727
}

utils/render.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function renderMarkdown(markdownText = '') {
1515
return htmlText.trim()
1616
}
1717

18-
export function renderCommitMessage(msg: string) {
18+
export function renderCommitMessage(msg: string, repo: string) {
1919
return renderMarkdown(msg)
20-
.replace(/#(\d+)/g, '<a href=\'https://github.com/vueuse/vueuse/issues/$1\'>#$1</a>')
20+
.replace(/#(\d+)/g, `<a href=\'${repo}/issues/$1\'>#$1</a>`)
2121
}

0 commit comments

Comments
 (0)