fix(schema): support absolute/relative paths for assetsDir

This commit is contained in:
Daniel Roe 2024-07-21 21:16:15 +02:00
parent c0ec90da05
commit 8aefb554e0
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -1,7 +1,7 @@
import { existsSync } from 'node:fs' import { existsSync } from 'node:fs'
import { readdir } from 'node:fs/promises' import { readdir } from 'node:fs/promises'
import { defineUntypedSchema } from 'untyped' import { defineUntypedSchema } from 'untyped'
import { basename, join, relative, resolve } from 'pathe' import { basename, relative, resolve } from 'pathe'
import { isDebug, isDevelopment, isTest } from 'std-env' import { isDebug, isDevelopment, isTest } from 'std-env'
import { defu } from 'defu' import { defu } from 'defu'
import { findWorkspaceDir } from 'pkg-types' import { findWorkspaceDir } from 'pkg-types'
@ -422,7 +422,7 @@ export default defineUntypedSchema({
'@': srcDir, '@': srcDir,
'~~': rootDir, '~~': rootDir,
'@@': rootDir, '@@': rootDir,
[basename(assetsDir)]: join(srcDir, assetsDir), [basename(assetsDir)]: resolve(srcDir, assetsDir),
[basename(publicDir)]: resolve(srcDir, publicDir), [basename(publicDir)]: resolve(srcDir, publicDir),
...val, ...val,
} }