Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/ci-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ package:
- "editors/vscode/syntaxes/**"
- "xtask/**"
- "packages/vide-extension-shared/**"
- "playground/package.json"
- "playground/package-lock.json"
- "playground/scripts/build-vide-wasm.mjs"
- "playground/scripts/script-utils.mjs"
- "website/package.json"
- "website/playground/package.json"
- "website/package-lock.json"
- "website/playground/scripts/build-vide-wasm.mjs"
- "website/playground/scripts/script-utils.mjs"
- ".github/actions/setup-rust/**"
- ".github/actions/setup-sccache/**"
- ".github/actions/setup-emscripten/**"
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
permissions:
contents: read

env:
EMSDK_VERSION: 5.0.2

jobs:
native:
name: ${{ matrix.rust-target }}
Expand Down Expand Up @@ -187,8 +190,8 @@ jobs:
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Setup Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
Expand All @@ -204,7 +207,7 @@ jobs:
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: 5.0.2
version: ${{ env.EMSDK_VERSION }}

- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -218,17 +221,17 @@ jobs:

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
working-directory: website
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
npm --workspace playground run build:wasm

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}

- name: Set VSIX build metadata
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ jobs:
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
working-directory: .
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm
- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust
Expand All @@ -174,7 +174,7 @@ jobs:
continue-on-error: true
with:
shared-key: vscode-web-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true
- name: Install Emscripten SDK
Expand All @@ -197,16 +197,16 @@ jobs:
run: npm ci
- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
working-directory: website
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
npm --workspace playground run build:wasm
- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
- name: Web smoke test
run: npm run test:web
Expand All @@ -221,4 +221,3 @@ jobs:
build-kind: nightly
cargo-profile: debug
vsix-profile: debug

40 changes: 19 additions & 21 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ jobs:
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm

- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
Expand All @@ -358,7 +358,7 @@ jobs:
continue-on-error: true
with:
shared-key: docs-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true

Expand All @@ -373,36 +373,34 @@ jobs:
with:
node-version: 22
cache: npm
cache-dependency-path: |
docs/package-lock.json
playground/package-lock.json
cache-dependency-path: website/package-lock.json

- name: Install playground dependencies
run: npm ci
working-directory: playground
# TODO: Remove this `npm install` workaround once npm reliably restores platform optional
# dependencies from package-lock.json. see <https://github.com/npm/cli/issues/4828>.
- name: Install dependencies
run: |
npm ci
npm install --no-save @rolldown/binding-linux-x64-gnu@1.0.2
working-directory: website

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
working-directory: playground
npm --workspace playground run build:wasm
working-directory: website

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}

- name: Install dependencies
run: npm ci
working-directory: docs

- name: Build docs
run: npm run build
working-directory: docs
working-directory: website

- name: Setup ossutil
env:
Expand Down Expand Up @@ -444,4 +442,4 @@ jobs:
ossutil rm "oss://${OSS_BUCKET_NAME}/${key}" -rf || true
done

ossutil cp docs/dist "oss://${OSS_BUCKET_NAME}/" -rf --disable-dir-object
ossutil cp website/site/dist "oss://${OSS_BUCKET_NAME}/" -rf --disable-dir-object
48 changes: 22 additions & 26 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ on:
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
# Documentation pages and the browser playground shell.
- "docs/**"
- "playground/**"
# Website pages and the browser playground shell.
- "website/**"
# WASM playground server inputs. The WASM crate links the root server
# browser entry point, so request/IDE changes can affect PR previews.
- "src/**"
Expand Down Expand Up @@ -80,15 +79,15 @@ jobs:
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm

- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
Expand All @@ -106,7 +105,7 @@ jobs:
continue-on-error: true
with:
shared-key: docs-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true

Expand All @@ -121,36 +120,33 @@ jobs:
with:
node-version: 22
cache: npm
cache-dependency-path: |
docs/package-lock.json
playground/package-lock.json

- name: Install playground dependencies
run: npm ci
working-directory: playground
cache-dependency-path: website/package-lock.json
# TODO: Remove this `npm install` workaround once npm reliably restores platform optional
# dependencies from package-lock.json. see <https://github.com/npm/cli/issues/4828>.
- name: Install dependencies
run: |
npm ci
npm install --no-save @rolldown/binding-linux-x64-gnu@1.0.2
working-directory: website

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
working-directory: playground
npm --workspace playground run build:wasm
working-directory: website

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}

- name: Install dependencies
run: npm ci
working-directory: docs

- name: Build docs
run: npm run build
working-directory: docs
working-directory: website

- name: Add preview summary
if: github.event_name == 'pull_request'
Expand All @@ -163,7 +159,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: vide-docs-preview
path: docs/dist
path: website/site/dist
retention-days: 7

- name: Add master docs summary
Expand All @@ -177,5 +173,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: vide-docs-master
path: docs/dist
path: website/site/dist
retention-days: 7
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center">
<a href="https://vide.pascal-lab.net/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pascal-lab/vide/master/docs/src/assets/vide-logo-dark.png">
<img src="https://raw.githubusercontent.com/pascal-lab/vide/master/docs/src/assets/vide-logo-light.png" alt="Vide" width="520">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pascal-lab/vide/master/website/site/src/assets/vide-logo-dark.png">
<img src="https://raw.githubusercontent.com/pascal-lab/vide/master/website/site/src/assets/vide-logo-light.png" alt="Vide" width="520">
</picture>
</a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center">
<a href="https://vide.pascal-lab.net/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pascal-lab/vide/master/docs/src/assets/vide-logo-dark.png">
<img src="https://raw.githubusercontent.com/pascal-lab/vide/master/docs/src/assets/vide-logo-light.png" alt="Vide" width="520">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/pascal-lab/vide/master/website/site/src/assets/vide-logo-dark.png">
<img src="https://raw.githubusercontent.com/pascal-lab/vide/master/website/site/src/assets/vide-logo-light.png" alt="Vide" width="520">
</picture>
</a>
</p>
Expand Down
18 changes: 18 additions & 0 deletions docs/website.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Website Development
If you want to run the website locally, you can do so by following steps.
1. **Install emscripten**. If you have emscripten installed, you can skip this step.

The playground needs [emscripten](https://emscripten.org/index.html) to build the wasm module. You can follow the [official guide](https://emscripten.org/docs/getting_started/downloads.html) to install it.

> Don't forget to activate the emscripten environment by running `source /path/to/emsdk/emsdk_env.sh` in your terminal.

2. **Setup dependencies**.
This will automatically install all the npm dependencies and build the vide wasm lsp.
```bash
npm run setup
```

3. **Run the website**.
```bash
npm run dev
```
6 changes: 3 additions & 3 deletions editors/vscode/scripts/copy-web-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import * as path from "node:path";

const vscodeDir = path.resolve(__dirname, "..");
const repoRoot = path.resolve(vscodeDir, "..", "..");
const sourceDir = path.join(repoRoot, "playground", "public", "wasm");
const sourceDir = path.join(repoRoot, "website", "playground", "public", "wasm");
const targetDir = path.join(vscodeDir, "dist", "browser", "wasm");
const requiredFiles = ["vide-lsp.js", "vide-core.js", "vide-core.wasm"];

if (!fs.existsSync(sourceDir)) {
throw new Error(
`Missing ${sourceDir}. Run \`npm --prefix playground run build:wasm\` first.`,
`Missing ${sourceDir}. Run \`npm --prefix website run build:wasm\` first.`,
);
}

for (const fileName of requiredFiles) {
const sourcePath = path.join(sourceDir, fileName);
if (!fs.existsSync(sourcePath)) {
throw new Error(
`Missing ${sourcePath}. Run \`npm --prefix playground run build:wasm\` first.`,
`Missing ${sourcePath}. Run \`npm --prefix website run build:wasm\` first.`,
);
}
}
Expand Down
Loading
Loading