Skip to content

Commit

Permalink
docs: fix docs build (#1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
kermanx authored Jul 11, 2024
1 parent 2957624 commit 8e3bf21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
6 changes: 6 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ command = "pnpm run docs:build"

[build.environment]
NODE_VERSION = "20"
NODE_OPTIONS = "--max-old-space-size=8192"
PLAYWRIGHT_BROWSERS_PATH = "0"

[[redirects]]
Expand All @@ -22,6 +23,11 @@ from = "/demo/starter/*"
to = "/demo/starter/index.html"
status = 200

[[redirects]]
from = "/demo/vue-runner/*"
to = "/demo/vue-runner/index.html"
status = 200

[[redirects]]
from = "https://slidev.antfu.me/*"
to = "https://sli.dev/:splat"
Expand Down
18 changes: 10 additions & 8 deletions scripts/demo.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { fileURLToPath } from 'node:url'
import { $, cd, fs, path } from 'zx'
import { $, cd, path } from 'zx'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const demo = path.resolve(__dirname, '../docs/.vitepress/dist/demo')

await $`npm run build`

const starterMd = path.resolve(__dirname, '../demo/starter/slides.md')
if (!fs.existsSync(starterMd))
await fs.copyFile(path.resolve(__dirname, '../packages/create-app/template/slides.md'), starterMd)
const demos = [
'composable-vue',
'starter',
'vue-runner',
]

cd(path.resolve(__dirname, '../demo/composable-vue'))
await $`npx slidev build --base /demo/composable/ --out ${demo}/composable-vue`
cd(path.resolve(__dirname, '../demo/starter'))
await $`npx slidev build --base /demo/starter/ --out ${demo}/starter`
for (const name of demos) {
cd(path.resolve(__dirname, '../demo', name))
await $`npx slidev build --base /demo/${name}/ --out ${demo}/${name}`
}

0 comments on commit 8e3bf21

Please sign in to comment.