Skip to content

Commit 82afa25

Browse files
committed
fix: missing virtual modules due to missing valaxy-addon-git-log
1 parent 42601e9 commit 82afa25

File tree

6 files changed

+38
-6
lines changed

6 files changed

+38
-6
lines changed

docs/valaxy.config.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { ThemeConfig } from 'valaxy-theme-oceanus'
22
import { defineConfig } from 'valaxy'
3-
import { addonGitLog } from 'valaxy-addon-git-log'
43
import pkg from 'valaxy-theme-oceanus/package.json'
54

65
export default defineConfig<ThemeConfig>({
@@ -115,14 +114,12 @@ export default defineConfig<ThemeConfig>({
115114
powered: true,
116115
icp: '<a class="oceanus-text" href="https://icp.gov.moe/?keyword=20240132" target="_blank">萌ICP备20240132号</a>',
117116
},
118-
},
119117

120-
addons: [
121-
addonGitLog({
118+
gitLog: {
122119
contributor: {
123120
mode: 'git',
124121
},
125122
repositoryUrl: 'https://github.com/WRXinYue/valaxy-theme-oceanus.git',
126-
}),
127-
],
123+
},
124+
},
128125
})

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"release": "cd theme && git add -A && bumpp",
1414
"typecheck": "vue-tsc --noEmit --skipLibCheck"
1515
},
16+
"dependencies": {
17+
"@rollup/plugin-virtual": "^3.0.2"
18+
},
1619
"devDependencies": {
1720
"@antfu/eslint-config": "^3.12.1",
1821
"@unocss/eslint-plugin": "^0.65.3",

pnpm-lock.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

theme/node/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export const defaultThemeConfig: ThemeConfig = {
2525
hero: {},
2626

2727
sidebar: [],
28+
29+
gitLog: false,
2830
}
2931

3032
/**

theme/types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { DefaultTheme } from 'valaxy'
2+
import type { GitLogOptions } from 'valaxy-addon-git-log'
23

34
export namespace StarterTheme {
45
export type Config = ThemeConfig
@@ -31,6 +32,8 @@ export interface ThemeConfig extends DefaultTheme.Config {
3132
sidebar: SidebarMulti
3233

3334
footer: Partial<Footer>
35+
36+
gitLog: GitLogOptions | boolean
3437
}
3538

3639
export type NavTools = ('toggleLocale' | 'togglTheme' | 'search' | { icon: string, link?: string })[][]

theme/valaxy.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { ThemeConfig } from './types'
2+
import virtual from '@rollup/plugin-virtual'
23
import MarkdownItGitHubAlerts from 'markdown-it-github-alerts'
34
// @ts-expect-error missing types
45
import LinkAttributes from 'markdown-it-link-attributes'
56
import { defineTheme } from 'valaxy'
7+
import { addonGitLog } from 'valaxy-addon-git-log'
68
import { defaultThemeConfig, generateSafelist, themePlugin } from './node'
79

810
export default defineTheme<ThemeConfig>((options) => {
@@ -22,9 +24,17 @@ export default defineTheme<ThemeConfig>((options) => {
2224
title: theme.toUpperCase(),
2325
},
2426
},
27+
addons: [
28+
...(themeConfig.gitLog
29+
? [addonGitLog(themeConfig.gitLog === true ? {} : themeConfig.gitLog)]
30+
: []),
31+
],
2532
vite: {
2633
plugins: [
2734
themePlugin(config.themeConfig),
35+
...(!themeConfig.gitLog
36+
? [virtual({ 'virtual:git-log/contributors': 'export default [];' })]
37+
: []),
2838
],
2939
},
3040
unocss: {

0 commit comments

Comments
 (0)