From 4181d56ca538f77ce992a507b0c9dd6ec0fbf7ce Mon Sep 17 00:00:00 2001 From: gene9831 Date: Sat, 9 May 2026 18:37:13 +0800 Subject: [PATCH 1/2] feat: add playground build script and update prebuild command --- .vitepress/theme/index.ts | 2 +- package.json | 4 +++- scripts/copy-playground.js | 39 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 scripts/copy-playground.js diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index a026131..da3e400 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -143,7 +143,7 @@ function listenCodePlaygroundEvent() { extraImports, }) if(route.path.includes('tiny-robot')){ - window.open(`https://playground.opentiny.design/tiny-robot.html` + store.serialize(), '_blank') + window.open(`${import.meta.env.BASE_URL}/tiny-robot/playground/`.replace(/(? ') + console.error('Example: node copy-playground.js packages/playground/dist docs/dist/playground') + process.exit(1) +} + +// Source and destination paths from arguments +// resolve() automatically handles both absolute and relative paths +const source = resolve(args[0]) +const dest = resolve(args[1]) + +try { + // Check if source exists + if (!existsSync(source)) { + console.error(`Error: Source directory not found: ${source}`) + process.exit(1) + } + + // Ensure parent directory exists + const destParent = dirname(dest) + if (!existsSync(destParent)) { + console.error(`Error: Destination parent directory not found: ${destParent}`) + process.exit(1) + } + + // Copy directory recursively + console.log('Copying playground dist to docs/dist/playground...') + cpSync(source, dest, { recursive: true, force: true }) + console.log('✓ Successfully copied playground to docs/dist/playground') +} catch (error) { + console.error('Error copying playground:', error.message) + process.exit(1) +} From 5a79aca29a3acfc89be95c806d7b9a9b86496669 Mon Sep 17 00:00:00 2001 From: gene9831 Date: Mon, 11 May 2026 16:52:35 +0800 Subject: [PATCH 2/2] fix: update tiny-robot submodule and improve playground URL handling --- .gitmodules | 1 - .vitepress/theme/index.ts | 6 ++++-- tiny-robot | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 45a0cce..4783dd9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,6 @@ [submodule "tiny-robot"] path = tiny-robot url = git@github.com:opentiny/tiny-robot.git - branch = release/v0.4.x [submodule "next-sdk"] path = next-sdk url = git@github.com:opentiny/next-sdk.git diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index da3e400..f2a7c0c 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -142,8 +142,10 @@ function listenCodePlaygroundEvent() { files, extraImports, }) - if(route.path.includes('tiny-robot')){ - window.open(`${import.meta.env.BASE_URL}/tiny-robot/playground/`.replace(/(?