chore: migrate to bun (phase 1) - #247
Open
nicomiguelino wants to merge 2 commits into
Open
Conversation
Switch Docker image, CI workflows, and dev scripts from npm to bun. Fix jsdom opaque origin error and scss mock loading under Bun's module resolver.
There was a problem hiding this comment.
Pull request overview
Phase 1 of migrating the project’s dev/build/test toolchain from npm/node base images to Bun, updating Docker + CI execution paths and adjusting the test environment to behave correctly under Bun (notably JSDOM origin handling and CSS/SCSS import mocking).
Changes:
- Switch container base image and container-invoked commands from
npm/npxtobun/bunx(Dockerfile, workflows, and helper scripts). - Add JSDOM
urlconfiguration to avoid “opaque origin” issues (enableslocalStorage/sessionStorageaccess in tests). - Replace Node-only CSS/SCSS require hooks with a Bun-aware plugin, while preserving Node compatibility.
Reviewed changes
Copilot reviewed 7 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/test/environment.js |
Sets a concrete JSDOM URL to prevent opaque-origin failures in the test environment. |
spec/helpers/mock-styles.js |
Adds a Bun plugin to mock .css/.scss loads under Bun, with a Node fallback using require.extensions. |
spec/helpers/jsdom.js |
Updates JSDOM initialization to include a URL for consistent origin behavior. |
Dockerfile |
Migrates the build image from node:22 to oven/bun:1.4.0 and installs deps via bun install using bun.lock. |
docker-compose.yml |
Runs the dev webpack watcher via bunx instead of npx. |
bin/run_tests.sh |
Runs tests via bun run test inside the container. |
bin/run_formatter.sh |
Runs formatting via bun run format:* inside the container. |
bin/run_eslint.sh |
Runs lint checks via bun run lint:check inside the container. |
bin/package_extension.sh |
Builds the production bundle via bunx webpack inside the container. |
.github/workflows/test.yaml |
Updates CI test job to use bunx + bun run test in the container. |
.github/workflows/build.yaml |
Updates CI build job to use bun run build in the container. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
FlatCompat.extends('plugin:@typescript-eslint/recommended') loads a
legacy eslintrc config via import-fresh, which calls
module.parent.require, a Node internal Bun's module loader does not
implement. Use typescript-eslint's native flat config export instead.
Also format eslint.config.mjs, which sits outside the format:check
src/ scope and had never been run through Prettier.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
Dockerfile:10
bun installin the Docker build is not using a frozen/locked mode. That means a Docker/CI build can silently resolve different dependency versions than whatbun.lockspecifies (or even rewrite the lockfile), reducing reproducibility. Consider usingbun install --frozen-lockfilefor image builds.
ADD package.json /app/package.json
ADD bun.lock /app/bun.lock
RUN bun install
Comment on lines
49
to
53
| -v $(pwd)/artifacts:/app/artifacts:delegated \ | ||
| -v /app/artifacts/node_modules \ | ||
| screenly-browser-extension:latest \ | ||
| /bin/bash -c "npm run build && cp -r dist/ artifacts/" | ||
| /bin/bash -c "bun run build && cp -r dist/ artifacts/" | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This is phase 1 of a multi phase migration. Later phases will be stacked on top.
Test plan