Skip to content

Commit

Permalink
chore: and more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Nov 3, 2024
1 parent bd3c667 commit 11f6330
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
Binary file modified bun.lockb
Binary file not shown.
36 changes: 9 additions & 27 deletions website/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { build } from 'velite'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

/** @type {import('next').NextConfig} */
export default {
webpack: (config) => {
config.plugins.push(new VeliteWebpackPlugin())
return config
},
const nextConfig = {
experimental: {
outputFileTracingIncludes: {
'/*': ['../components/**/*', '../packages/panda/src/theme/recipes/**/*'],
Expand All @@ -19,19 +8,12 @@ export default {
transpilePackages: ['shiki'],
}

class VeliteWebpackPlugin {
static started = false
constructor(/** @type {import('velite').Options} */ options = {}) {
this.options = options
}
apply(/** @type {import('webpack').Compiler} */ compiler) {
compiler.hooks.beforeCompile.tapPromise('VeliteWebpackPlugin', async () => {
if (VeliteWebpackPlugin.started) return
VeliteWebpackPlugin.started = true
const dev = compiler.options.mode === 'development'
this.options.watch = this.options.watch ?? dev
this.options.clean = this.options.clean ?? !dev
await build(this.options)
})
}
const isDev = process.argv.indexOf('dev') !== -1
const isBuild = process.argv.indexOf('build') !== -1
if (!process.env.VELITE_STARTED && (isDev || isBuild)) {
process.env.VELITE_STARTED = '1'
const { build } = await import('velite')
await build({ watch: isDev, clean: !isDev })
}

export default nextConfig
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"shiki": "1.22.2",
"typescript": "5.6.3",
"usehooks-ts": "3.1.0",
"velite": "0.1.1",
"velite": "0.2.1",
"zustand": "5.0.1"
}
}
8 changes: 4 additions & 4 deletions website/velite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { defineCollection, defineConfig, s } from 'velite'

const pages = defineCollection({
name: 'Pages',
pattern: ['website/src/content/pages/**/*.mdx', 'packages/panda/CHANGELOG.md'],
pattern: ['pages/**/*.mdx', '../../../packages/panda/CHANGELOG.md'],
schema: s
.object({
id: s.string(),
Expand Down Expand Up @@ -41,7 +41,7 @@ const pages = defineCollection({

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

const blocks = defineCollection({
name: 'Blocks',
pattern: 'website/src/content/blocks.json',
pattern: 'blocks.json',
schema: s
.object({
id: s.string(),
Expand Down Expand Up @@ -97,7 +97,7 @@ const blocks = defineCollection({
})

export default defineConfig({
root: join(process.cwd(), '../'),
root: join(process.cwd(), './src/content'),
collections: { pages, controls, blocks },
mdx: {
rehypePlugins: [
Expand Down

0 comments on commit 11f6330

Please sign in to comment.