Skip to content

Commit

Permalink
chore(repo): switch from pnpm to bun
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Nov 6, 2024
1 parent 2bc5d5c commit 4459848
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 15,397 deletions.
25 changes: 7 additions & 18 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,14 @@ runs:
with:
repo-token: ${{ inputs.GITHUB_TOKEN }}
server-token: ${{ inputs.TURBO_SERVER_TOKEN }}
- name: Setup Node.js
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
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: oven-sh/setup-bun@v2
name: Install Bun
- uses: actions/cache@v4
name: Setup pnpm cache
name: Setup cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
- name: Install dependencies
shell: bash
run: pnpm install
run: bun i
6 changes: 3 additions & 3 deletions .github/workflows/apps-extension-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TURBO_SERVER_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
- name: Lint the code
run: pnpm lint
run: bun run lint
- name: Build extension
env:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_DEFAULT_NETWORK_ID=$VITE_APP_DEFAULT_NETWORK_ID pnpm build:extension
run: VITE_APP_DEFAULT_NETWORK_ID=$VITE_APP_DEFAULT_NETWORK_ID bun run build:extension
- name: Run unit tests
run: pnpm test:unit
run: bun run test:unit
- uses: actions/upload-artifact@v4
with:
name: pallad-chromium
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/apps-extension-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: VITE_APP_E2E=$VITE_APP_E2E VITE_APP_DEFAULT_NETWORK_ID=$VITE_APP_DEFAULT_NETWORK_ID pnpm build:extension
run: VITE_APP_E2E=$VITE_APP_E2E VITE_APP_DEFAULT_NETWORK_ID=$VITE_APP_DEFAULT_NETWORK_ID bun run build:extension
- name: Install Chromium for Playwright
working-directory: apps/extension
run: pnpm test:e2e:install
run: bun run test:e2e:install
- name: Run E2E tests
run: pnpm test:e2e:extension
run: bun run test:e2e:extension
- uses: actions/upload-artifact@v4
with:
name: pallad-extension-e2e
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/packages-ui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
TURBO_API: "http://127.0.0.1:9080"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: pallad
run: pnpm build:features
run: bun run build:features
- name: Build features stories
run: pnpm story:features
run: bun run story:features
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint
bun run lint
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[![Discord](https://img.shields.io/discord/1127906495409958953?label=Discord)](https://discord.gg/ExzzfTGUnB)
![example workflow](https://github.com/palladians/pallad/actions/workflows/apps-extension-ci.yml/badge.svg)

⚠️ Work in progress ⚠️
🚨 Now in Beta 🚨

</div>

Welcome to Pallad an experimental and progressive Mina Protocol wallet!
Expand All @@ -25,30 +22,24 @@ Pallad is at the frontier, leading the way in innovation and user-centric design

### Prerequisite 📌

- [NVM](https://github.com/nvm-sh/nvm)
- pnpm
- Bun

### Installation 💻

Make sure you're on the right Node.js version, and you got pnpm installed.

```shell
$ nvm use
$ npm i -g pnpm
```
Make sure you're on the latest Bun version.

Install the dependencies:

```shell
$ pnpm i
$ bun i
```

From `apps/extension` copy the `.env.example` as `.env` and adjust the variables there.

Build all the modules in repo:

```shell
$ pnpm build
$ bun run build
```

## Structure 🏗️
Expand All @@ -74,28 +65,28 @@ This is a monorepo for all the Pallad-related code.
Set up the dev server of extension:

```shell
$ pnpm dev:extension
$ bun run dev:extension
```

## Testing 🧪

Running linter:

```shell
$ pnpm lint
$ bun run lint
```

Running unit tests (Vitest):

```shell
$ pnpm test:unit
$ bun run test:unit
```

Running E2E tests for browser extension (Playwright):

```shell
$ npx playwright install chromium # make sure you have Chromium driver
$ pnpm test:e2e:extension
$ bunx playwright install chromium # make sure you have Chromium driver
$ bun run test:e2e:extension
```

## Contributors ✨
Expand Down
8 changes: 4 additions & 4 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "0.6.2",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && pnpm build:rpc && vite build",
"build:rpc": "tsup",
"dev": "bunx --bun vite",
"build": "tsc --noEmit && bun run build:rpc && bunx --bun vite build",
"build:rpc": "bunx --bun tsup",
"build:firefox": "web-ext build --source-dir=dist",
"build:safari": "xcrun safari-web-extension-converter dist --app-name Pallad --bundle-identifier co.pallad.app --swift --no-prompt --force --macos-only --no-open",
"preview": "vite preview",
"preview": "bunx --bun vite preview",
"cleanup": "rimraf node_modules dist .turbo",
"test:e2e": "playwright test",
"test:e2e:install": "npx playwright install --with-deps chromium",
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineConfig({
},
],
webServer: {
command: "pnpm preview",
command: "bun run preview",
url: BASE_URL,
reuseExistingServer: !process.env.CI,
},
Expand Down
Binary file added bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion extension.turbowatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
name: "build",
onChange: async ({ spawn }) => {
await spawn`pnpm build:extension`
await spawn`bun run build:extension`
},
},
],
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
"license": "Apache-2.0",
"scripts": {
"build": "turbo run build",
"b": "pnpm build",
"b": "bun run build",
"build:extension": "turbo run build --filter=@palladxyz/extension...",
"build:features": "turbo run build --filter=@palladxyz/features...",
"story:features": "turbo run story:build --filter=@palladxyz/features",
"dev:extension": "turbowatch extension.turbowatch.ts",
"lint": "pnpm biome check .",
"lint:fix": "pnpm lint --write",
"lint": "bunx biome check .",
"lint:fix": "bun run lint --write",
"test:unit": "turbo run test:unit",
"test:e2e:extension": "turbo run test:e2e --filter=@palladxyz/extension",
"format": "pnpm biome check --write .",
"format:unsafe": "pnpm biome check --write --unsafe .",
"f": "pnpm format",
"format": "bunx biome check --write .",
"format:unsafe": "bunx biome check --write --unsafe .",
"f": "bun run format",
"cleanup": "turbo run cleanup && rimraf node_modules .turbo",
"prepare": "husky install",
"preinstall": "npx only-allow pnpm"
"preinstall": "bunx only-allow bun"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
Expand All @@ -43,5 +43,6 @@
"typescript": "5.5.4",
"vitest": "2.0.4"
},
"packageManager": "[email protected]"
"workspaces": ["packages/*", "apps/*"],
"packageManager": "[email protected]"
}
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
},
"scripts": {
"build": "tsup src/index.ts --dts --format esm --silent",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup src/index.ts --dts --format esm --silent",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
}
}
12 changes: 6 additions & 6 deletions packages/features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "echo 'not yet'",
"story:dev": "VITE_APP_LADLE=true ladle serve",
"story:build": "VITE_APP_LADLE=true ladle build -o ./build",
"story:preview": "VITE_APP_LADLE=true ladle preview",
"cleanup": "rimraf node_modules dist .turbo build"
"story:dev": "VITE_APP_LADLE=true bunx --bun ladle serve",
"story:build": "VITE_APP_LADLE=true bunx --bun ladle build -o ./build",
"story:preview": "VITE_APP_LADLE=true bunx --bun ladle preview",
"cleanup": "bunx --bun rimraf node_modules dist .turbo build"
},
"dependencies": {
"@github/hotkey": "3.1.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/key-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"coverage": "vitest run --coverage",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"coverage": "bunx --bun vitest run --coverage",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@noble/ciphers": "0.5.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/mina-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@palladxyz/util": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions packages/offchain-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"dayjs": "1.11.12",
Expand Down
8 changes: 4 additions & 4 deletions packages/pallad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@palladxyz/mina-core": "workspace:*",
Expand Down
8 changes: 4 additions & 4 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@noble/hashes": "1.4.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"bs58check": "4.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/vault/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@a51d3b4",
Expand Down
8 changes: 4 additions & 4 deletions packages/web-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
}
},
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"test:unit": "vitest run",
"cleanup": "rimraf node_modules dist .turbo"
"build": "bunx --bun tsup",
"dev": "bunx --bun tsup --watch",
"test:unit": "bunx --bun vitest run",
"cleanup": "bunx --bun rimraf node_modules dist .turbo"
},
"dependencies": {
"@mina-js/klesia-sdk": "https://pkg.pr.new/palladians/mina-js/@mina-js/klesia-sdk@a51d3b4",
Expand Down
Loading

0 comments on commit 4459848

Please sign in to comment.