mirror of https://github.com/YunYouJun/valaxy
feat: use default dirStyle flat & auto replace url ends with /
This commit is contained in:
parent
162d3031d2
commit
c542de120a
|
@ -1,6 +1,5 @@
|
|||
import { defineAppSetup } from 'valaxy'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export default defineAppSetup((_ctx) => {
|
||||
// router.isReady().then(async () => {
|
||||
// const { registerSW } = await import('virtual:pwa-register')
|
||||
|
|
|
@ -8,9 +8,9 @@ end: false
|
|||
|
||||
## 改变构建形式
|
||||
|
||||
为了 URL 兼容性,Valaxy 默认将 `xxx.md` 构建为 `/xxx/index.html`。
|
||||
Valaxy 默认将 `xxx.md` 构建为 `/xxx.html`。
|
||||
|
||||
如果您更希望默认构建为 `xxx.html` 的形式。
|
||||
如果您更希望默认构建为 `/xxx/index.html` 的形式。
|
||||
|
||||
可以修改 `vite-ssg` 的配置。
|
||||
|
||||
|
@ -22,7 +22,7 @@ import { defineConfig } from 'vite'
|
|||
export default defineConfig({
|
||||
// ...
|
||||
ssgOptions: {
|
||||
dirStyle: 'flat',
|
||||
dirStyle: 'nested',
|
||||
}
|
||||
})
|
||||
```
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"prepare": "husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.35.0",
|
||||
"@antfu/eslint-config": "^0.35.1",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/prompts": "^2.4.2",
|
||||
|
|
|
@ -24,7 +24,6 @@ export function useTags(options: {
|
|||
const primaryColor = new TinyColor(options.primary)
|
||||
|
||||
const getTagStyle = (count: number) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const counts = Array.from(tags.value).map(([_, value]) => value.count)
|
||||
const max = Math.max(...counts)
|
||||
const min = Math.min(...counts)
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { onBeforeMount } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
onBeforeMount(() => {
|
||||
// compatible for post url ends with slash
|
||||
if (route.path.endsWith('/'))
|
||||
router.replace(route.path.slice(0, -1))
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -6,7 +6,7 @@ import { install as installNprogress } from '../modules/nprogress'
|
|||
|
||||
export default function setupMain(ctx: ViteSSGContext) {
|
||||
// @ts-expect-error inject in runtime
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars
|
||||
const injection_arg = ctx
|
||||
|
||||
installValaxy(ctx)
|
||||
|
|
|
@ -43,7 +43,8 @@ export async function ssgBuild(
|
|||
},
|
||||
)
|
||||
},
|
||||
dirStyle: 'nested',
|
||||
// dirStyle default it flat
|
||||
// dirStyle: 'nested',
|
||||
}
|
||||
const inlineConfig: InlineConfig = mergeViteConfig(defaultConfig, viteConfig)
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ export async function resolveAddonConfig(addons: ValaxyAddonResolver[], options?
|
|||
let valaxyConfig: ValaxyNodeConfig = {} as ValaxyNodeConfig
|
||||
for (const addon of addons) {
|
||||
const { config, configFile } = await loadConfigFromFile<ValaxyNodeConfig>('index', {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
rewrite<F = ValaxyNodeConfig | ValaxyAddonFn>(obj: F, _filepath: string) {
|
||||
return (typeof obj === 'function' ? obj(addon, options!) : obj)
|
||||
},
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { spawn } from 'cross-spawn'
|
||||
|
||||
export function getGitTimestamp(file: string, type: 'created' | 'updated' = 'updated') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return new Promise<number>((resolve, _reject) => {
|
||||
const params = ['log']
|
||||
if (type === 'updated')
|
||||
|
|
|
@ -4,7 +4,7 @@ importers:
|
|||
|
||||
.:
|
||||
specifiers:
|
||||
'@antfu/eslint-config': ^0.35.0
|
||||
'@antfu/eslint-config': ^0.35.1
|
||||
'@types/debug': ^4.1.7
|
||||
'@types/node': ^18.11.18
|
||||
'@types/prompts': ^2.4.2
|
||||
|
@ -30,7 +30,7 @@ importers:
|
|||
vue-tsc: 1.0.24
|
||||
zx: ^7.1.1
|
||||
devDependencies:
|
||||
'@antfu/eslint-config': 0.35.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
'@antfu/eslint-config': 0.35.1_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
'@types/debug': 4.1.7
|
||||
'@types/node': 18.11.18
|
||||
'@types/prompts': 2.4.2
|
||||
|
@ -417,13 +417,13 @@ packages:
|
|||
'@jridgewell/trace-mapping': 0.3.17
|
||||
dev: false
|
||||
|
||||
/@antfu/eslint-config-basic/0.35.0_rgsbjvszw2fpvql2lkaldg7z6q:
|
||||
resolution: {integrity: sha512-X9Z3bc7KBzkTXhKVeA5a7IlwUkVoWQ3McrBC4OGnWih83fyi21RBsf7gIgKg80pt/bqFhMRlWvBwtx1jvsIkew==}
|
||||
/@antfu/eslint-config-basic/0.35.1_rgsbjvszw2fpvql2lkaldg7z6q:
|
||||
resolution: {integrity: sha512-2o35g3SFz9B/0TfXCuwcwK3+KVjDrVFsPtlOim/c+p8MNOCW/LwksEpDnNcDgfVfXdpEKGaqNKTCmL1aDbZP7w==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
dependencies:
|
||||
eslint: 8.33.0
|
||||
eslint-plugin-antfu: 0.35.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
eslint-plugin-antfu: 0.35.1_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
eslint-plugin-eslint-comments: 3.2.0_eslint@8.33.0
|
||||
eslint-plugin-html: 7.1.0
|
||||
eslint-plugin-import: 2.27.5_kf2q37rsxgsj6p2nz45hjttose
|
||||
|
@ -446,13 +446,13 @@ packages:
|
|||
- typescript
|
||||
dev: true
|
||||
|
||||
/@antfu/eslint-config-ts/0.35.0_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-f2l/8KoeYZpfFLIs7dn7hDnEWcu2awTMuU9FWvNZZhrh+p4+K01n8vhwT2cMiEC6GsktQG6acWzUGH1otorNwg==}
|
||||
/@antfu/eslint-config-ts/0.35.1_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-/0dW/88RDUc3BiT+tDOXhFDsSTKcInwSFbX2o6x1qaXoBukURyGejXhkmB39TQvr/voG21q6dZwnvNo+3Tw1Ig==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
typescript: '>=3.9'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-basic': 0.35.0_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@antfu/eslint-config-basic': 0.35.1_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@typescript-eslint/eslint-plugin': 5.49.0_rsaczafy73x3xqauzesvzbsgzy
|
||||
'@typescript-eslint/parser': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
eslint: 8.33.0
|
||||
|
@ -465,13 +465,13 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@antfu/eslint-config-vue/0.35.0_rgsbjvszw2fpvql2lkaldg7z6q:
|
||||
resolution: {integrity: sha512-yfaJWFrEvva67JLguk47z6B7058M+OmUAfY4471IOXR4uYFDt3hS8PfuqmlqeMe/CSlFQOGS5qvIkw0uN2ScYw==}
|
||||
/@antfu/eslint-config-vue/0.35.1_rgsbjvszw2fpvql2lkaldg7z6q:
|
||||
resolution: {integrity: sha512-4wz92tHFG1RhAX6eS1d9or1socS34g4V2eXNxunHrHihyXoFOC1w0i0hznfLREGt0wqzZ+cxblD86n1c/fFHoA==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-basic': 0.35.0_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@antfu/eslint-config-ts': 0.35.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
'@antfu/eslint-config-basic': 0.35.1_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@antfu/eslint-config-ts': 0.35.1_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
eslint: 8.33.0
|
||||
eslint-plugin-vue: 9.9.0_eslint@8.33.0
|
||||
local-pkg: 0.4.3
|
||||
|
@ -485,12 +485,12 @@ packages:
|
|||
- typescript
|
||||
dev: true
|
||||
|
||||
/@antfu/eslint-config/0.35.0_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-EoZThXjM6pqvAUr+cJ5Qc2w0HRQu26+NbmwMQyOm050RajsKVyWwsRvUbXJOHb0UPWFDMe3K7V9xWdZDZ0K/Ug==}
|
||||
/@antfu/eslint-config/0.35.1_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-9GHMyp4eofxHg6YqX0pYmHdV1QGFk479FyCi0utr4paETvZpQ+VYoz7oL1Kh0zb6coBfIZ0nFiwgyiQML/kSsw==}
|
||||
peerDependencies:
|
||||
eslint: '>=7.4.0'
|
||||
dependencies:
|
||||
'@antfu/eslint-config-vue': 0.35.0_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@antfu/eslint-config-vue': 0.35.1_rgsbjvszw2fpvql2lkaldg7z6q
|
||||
'@typescript-eslint/eslint-plugin': 5.49.0_rsaczafy73x3xqauzesvzbsgzy
|
||||
'@typescript-eslint/parser': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
eslint: 8.33.0
|
||||
|
@ -2572,7 +2572,7 @@ packages:
|
|||
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
|
||||
dependencies:
|
||||
function-bind: 1.1.1
|
||||
get-intrinsic: 1.1.3
|
||||
get-intrinsic: 1.2.0
|
||||
|
||||
/callsites/3.1.0:
|
||||
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
||||
|
@ -3598,8 +3598,8 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-antfu/0.35.0_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-C0wN0x8s/DRnrGsKDa6s23m69Trtm81rlqDmx9HFr5xo/GXs9Y+31Ksexf79/3XWG42valrhGoEDUozPRnv4Qw==}
|
||||
/eslint-plugin-antfu/0.35.1_zkdaqh7it7uc4cvz2haft7rc6u:
|
||||
resolution: {integrity: sha512-D3DQmxS3k2LATNu/JhdB0TTrfd4RojpSh3uCyWTsvvVskoBIMiyluoE4J+/ZZqxEVijIoQBPVDl/KpEpmlsAuQ==}
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
|
||||
transitivePeerDependencies:
|
||||
|
@ -4305,19 +4305,13 @@ packages:
|
|||
resolution: {integrity: sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==}
|
||||
dev: true
|
||||
|
||||
/get-intrinsic/1.1.2:
|
||||
resolution: {integrity: sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==}
|
||||
dependencies:
|
||||
function-bind: 1.1.1
|
||||
has: 1.0.3
|
||||
has-symbols: 1.0.3
|
||||
|
||||
/get-intrinsic/1.1.3:
|
||||
resolution: {integrity: sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==}
|
||||
dependencies:
|
||||
function-bind: 1.1.1
|
||||
has: 1.0.3
|
||||
has-symbols: 1.0.3
|
||||
dev: false
|
||||
|
||||
/get-intrinsic/1.2.0:
|
||||
resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==}
|
||||
|
@ -4325,7 +4319,6 @@ packages:
|
|||
function-bind: 1.1.1
|
||||
has: 1.0.3
|
||||
has-symbols: 1.0.3
|
||||
dev: true
|
||||
|
||||
/get-stream/6.0.1:
|
||||
resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
|
||||
|
@ -4456,7 +4449,7 @@ packages:
|
|||
/gopd/1.0.1:
|
||||
resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
|
||||
dependencies:
|
||||
get-intrinsic: 1.1.3
|
||||
get-intrinsic: 1.2.0
|
||||
|
||||
/graceful-fs/4.2.10:
|
||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||
|
@ -4499,7 +4492,7 @@ packages:
|
|||
/has-property-descriptors/1.0.0:
|
||||
resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==}
|
||||
dependencies:
|
||||
get-intrinsic: 1.1.3
|
||||
get-intrinsic: 1.2.0
|
||||
|
||||
/has-proto/1.0.1:
|
||||
resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==}
|
||||
|
@ -5723,10 +5716,10 @@ packages:
|
|||
|
||||
/object-inspect/1.12.2:
|
||||
resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==}
|
||||
dev: true
|
||||
|
||||
/object-inspect/1.12.3:
|
||||
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
|
||||
dev: true
|
||||
|
||||
/object-is/1.1.5:
|
||||
resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==}
|
||||
|
@ -6534,8 +6527,8 @@ packages:
|
|||
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
|
||||
dependencies:
|
||||
call-bind: 1.0.2
|
||||
get-intrinsic: 1.1.2
|
||||
object-inspect: 1.12.2
|
||||
get-intrinsic: 1.2.0
|
||||
object-inspect: 1.12.3
|
||||
|
||||
/siginfo/2.0.0:
|
||||
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
|
||||
|
|
Loading…
Reference in New Issue