diff --git a/.deepsource.toml b/.deepsource.toml index ae676efb..cb7f0e0f 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -3,9 +3,6 @@ version = 1 [[analyzers]] name = "javascript" - [analyzers.meta] - plugins = ["react"] - environment = [ - "browser", - "vitest" - ] +[analyzers.meta] +plugins = ["react"] +environment = ["browser"] diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 083d5dfc..298d963e 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -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 diff --git a/.github/workflows/apps-extension-ci.yml b/.github/workflows/apps-extension-ci.yml index 9ca8a595..f02feb6a 100644 --- a/.github/workflows/apps-extension-ci.yml +++ b/.github/workflows/apps-extension-ci.yml @@ -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 diff --git a/.github/workflows/apps-extension-e2e.yml b/.github/workflows/apps-extension-e2e.yml index 66651da5..744e317b 100644 --- a/.github/workflows/apps-extension-e2e.yml +++ b/.github/workflows/apps-extension-e2e.yml @@ -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 diff --git a/.github/workflows/packages-ui-ci.yml b/.github/workflows/packages-ui-ci.yml index 8942a3b0..86e6ba62 100644 --- a/.github/workflows/packages-ui-ci.yml +++ b/.github/workflows/packages-ui-ci.yml @@ -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: diff --git a/.husky/pre-commit b/.husky/pre-commit index 58993aae..b1018fa2 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -pnpm lint +bun run lint diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index a81debae..00000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v20.12.2 diff --git a/README.md b/README.md index 4ffd3a31..508cc147 100644 --- a/README.md +++ b/README.md @@ -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 🚨 - Welcome to Pallad an experimental and progressive Mina Protocol wallet! @@ -25,22 +22,16 @@ 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. @@ -48,7 +39,7 @@ From `apps/extension` copy the `.env.example` as `.env` and adjust the variables Build all the modules in repo: ```shell -$ pnpm build +$ bun run build ``` ## Structure 🏗️ @@ -59,7 +50,7 @@ This is a monorepo for all the Pallad-related code. - `extension` - Browser extension app. - `packages` - `_template` - Template to follow for new packages in this repo. - - `common` - Common configuration for packages (tsup and vitest). + - `common` - Common configuration for packages (tsup). - `features` - Wallet features, views, and UI components. - `key-management` - Blockchain agnostic key management. - `mina-core` - Core Mina Package SDK. @@ -74,7 +65,7 @@ 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 🧪 @@ -82,20 +73,20 @@ $ pnpm dev:extension Running linter: ```shell -$ pnpm lint +$ bun run lint ``` -Running unit tests (Vitest): +Running unit tests (Bun Test): ```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 ✨ diff --git a/apps/extension/package.json b/apps/extension/package.json index 472ab75b..906d9e9d 100644 --- a/apps/extension/package.json +++ b/apps/extension/package.json @@ -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": "bunx --bun 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", @@ -40,12 +40,9 @@ "@esbuild-plugins/node-modules-polyfill": "0.2.2", "@originjs/vite-plugin-commonjs": "1.0.3", "@playwright/test": "1.45.3", - "@testing-library/react": "16.0.0", "@total-typescript/ts-reset": "0.5.1", "@tsconfig/vite-react": "3.0.2", "@types/chrome": "0.0.269", - "@types/mocha": "10.0.7", - "@types/node": "22.0.0", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/webextension-polyfill": "0.10.7", diff --git a/apps/extension/playwright.config.ts b/apps/extension/playwright.config.ts index 7d7c6f2f..bf67ef0a 100644 --- a/apps/extension/playwright.config.ts +++ b/apps/extension/playwright.config.ts @@ -31,7 +31,7 @@ export default defineConfig({ }, ], webServer: { - command: "pnpm preview", + command: "bun run preview", url: BASE_URL, reuseExistingServer: !process.env.CI, }, diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 00000000..b652d90a Binary files /dev/null and b/bun.lockb differ diff --git a/docs/adr/002-ways-of-working.md b/docs/adr/002-ways-of-working.md index fa3d4458..e8b71d6c 100644 --- a/docs/adr/002-ways-of-working.md +++ b/docs/adr/002-ways-of-working.md @@ -31,7 +31,7 @@ In Progress can consist of many stages, such as `Development In Progress`, `Read #### Code Standards -The code we deliver should be as close to 0 weak TypeScript types as possible. The code we deliver should have adequate test automation coverage (unit testing with Vitest and E2E testing with Playwright). +The code we deliver should be as close to 0 weak TypeScript types as possible. The code we deliver should have adequate test automation coverage (unit testing with Bun Test and E2E testing with Playwright). #### Commits and branches diff --git a/extension.turbowatch.ts b/extension.turbowatch.ts index 0fc747eb..dfcaff41 100644 --- a/extension.turbowatch.ts +++ b/extension.turbowatch.ts @@ -12,7 +12,7 @@ export default defineConfig({ ], name: "build", onChange: async ({ spawn }) => { - await spawn`pnpm build:extension` + await spawn`bun run build:extension` }, }, ], diff --git a/package.json b/package.json index 52b8a382..b9874596 100644 --- a/package.json +++ b/package.json @@ -6,29 +6,29 @@ "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 --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", - "@testing-library/react": "16.0.0", + "@happy-dom/global-registrator": "^15.11.0", + "@mina-js/utils": "https://pkg.pr.new/palladians/mina-js/@mina-js/utils@a51d3b4", + "@testing-library/react": "16.0.1", "@tsconfig/strictest": "2.0.5", "@turbo/gen": "2.0.9", - "@vitest/coverage-v8": "2.0.5", - "@mina-js/utils": "https://pkg.pr.new/palladians/mina-js/@mina-js/utils@a51d3b4", + "@types/bun": "^1.1.13", "autoprefixer": "10.4.19", "happy-dom": "14.12.3", "husky": "9.1.4", @@ -40,8 +40,8 @@ "tsup": "8.2.3", "turbo": "2.0.9", "turbowatch": "2.29.4", - "typescript": "5.5.4", - "vitest": "2.0.4" + "typescript": "5.6.3" }, - "packageManager": "pnpm@9.0.1" + "workspaces": ["packages/*", "apps/*"], + "packageManager": "bun@1.1.34" } diff --git a/packages/_template/vitest.config.ts b/packages/_template/vitest.config.ts deleted file mode 100644 index 964f699c..00000000 --- a/packages/_template/vitest.config.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { baseVitestConfig } from "@palladxyz/common" -import { defineConfig } from "vitest/config" - -export default defineConfig({ - ...baseVitestConfig, -}) diff --git a/packages/common/package.json b/packages/common/package.json index 3f8f89fa..aebb59c1 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -17,7 +17,7 @@ } }, "scripts": { - "build": "tsup src/index.ts --dts --format esm --silent", - "cleanup": "rimraf node_modules dist .turbo" + "build": "bunx --bun tsc --noEmit && bunx --bun tsup src/index.ts --dts --format esm --silent", + "cleanup": "bunx --bun rimraf node_modules dist .turbo" } } diff --git a/packages/common/src/configs.ts b/packages/common/src/configs.ts index 4961d19a..c29bc94c 100644 --- a/packages/common/src/configs.ts +++ b/packages/common/src/configs.ts @@ -10,17 +10,3 @@ export const baseTsupConfig: Options = { dts: true, silent: true, } - -export const baseVitestConfig = { - test: { - environment: "happy-dom", - globals: true, - testTimeout: 100000, - hookTimeout: 100000, - test: { - coverage: { - reporter: ["text", "json", "html"], - }, - }, - }, -} diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index 57095655..fef1f89e 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -7,8 +7,7 @@ "allowSyntheticDefaultImports": true, "esModuleInterop": true, "resolveJsonModule": true, - "noPropertyAccessFromIndexSignature": false, - "types": ["vitest/globals"] + "noPropertyAccessFromIndexSignature": false }, "include": ["src", "test"], "exclude": ["dist", "node_modules", ".turbo"] diff --git a/packages/features/package.json b/packages/features/package.json index 56da3725..7bfe524c 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -24,13 +24,13 @@ } }, "scripts": { - "build": "tsup", - "dev": "tsup --watch", + "build": "bunx --bun tsc --noEmit && 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", @@ -82,13 +82,11 @@ "@ladle/react": "4.1.0", "@palladxyz/common": "workspace:*", "@svgr/rollup": "8.1.0", - "@testing-library/react": "16.0.0", "@trpc/server": "10.45.2", "@tsconfig/recommended": "1.0.7", "@tsconfig/vite-react": "3.0.2", "@types/chrome": "0.0.269", "@types/js-beautify": "1.14.3", - "@types/mocha": "10.0.7", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/webextension-polyfill": "0.10.7", @@ -105,7 +103,6 @@ "zod": "3.23.8" }, "peerDependencies": { - "@types/mocha": "10.0.1", "react": "18.2.0", "react-dom": "18.2.0" } diff --git a/packages/features/src/address-book/components/contact-tile.tsx b/packages/features/src/address-book/components/contact-tile.tsx deleted file mode 100644 index b06e6d5d..00000000 --- a/packages/features/src/address-book/components/contact-tile.tsx +++ /dev/null @@ -1,45 +0,0 @@ -// import { TrashIcon } from "lucide-react"; -import { useNavigate } from "react-router-dom" - -import { truncateString } from "@/common/lib/string" -// import { useAddressBookStore } from "@/common/store/address-book"; -import type { Contact } from "@/common/types" - -interface ContactTileProps { - contact: Contact - index?: number -} - -export const ContactTile = ({ contact }: ContactTileProps) => { - const navigate = useNavigate() - // const removeContact = useAddressBookStore((state) => state.removeContact); - return ( -
- {contact?.address && - truncateString({ - value: contact.address, - firstCharCount: 4, - endCharCount: 4, - })} -
-