diff --git a/packages/gitbook/package.json b/packages/gitbook/package.json index 99bf9e18b8..adf6933e14 100644 --- a/packages/gitbook/package.json +++ b/packages/gitbook/package.json @@ -117,7 +117,7 @@ "rss-parser": "^3.13.0" }, "scripts": { - "generate": "./scripts/generate.sh", + "generate": "bun ./scripts/generate.mjs", "clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static/icons && rm -rf ./public/~gitbook/static/math", "dev": "env-cmd --silent -f ../../.env.local next --webpack", "build": "next build --webpack", diff --git a/packages/gitbook/scripts/generate.mjs b/packages/gitbook/scripts/generate.mjs new file mode 100644 index 0000000000..c5bda8143d --- /dev/null +++ b/packages/gitbook/scripts/generate.mjs @@ -0,0 +1,19 @@ +import { execSync } from "child_process"; +import { cpSync } from "fs"; +import { platform } from "os"; + +const isWindows = platform() === "win32"; + +function run(cmd) { + return execSync(cmd, { shell: true }).toString(); +} + +if (isWindows) { + run(`powershell -Command "Copy-Item -Recurse -Force ..\\embed\\standalone\\ .\\public\\~gitbook\\static\\embed"`); +} else { + run("cp -r ../embed/standalone/ ./public/~gitbook/static/embed"); +} + +run("bunx gitbook-icons ./public/~gitbook/static/icons custom-icons"); +run("bunx gitbook-math ./public/~gitbook/static/math"); +run("bunx wrangler types"); diff --git a/packages/gitbook/scripts/generate.sh b/packages/gitbook/scripts/generate.sh deleted file mode 100755 index a1cfab43bd..0000000000 --- a/packages/gitbook/scripts/generate.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail - -# Copy the assets -gitbook-icons ./public/~gitbook/static/icons custom-icons -gitbook-math ./public/~gitbook/static/math -cp -r ../embed/standalone/ ./public/~gitbook/static/embed - -# Generate the types -wrangler types