Skip to content
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

Migrate to Bun #114

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5bb74ac
Migrate to Bun (part 1?)
WarningImHack3r Sep 10, 2023
d944a5d
Migrate Inlang, Husky script & package.json scripts
WarningImHack3r Sep 10, 2023
75d9336
Update bun.lockb
WarningImHack3r Sep 10, 2023
4cf02fd
Temporarily enable Perf check on PR
WarningImHack3r Sep 10, 2023
9f76321
Fix missing site
WarningImHack3r Sep 10, 2023
304c79f
Re-disable Perf check on PR
WarningImHack3r Sep 10, 2023
2cf44ee
Update ignores & README
WarningImHack3r Sep 10, 2023
c463c2f
Change `bun run` to `bun`, remove @types/node
WarningImHack3r Sep 10, 2023
8b690de
Delete .npmrc
WarningImHack3r Sep 17, 2023
fe1933e
Merge branch 'main' into bun-migration
WarningImHack3r Sep 21, 2023
effdf3e
Update dependencies
WarningImHack3r Sep 21, 2023
e55438f
Merge branch 'main' into bun-migration
WarningImHack3r Oct 9, 2023
90da36a
Update lock file
WarningImHack3r Oct 9, 2023
8889cc9
Update dependencies
WarningImHack3r Oct 9, 2023
bf01d31
Update dependencies
WarningImHack3r Oct 9, 2023
f435550
Update lock file
WarningImHack3r Oct 9, 2023
c45c05a
Revert adapter in config
WarningImHack3r Nov 13, 2023
43b6780
Revert adapter in deps
WarningImHack3r Nov 13, 2023
3cf12df
Merge remote-tracking branch 'origin/main' into bun-migration
WarningImHack3r Nov 13, 2023
1174c03
Update lock file
WarningImHack3r Nov 13, 2023
8716df8
Add .gitattributes for Bun lockfile
WarningImHack3r Nov 13, 2023
de6e0aa
Merge branch 'main' into bun-migration
WarningImHack3r Dec 14, 2023
88e0ff6
Update lock file
WarningImHack3r Dec 14, 2023
3947d55
Merge branch 'main' into bun-migration
WarningImHack3r Mar 1, 2024
dd2d9eb
Update lock file
WarningImHack3r Mar 1, 2024
2f7d5c1
Fix un-bun-ified stuff
WarningImHack3r Mar 1, 2024
9f7d0c1
Fix dependency specifier (off-topic)
WarningImHack3r Mar 1, 2024
5e4f48d
Improve specifier
WarningImHack3r Mar 1, 2024
29752fa
Bump version
WarningImHack3r Mar 1, 2024
cf312ac
Revert specifier
WarningImHack3r Mar 4, 2024
3405641
Update lock file
WarningImHack3r Mar 4, 2024
5cb3f03
Merge branch 'main' into bun-migration
WarningImHack3r Mar 8, 2024
72a7019
Update lock file
WarningImHack3r Mar 8, 2024
7bf1842
Add back deps:update script
WarningImHack3r Mar 10, 2024
7226200
Merge branch 'main' into bun-migration
WarningImHack3r Apr 1, 2024
d46a44c
Update lock file
WarningImHack3r Apr 1, 2024
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
bun.lockb
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.lockb binary diff=lockb
69 changes: 25 additions & 44 deletions .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- src/**
- static/**
- package.json
- pnpm-lock.yaml
- bun.lockb
- "*.config.*s"
- tsconfig.json
- .github/workflows/*
Expand All @@ -17,7 +17,7 @@ on:
- src/**
- static/**
- package.json
- pnpm-lock.yaml
- bun.lockb
- "*.config.*s"
- tsconfig.json
- .github/workflows/*
Expand Down Expand Up @@ -70,31 +70,23 @@ jobs:
token: ${{ needs.permissions-check.outputs.has-permissions == 'false' && github.token || secrets.WORKFLOW_PAT }}
fetch-depth: ${{ github.event_name == 'push' && 2 || 1 }}

- name: 📥 Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: 🧭 Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
cache: pnpm
- name: 🧭 Setup Bun
uses: oven-sh/setup-bun@v1

- name: 📥 Install NPM dependencies
run: pnpm i --no-frozen-lockfile
- name: 📥 Install dependencies
run: bun i

- name: 🔍 Detect file changes
id: detect-changes-pnpm
id: detect-changes-bun
run: |
if [[ $(git diff --name-only) =~ pnpm-lock.yaml ]]; then
if [[ $(git diff --name-only) =~ bun.lockb ]]; then
echo "changes_detected=true >> $GITHUB_OUTPUT"
else
echo "changes_detected=false >> $GITHUB_OUTPUT"
fi

- name: ❌ Exit if lock file is not updated
if: needs.permissions-check.outputs.has-permissions == 'false' && steps.detect-changes-pnpm.outputs.changes_detected == 'true'
if: needs.permissions-check.outputs.has-permissions == 'false' && steps.detect-changes-bun.outputs.changes_detected == 'true'
run: exit 1

- name: 📤 Commit updated lock file
Expand All @@ -103,25 +95,25 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update lock file
file_pattern: pnpm-lock.yaml
file_pattern: bun.lockb

- name: ❌ Exit if lock file has been committed
if: needs.permissions-check.outputs.has-permissions == 'true' && steps.auto-commit-action-lock.outputs.changes_detected == 'true'
run: exit 1

- name: 🔨 Compile Inlang
run: pnpm exec paraglide-js compile --project ./project.inlang
run: bun run paraglide-js compile --project ./project.inlang

- name: ✅ Validate Inlang
run: pnpx @inlang/cli@latest validate --project ./project.inlang
run: bunx @inlang/cli@latest validate --project ./project.inlang

- name: ✨ Check for missing localizations
id: missing-localizations
run: pnpx @inlang/cli@latest lint --project ./project.inlang
run: bunx @inlang/cli@latest lint --project ./project.inlang

- name: 🔤 Translate missing localizations
if: failure() && needs.permissions-check.outputs.has-permissions == 'true' && steps.missing-localizations.outcome == 'failure'
run: pnpx @inlang/cli@latest machine translate --project ./project.inlang
run: bunx @inlang/cli@latest machine translate --project ./project.inlang

- name: 📤 Commit localization fixes
if: failure() && needs.permissions-check.outputs.has-permissions == 'true' && steps.missing-localizations.outcome == 'failure'
Expand All @@ -140,7 +132,7 @@ jobs:
sed -i '/\"error\"/d' ./project.inlang/settings.json
# Replace all "warning"s in ./project.inlang/settings.json with "error"
sed -i 's/\"warning\"/\"error\"/g' ./project.inlang/settings.json
pnpx @inlang/cli@latest lint --project ./project.inlang
bunx @inlang/cli@latest lint --project ./project.inlang
# Restore ./project.inlang/settings.json
git restore ./project.inlang/settings.json

Expand All @@ -159,7 +151,7 @@ jobs:
if [[ $file =~ ^src/ || $file =~ ^static/ ]]; then
echo "$file changes code"
code_changes=true
elif [[ $file = pnpm-lock.yaml ]]; then
elif [[ $file = bun.lockb ]]; then
echo "$file changes dependencies"
deps_changes=true
elif [[ $file = *.config.*s || $file = tsconfig.json ]]; then
Expand All @@ -179,16 +171,16 @@ jobs:
- name: ✨ Check Svelte format
id: svelte-format
if: steps.changed-files.outputs.code_changes == 'true'
run: pnpm check
run: bun check

- name: ✨ Check style with Prettier & ESLint
id: prettier-eslint
if: steps.changed-files.outputs.code_changes == 'true' || steps.changed-files.outputs.config_changes == 'true' || steps.changed-files.outputs.deps_changes == 'true'
run: pnpm lint
run: bun lint

- name: 🔧 Fix lint
if: failure() && needs.permissions-check.outputs.has-permissions == 'true' && (steps.svelte-format.outcome == 'failure' || steps.prettier-eslint.outcome == 'failure')
run: pnpm format
run: bun format

- name: 📤 Commit lint fixes
if: failure() && needs.permissions-check.outputs.has-permissions == 'true' && (steps.svelte-format.outcome == 'failure' || steps.prettier-eslint.outcome == 'failure')
Expand Down Expand Up @@ -222,7 +214,7 @@ jobs:
requires_build=false

for file in ${{ steps.modified-files.outputs.all_changed_files }}; do
if [[ $file =~ ^src/ || $file =~ ^static/ || $file = pnpm-lock.yaml || $file = *.config.*s || $file = tsconfig.json ]]; then
if [[ $file =~ ^src/ || $file =~ ^static/ || $file = bun.lockb || $file = *.config.*s || $file = tsconfig.json ]]; then
echo "$file requires build"
requires_build=true
break
Expand All @@ -238,28 +230,17 @@ jobs:
with:
static_site_generator: sveltekit

- name: 📥 Install pnpm
if: steps.changed-files.outputs.requires_build == 'true'
uses: pnpm/action-setup@v2
with:
version: latest

- name: 🧭 Setup Node
if: steps.changed-files.outputs.requires_build == 'true'
uses: actions/setup-node@v4
with:
node-version: latest
cache: pnpm
- name: 🧭 Setup Bun
uses: oven-sh/setup-bun@v1

- name: 📥 Install NPM dependencies
if: steps.changed-files.outputs.requires_build == 'true'
run: pnpm i # no need for `--no-frozen-lockfile` here, as the sync is ensured by the `prechecks` job
- name: 📥 Install dependencies
run: bun i

- name: 🔨 Build repo
if: steps.changed-files.outputs.requires_build == 'true'
run: |
touch static/.nojekyll
pnpm build
bun run build

- name: 📤 Upload artifact
if: github.event_name == 'push' && steps.changed-files.outputs.requires_build == 'true'
Expand Down
4 changes: 2 additions & 2 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if [ "$3" == 1 ]; then # branch checkout only (not file checkout)
# install deps
pnpm install
bun install
# remove local branches that have been deleted on remote
git fetch -p
pnpx git-removed-branches -p -f
bunx git-removed-branches -p -f
fi
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Check lint for all selected files
echo "$FILES" | xargs pnpm prettier --ignore-unknown --check --log-level warn || {
echo "$FILES" | xargs bun run prettier --ignore-unknown --check --log-level warn || {
echo "Prettier failed! Please fix the errors and try again."
exit 1
}
pnpm eslint . || {
bun run eslint . || {
echo "ESLint failed! Please fix the errors and try again."
exit 1
}
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock
bun.lockb
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
## Build locally

```bash
pnpm i
pnpm dev
bun i
bun dev
```
Binary file added bun.lockb
Binary file not shown.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "emerald-website",
"version": "1.0.9",
"version": "1.0.10",
"private": true,
"scripts": {
"dev": "vite",
"dev-exposed": "vite --host",
"build": "vite build",
"preview": "vite preview",
"deps:install": "pnpm i",
"deps:update": "pnpm up",
"deps:update-latest": "pnpm up -L",
"deps:install": "bun i",
"deps:update": "bun update",
"check": "svelte-kit sync && svelte-check --tsconfig tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
Expand Down
Loading