-
Notifications
You must be signed in to change notification settings - Fork 214
Bun #2635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Bun #2635
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
f36a478
rebase onto `main`.
ItzNotABug 4e639ab
remove: engine.
ItzNotABug 28322fa
fixes.
ItzNotABug ccc9762
fix: lock!
ItzNotABug bbf3683
fix: lock!
ItzNotABug 055a0f8
fix: lock!
ItzNotABug bd3f43e
attempt: fix tests.
ItzNotABug a0d991a
revert.
ItzNotABug 9a74067
add: bunfig.
ItzNotABug 86b4ac3
Update package.json
ItzNotABug 86f2238
Update tests.yml
ItzNotABug efcb5e1
bump: contributions.
ItzNotABug 05e1730
refactor: test script names.
ItzNotABug 952f064
bump: bun lock.
ItzNotABug 0a4ca86
ci: empty commit
ItzNotABug 4f7ac9d
address comments.
ItzNotABug 92f25bf
Merge branch 'main' into bun
ItzNotABug c8df58d
lint.
ItzNotABug 7a23e8d
Merge branch 'main' into bun
ItzNotABug 569eded
update: misc.
ItzNotABug 76810cd
fix: audit.
ItzNotABug c36d09a
fix: agents.md.
ItzNotABug 29a9a04
fix: text.
ItzNotABug a34e30a
address comment.
ItzNotABug 7007417
remove: prismjs!
ItzNotABug d361685
remove: duplicate
ItzNotABug af3b64c
remove: unused selector.
ItzNotABug 25e021b
bump: pink.
ItzNotABug d848feb
Merge pull request #2822 from appwrite/remove-prismjs
ItzNotABug 6867839
Merge branch 'main' into bun
ItzNotABug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| # Ignore files for PNPM, NPM and YARN | ||
| # Ignore files for PNPM, NPM, BUN and YARN | ||
| pnpm-lock.yaml | ||
| package-lock.json | ||
| yarn.lock | ||
| bun.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,33 +2,39 @@ | |
|
|
||
| ## Repository Overview | ||
|
|
||
| Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with **Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package manager: **pnpm 10.15.1**, Node 20+. ~1500 files with extensive component-based architecture. | ||
| Appwrite Console is the web-based GUI for the Appwrite backend-as-a-service platform. Single-page application built with | ||
| **Svelte 5 + SvelteKit 2**, **TypeScript** (not strict mode), **Vite 7**, tested with **Vitest + Playwright**. Package | ||
| manager/runtime: **Bun** (Node 20+ optional for tooling). ~1500 files with extensive component-based architecture. | ||
|
|
||
| ## Critical Build & Test Commands | ||
|
|
||
| ### Setup (REQUIRED before any commands) | ||
|
|
||
| 1. **Install pnpm**: `npm install -g corepack && corepack enable && corepack prepare [email protected] --activate` | ||
| 1. **Install Bun**: | ||
| - Linux & macOS: `curl -fsSL https://bun.sh/install | bash` | ||
| - Windows: `powershell -c "irm bun.sh/install.ps1 | iex"` | ||
| 2. **Create .env**: `cp .env.example .env` (configure `PUBLIC_APPWRITE_ENDPOINT` and `PUBLIC_CONSOLE_MODE`) | ||
| 3. **Configure network access** (if using GitHub Actions or restricted environments): | ||
| - Ensure firewall/proxy allows access to: `pkg.pr.new`, `pkg.vc`, `registry.npmjs.org` | ||
| - These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`, `@appwrite.io/pink-svelte` | ||
| - In GitHub Actions: Use `pnpm/action-setup@v4` which handles registry configuration | ||
| - These domains are required for dependencies: `@appwrite.io/console`, `@appwrite.io/pink-icons-svelte`, | ||
| `@appwrite.io/pink-svelte` | ||
| - In GitHub Actions: Ensure Bun is installed and registry access is configured | ||
| - If network errors persist, check proxy settings: `npm config get proxy` and `npm config get https-proxy` | ||
| 4. **Install dependencies**: `pnpm install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions, installation may still succeed with cached versions) | ||
| 4. **Install dependencies**: `bun install --frozen-lockfile` (if pkg.pr.new/pkg.vc fail due to network restrictions, | ||
| installation may still succeed with cached versions) | ||
|
|
||
| ### Development Commands | ||
|
|
||
| **Standard workflow**: `check` → `lint` → `test` → `build` (before committing) | ||
|
|
||
| - `pnpm run check` - TypeScript/Svelte validation (~30-60s) | ||
| - `pnpm run lint` - ESLint check (~10-20s) | ||
| - `pnpm run format` - Auto-fix Prettier formatting | ||
| - `pnpm run test` - Vitest unit tests with TZ=EST (~10-30s) | ||
| - `pnpm run build` - Production build via build.js (~60-120s) | ||
| - `pnpm dev` - Dev server on port 3000 | ||
| - `pnpm run preview` - Preview build on port 4173 | ||
| - `pnpm run e2e` - Playwright tests (needs `pnpm exec playwright install --with-deps chromium` first, ~120s+) | ||
| - `bun run check` - TypeScript/Svelte validation (~30-60s) | ||
| - `bun run lint` - ESLint check (~10-20s) | ||
| - `bun run format` - Auto-fix Prettier formatting | ||
| - `bun run test` - Vitest unit tests with TZ=EST (~10-30s) | ||
| - `bun run build` - Production build via build.js (~60-120s) | ||
| - `bun run dev` - Dev server on port 3000 | ||
| - `bun run preview` - Preview build on port 4173 | ||
| - `bun run e2e` - Playwright tests (needs `bunx playwright install --with-deps chromium` first, ~120s+) | ||
|
|
||
| **CI Pipeline** (`.github/workflows/tests.yml`): audit → install → check → lint → test → build | ||
|
|
||
|
|
@@ -52,36 +58,42 @@ src/ | |
| └── app.html, hooks.{client,server}.ts, service-worker.ts | ||
| ``` | ||
|
|
||
| **SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper), `+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`. | ||
| **SvelteKit conventions**: `+page.svelte` (component), `+page.ts` (data loader), `+layout.svelte` (wrapper), | ||
| `+error.svelte` (errors). Groups like `(console)` organize routes without affecting URLs. Dynamic params: `[param]`. | ||
|
|
||
| ## Key Configuration | ||
|
|
||
| **svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`, `$themes` | ||
| **vite.config.ts**: Dev port 3000, Vitest (client=jsdom, server=node), test files: `src/**/*.{test,spec}.{js,ts}` | ||
| **svelte.config.js**: Adapter = static SPA (fallback: index.html), base path `/console`, aliases: `$lib`, `$routes`, | ||
| `$themes` | ||
| **vite.config.ts**: Dev port 3000 | ||
| **tsconfig.json**: Extends `.svelte-kit/tsconfig.json`, **NOT strict mode** (`strict: false`) | ||
| **eslint.config.js**: Flat config (ESLint 9+), many rules disabled (see TODOs) | ||
| **.prettierrc**: 4 spaces, single quotes, 100 char width, no trailing commas | ||
|
|
||
| ## Testing | ||
|
|
||
| **Unit (Vitest)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit (`$app/*`) in `vitest-setup-client.ts`. | ||
| **E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s, Chromium only. | ||
| **Unit (Bun test)**: Tests in `src/lib/helpers/*.test.ts`, run with `TZ=EST` (timezone matters). Setup mocks SvelteKit ( | ||
| `$app/*`) in `bun-test-setup.ts` via `bunfig.toml`. | ||
| **E2E (Playwright)**: Tests in `e2e/journeys/*.spec.ts`, needs build+preview on port 4173, retries 3x, timeout 120s, | ||
| Chromium only. | ||
|
|
||
| ## Common Pitfalls | ||
|
|
||
| 1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit issue) | ||
| 1. **Blank page in dev**: Disable ad blockers if seeing "Failed to fetch dynamically imported module" (known SvelteKit | ||
| issue) | ||
| 2. **Network errors on install**: | ||
| - pkg.pr.new/pkg.vc deps may fail due to firewall/proxy restrictions | ||
| - Check access: `curl -I https://pkg.pr.new` and `curl -I https://pkg.vc` | ||
| - Configure proxy if needed: `npm config set proxy http://proxy:port` and `npm config set https-proxy http://proxy:port` | ||
| - GitHub Actions: Ensure runner has internet access; use `pnpm/action-setup@v4` action | ||
| - Configure proxy if needed: `npm config set proxy http://proxy:port` and | ||
| `npm config set https-proxy http://proxy:port` | ||
| - GitHub Actions: Ensure runner has internet access and Bun is installed | ||
| - Local dev: Often safe to continue with cached versions if network fails | ||
| 3. **OOM on build**: Set `NODE_OPTIONS=--max_old_space_size=8192` (like Dockerfile does) | ||
| 4. **Test failures**: Always use `pnpm run test` (sets TZ=EST), not `vitest` directly | ||
| 5. **TS errors not showing**: Run `pnpm run check` explicitly (dev server doesn't always surface them) | ||
| 6. **Format vs lint conflicts**: Run `pnpm run format` before `pnpm run lint` | ||
| 4. **Test failures**: Always use `bun run test` (sets TZ=EST), not `bun test` directly | ||
| 5. **TS errors not showing**: Run `bun run check` explicitly (dev server doesn't always surface them) | ||
| 6. **Format vs lint conflicts**: Run `bun run format` before `bun run lint` | ||
| 7. **E2E timeouts**: Wait 120s for preview server startup, tests auto-retry 3x | ||
| 8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && pnpm run build` | ||
| 8. **Stale build**: Clear `.svelte-kit` if changes not reflected: `rm -rf .svelte-kit && bun run build` | ||
|
|
||
| ## Code Conventions | ||
|
|
||
|
|
@@ -96,28 +108,31 @@ src/ | |
|
|
||
| 1. Run Appwrite backend locally (see [docs](https://appwrite.io/docs/advanced/self-hosting)) | ||
| 2. Configure `.env` with backend endpoint | ||
| 3. `pnpm install --frozen-lockfile` | ||
| 4. `pnpm dev` (hot reload on port 3000) | ||
| 5. Before commit: `pnpm run check && pnpm run format && pnpm run lint && pnpm run test && pnpm run build` | ||
| 6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments before finalizing | ||
| 3. `bun install --frozen-lockfile` | ||
| 4. `bun run dev` (hot reload on port 3000) | ||
| 5. Before commit: `bun run check && bun run format && bun run lint && bun run test && bun run build` | ||
| 6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments | ||
| before finalizing | ||
|
|
||
| ## Required Pre-Completion Checklist | ||
|
|
||
| **CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and ensure all pass: | ||
| **CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and | ||
| ensure all pass: | ||
|
|
||
| 1. **`pnpm run format`** - Auto-fix all formatting issues | ||
| 2. **`pnpm run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings) | ||
| 3. **`pnpm run lint`** - Check code style (ignore pre-existing issues in files you didn't modify) | ||
| 4. **`pnpm run test`** - Run all unit tests (all tests must pass) | ||
| 5. **`pnpm run build`** - Ensure production build succeeds | ||
| 1. **`bun run format`** - Auto-fix all formatting issues | ||
| 2. **`bun run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings) | ||
| 3. **`bun run lint`** - Check code style (ignore pre-existing issues in files you didn't modify) | ||
| 4. **`bun run test`** - Run all unit tests (all tests must pass) | ||
| 5. **`bun run build`** - Ensure production build succeeds | ||
|
|
||
| If any command fails: | ||
|
|
||
| - **Format/Lint**: Run `pnpm run format` to auto-fix, then re-check | ||
| - **Format/Lint**: Run `bun run format` to auto-fix, then re-check | ||
| - **Type errors**: Fix all TypeScript errors in files you modified | ||
| - **Test failures**: Fix failing tests or ensure failures are unrelated to your changes | ||
| - **Build failures**: Debug and resolve build issues before proceeding | ||
|
|
||
| **Never skip these checks** - they are mandatory quality gates before any work is considered complete. | ||
|
|
||
| **Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use `--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path. | ||
| **Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use | ||
| `--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,11 @@ | ||
| FROM --platform=$BUILDPLATFORM node:20-alpine AS build | ||
| FROM --platform=$BUILDPLATFORM oven/bun:alpine AS build | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| RUN npm i -g corepack@latest | ||
| RUN corepack enable | ||
| RUN corepack prepare [email protected] --activate | ||
|
|
||
| ADD ./package.json /app/package.json | ||
| ADD ./pnpm-lock.yaml /app/pnpm-lock.yaml | ||
| ADD ./bun.lock /app/bun.lock | ||
|
|
||
| RUN pnpm install --frozen-lockfile | ||
| RUN bun install --frozen-lockfile | ||
|
|
||
| ADD ./build.js /app/build.js | ||
| ADD ./tsconfig.json /app/tsconfig.json | ||
|
|
@@ -43,7 +37,7 @@ ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN | |
| ENV SENTRY_RELEASE=$SENTRY_RELEASE | ||
| ENV NODE_OPTIONS=--max_old_space_size=8192 | ||
|
|
||
| RUN pnpm run build | ||
| RUN bun run build | ||
|
|
||
| FROM nginx:1.26.3-alpine | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.