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

649 migrate from bun to pnpm #651

Merged
merged 7 commits into from
Dec 19, 2024
Merged
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
29 changes: 21 additions & 8 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@ runs:
using: 'composite'
steps:
- name: Setup node env 🏗
uses: oven-sh/setup-bun@v2
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: 'Cache Dependencies 🕓'
uses: 'actions/cache@v4'
id: cache-node-modules
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: 'node_modules'
key: deps-node-modules-${{ hashFiles('**/bun.lockb') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies 👨🏻‍💻
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: bun install
run: pnpm install --no-frozen-lockfile
shell: bash
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: ./.github/actions/setup

- name: Build Application 🧱
run: bun run build
run: pnpm run build
env:
NEXT_PUBLIC_API_URL: https://api.example.com
AUTH_SPOTIFY_ID: secret
Expand All @@ -41,10 +41,10 @@ jobs:
uses: ./.github/actions/setup

- name: Lint JS files 🐱
run: bun run lint:js
run: pnpm run lint:js

- name: Lint CSS files 🐱
run: bun run lint:css
run: pnpm run lint:css

test:
name: 'Test 🧪'
Expand All @@ -59,7 +59,7 @@ jobs:
uses: ./.github/actions/setup

- name: Run unit tests 🧪
run: bun run test:coverage
run: pnpm run test:coverage

- name: Collect coverage
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bun run commitlint --edit $1
pnpm commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bun run lint-staged
pnpm lint-staged
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
".stylelintrc": ".stylelintignore",
".eslintrc.cjs": ".eslintcache",
".env": ".env.*",
"package.json": ".npmrc, yarn.lock, .yarnrc, .nvmrc, yarn-error.log, bun.lockb"
"package.json": ".npmrc, yarn.lock, .yarnrc, .nvmrc, yarn-error.log, pnpm-lock.yaml"
},
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Real time spotify statistics calculation based on your listening history.
![Vercel](https://img.shields.io/badge/vercel-%23000000.svg?style=for-the-badge&logo=vercel&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
![NodeJS](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white)
![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=for-the-badge&logo=bun&logoColor=white)
![Pnpm](https://img.shields.io/badge/pnpm-F69220?style=for-the-badge&logo=pnpm&logoColor=white)
![React](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
![NextJS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white)
![React Query](https://img.shields.io/badge/-React%20Query-FF4154?style=for-the-badge&logo=react%20query&logoColor=white)
Expand Down
Binary file removed bun.lockb
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/project-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ Make sure that you have the right version of Node.js installed in nvm.
nvm use
```

Make sure you have bun installed globally.
Make sure you have pnpm installed globally.

```bash
#Linux & macOS
curl -fsSL https://bun.sh/install | bash
curl -fsSL https://get.pnpm.io/install.sh | sh -

#Windows
powershell -c "irm bun.sh/install.ps1 | iex"
npm install -g pnpm
```

I'm suggesting to install
[@antfu/ni](https://www.npmjs.com/package/@antfu/ni/v/0.13.1) globally:

```bash
bun add -g @antfu/ni
pnpm add -g @antfu/ni
```

Don't forget to install the dependencies:
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"dev:turbo": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "bun run lint:js && bun run lint:css && bun run typecheck",
"lint": "pnpm run lint:js && pnpm run lint:css && pnpm run typecheck",
"lint:js": "eslint '*/**/*.{js,jsx,jsc,jsm,ts,tsx}' --ignore-path .gitignore --resolve-plugins-relative-to .",
"lint:css": "stylelint \"**/*.{sass,scss,pcss,postcss,css}\" --allow-empty-input --ignore-path .gitignore",
"lint:fix": "bun run lint:js --fix && bun run lint:css --fix",
"lint:fix": "pnpm run lint:js --fix && pnpm run lint:css --fix",
"format": "prettier --write .",
"typecheck": "tsc",
"test": "vitest run",
Expand Down Expand Up @@ -139,5 +139,13 @@
"type-fest": "^4.21.0",
"vitest": "^2.0.4",
"vitest-mock-extended": "^2.0.0"
}
},
"engines": {
"node": "20.16.0",
"npm": "please-use-pnpm",
"yarn": "please-use-pnpm",
"bun": "please-use-pnpm",
"pnpm": ">=9"
},
"packageManager": "pnpm@9.14.2"
}
Loading
Loading