Skip to content

Commit 006de7d

Browse files
committed
chore: change contributor.source to contributor.strategy
1 parent b0b3f84 commit 006de7d

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

client/composables/changelog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { useGitLog } from './gitlog'
88
export function useChangelog(_path?: MaybeRefOrGetter<string>): Ref<Changelog[]> {
99
const gitLog = useGitLog()
1010
const gitLogOptions = useAddonGitLogConfig()
11-
const source = gitLogOptions.value.contributor?.source
11+
const strategy = gitLogOptions.value.contributor?.strategy
1212

13-
if (source === 'runtime') {
13+
if (strategy === 'runtime') {
1414
const contributors = computedAsync<Changelog[]>(
1515
async () => {
1616
// TODO: Complete the API-based method

client/composables/contributor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { useGitLog } from './gitlog'
1010
export function useContributor(path?: MaybeRefOrGetter<string>): Ref<Contributor[]> {
1111
const gitLog = useGitLog()
1212
const gitLogOptions = useAddonGitLogConfig()
13-
const source = gitLogOptions.value.contributor?.source
13+
const strategy = gitLogOptions.value.contributor?.strategy
1414

15-
if (source === 'runtime') {
15+
if (strategy === 'runtime') {
1616
const contributors = computedAsync<Contributor[]>(
1717
async () => {
1818
const { owner, repo } = parseGithubUrl(gitLogOptions.value.repositoryUrl!)

client/composables/gitlog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export function useGitLog(): Ref<GitLog> {
1919
const gitLogOptions = useAddonGitLogConfig()
2020
const gitLogData = ref<GitLog>(initGitLog)
2121

22-
const source = gitLogOptions.value.contributor?.source
23-
const isPrebuilt = source === 'prebuilt'
22+
const strategy = gitLogOptions.value.contributor?.strategy
23+
const isPrebuilt = strategy === 'prebuilt'
2424
const path = frontmatter.value.git_log?.path
2525

2626
if (isPrebuilt && path) {

node/gitLog.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ export function getBasePath() {
2121
}
2222

2323
export async function handleGitLogInfo(options: GitLogOptions, route: EditableTreeNode) {
24-
const source = options.contributor?.source
25-
const isPrebuilt = source === 'prebuilt'
26-
const isBuildTime = source === 'build-time'
27-
// const isRuntime = source === 'runtime'
24+
const strategy = options.contributor?.strategy
25+
const isPrebuilt = strategy === 'prebuilt'
26+
const isBuildTime = strategy === 'build-time'
27+
// const isRuntime = strategy === 'runtime'
2828

2929
const filePath = route.components.get('default')
3030
if (!filePath)

node/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const addonGitLog = defineValaxyAddon<GitLogOptions>(options => ({
1717
options,
1818
{
1919
contributor: {
20-
source: options?.contributor?.mode === 'api'
20+
strategy: options?.contributor?.mode === 'api'
2121
? 'runtime'
2222
: options?.contributor?.mode === 'git' ? 'build-time' : 'prebuilt',
2323
},
@@ -26,7 +26,7 @@ export const addonGitLog = defineValaxyAddon<GitLogOptions>(options => ({
2626

2727
setup(valaxy) {
2828
if (options?.contributor?.mode)
29-
consola.warn('valaxy-addon-git-log: contributor.mode is deprecated. Please use contributor.source instead.')
29+
consola.warn('valaxy-addon-git-log: contributor.mode is deprecated. Please use contributor.strategy instead.')
3030

3131
git.revparse(['--show-toplevel'])
3232
.then((result) => {

types/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface GitLogOptions {
44
repositoryUrl?: string
55
contributor?: {
66
/**
7-
* @deprecated Use `source` instead
7+
* @deprecated Use `strategy` instead
88
*/
99
mode?: 'git' | 'api'
1010
/**
@@ -15,9 +15,9 @@ export interface GitLogOptions {
1515
* - 'build-time': Fetch during build process (may fail on restricted CI environments)
1616
* - 'runtime': Fetch at runtime via API (subject to rate limits but always fresh)
1717
*/
18-
source?: 'prebuilt' | 'build-time' | 'runtime'
18+
strategy?: 'prebuilt' | 'build-time' | 'runtime'
1919
/**
20-
* Additional arguments for git log command when source is 'git-log'
20+
* Additional arguments for git log command when strategy is 'git-log'
2121
* @example '--no-merges'
2222
*/
2323
logArgs?: string

0 commit comments

Comments
 (0)