Skip to content

Commit 11f6330

Browse files
committed
chore: and more updates
1 parent bd3c667 commit 11f6330

File tree

4 files changed

+14
-32
lines changed

4 files changed

+14
-32
lines changed

bun.lockb

2.55 KB
Binary file not shown.

website/next.config.mjs

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
import path from 'node:path'
2-
import { fileURLToPath } from 'node:url'
3-
import { build } from 'velite'
4-
5-
const __filename = fileURLToPath(import.meta.url)
6-
const __dirname = path.dirname(__filename)
7-
81
/** @type {import('next').NextConfig} */
9-
export default {
10-
webpack: (config) => {
11-
config.plugins.push(new VeliteWebpackPlugin())
12-
return config
13-
},
2+
const nextConfig = {
143
experimental: {
154
outputFileTracingIncludes: {
165
'/*': ['../components/**/*', '../packages/panda/src/theme/recipes/**/*'],
@@ -19,19 +8,12 @@ export default {
198
transpilePackages: ['shiki'],
209
}
2110

22-
class VeliteWebpackPlugin {
23-
static started = false
24-
constructor(/** @type {import('velite').Options} */ options = {}) {
25-
this.options = options
26-
}
27-
apply(/** @type {import('webpack').Compiler} */ compiler) {
28-
compiler.hooks.beforeCompile.tapPromise('VeliteWebpackPlugin', async () => {
29-
if (VeliteWebpackPlugin.started) return
30-
VeliteWebpackPlugin.started = true
31-
const dev = compiler.options.mode === 'development'
32-
this.options.watch = this.options.watch ?? dev
33-
this.options.clean = this.options.clean ?? !dev
34-
await build(this.options)
35-
})
36-
}
11+
const isDev = process.argv.indexOf('dev') !== -1
12+
const isBuild = process.argv.indexOf('build') !== -1
13+
if (!process.env.VELITE_STARTED && (isDev || isBuild)) {
14+
process.env.VELITE_STARTED = '1'
15+
const { build } = await import('velite')
16+
await build({ watch: isDev, clean: !isDev })
3717
}
18+
19+
export default nextConfig

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"shiki": "1.22.2",
5151
"typescript": "5.6.3",
5252
"usehooks-ts": "3.1.0",
53-
"velite": "0.1.1",
53+
"velite": "0.2.1",
5454
"zustand": "5.0.1"
5555
}
5656
}

website/velite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { defineCollection, defineConfig, s } from 'velite'
77

88
const pages = defineCollection({
99
name: 'Pages',
10-
pattern: ['website/src/content/pages/**/*.mdx', 'packages/panda/CHANGELOG.md'],
10+
pattern: ['pages/**/*.mdx', '../../../packages/panda/CHANGELOG.md'],
1111
schema: s
1212
.object({
1313
id: s.string(),
@@ -41,7 +41,7 @@ const pages = defineCollection({
4141

4242
const controls = defineCollection({
4343
name: 'Controls',
44-
pattern: ['website/src/content/controls/*.json'],
44+
pattern: ['controls/*.json'],
4545
schema: s
4646
.record(
4747
s.string(),
@@ -63,7 +63,7 @@ const freeBlocks = ['banner-for-cookies', 'card-authentification', 'footer-with-
6363

6464
const blocks = defineCollection({
6565
name: 'Blocks',
66-
pattern: 'website/src/content/blocks.json',
66+
pattern: 'blocks.json',
6767
schema: s
6868
.object({
6969
id: s.string(),
@@ -97,7 +97,7 @@ const blocks = defineCollection({
9797
})
9898

9999
export default defineConfig({
100-
root: join(process.cwd(), '../'),
100+
root: join(process.cwd(), './src/content'),
101101
collections: { pages, controls, blocks },
102102
mdx: {
103103
rehypePlugins: [

0 commit comments

Comments
 (0)