Skip to content

Commit

Permalink
chore: migrate to bun
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Feb 17, 2024
1 parent 223c998 commit 5990267
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 19,857 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Enable Corepack and Install Correct Yarn Version
run: |
corepack enable
yarn set version 4.0.2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "20.10.0"

- name: Install
run: yarn install
run: npm install -g bun

- name: Local Build
run: yarn build
run: bun build

- name: Lint
run: yarn format
run: bun format

run-migration:
runs-on: ubuntu-latest
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "18.16.0"
node-version: "20.10.0"

- name: Install
run: yarn install
run: npm install bun -g && bun install

- name: Build
run: yarn build
run: bun build

- name: Test
env:
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
X25519_PRIVATE_KEY: "QCDb30UHUkwJAGhLWC-R2N0PiEbd4vQY6qH2Wloybyo"

run: "yarn test"
run: "bun test"
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
bun commitlint --edit "$1"
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname "$0")/_/husky.sh"

# Run lint-staged first
yarn lint-staged --verbose
bun lint-staged --verbose
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ We'd also love PRs. If you're thinking of a large PR, we advise opening up an is
## Submitting a pull request

1. Fork and clone the repository.
2. Configure and install the dependencies: `yarn install`.
3. Make sure the tests pass on your machine: `yarn test`. These tests also apply the linter, so there's no need to lint separately.
2. Configure and install the dependencies: `bun install`.
3. Make sure the tests pass on your machine: `bun test`. These tests also apply the linter, so there's no need to lint separately.
4. Create a new branch: `git checkout -b my-branch-name`.
5. Make your change, add tests, and make sure the tests still pass. You can find the tests in the `src/tests` directory.
6. Push to your fork and submit a pull request.
Expand All @@ -31,9 +31,9 @@ Work in Progress pull requests are also welcome to get feedback early on, or if
## Running the project locally

1. Fork and clone the repository.
2. Install dependencies: `yarn install`.
3. Build the project: `yarn build`.
4. Start the project: `yarn start:watch`.
2. Install dependencies: `bun install`.
3. Build the project: `bun build`.
4. Start the project: `bun start:watch`.

## Environment Setup

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Ubiquity DAO's GitHub Bot for Automating DevPool Management.

git clone https://github.com/ubiquity/ubiquibot.git
cd ubiquibot
yarn
yarn build (to compile your changes)
bun
bun build (to compile your changes)

yarn build --watch (to locally auto compile your changes)
bun build --watch (to locally auto compile your changes)

yarn start:watch
bun start:watch

## It's recommended to split terminals in your IDE while running above input
```
Expand Down Expand Up @@ -228,12 +228,12 @@ Supabase comes with a [readme](https://github.com/ubiquity/ubiquibot/blob/develo
### This options will require you to have a local Docker installation (under the hood it is required by Supabase) refer to [Supabase Docs](https://supabase.com/docs)

```
yarn supabase start
bun supabase start
```

## Check Supabase Status (locally)
```
yarn supabase status
bun supabase status
```

![supabase](https://github.com/ubiquity/ubiquibot/assets/41552663/e8709b8f-e7c3-49e0-876c-c15dde22c6d2)
Expand All @@ -252,16 +252,16 @@ DISQUALIFY_TIME="7 days" // 7 days
```

3. `Make sure you have Node => 20.10.0 && yarn`
3. `Make sure you have Node => 20.10.0 && bun`
4. Open 2 terminal instances:
- in one instance run `yarn build --watch` (compiles the Typescript code)
- in another instance run `yarn start:watch` (runs the bot locally)
- in one instance run `bun build --watch` (compiles the Typescript code)
- in another instance run `bun start:watch` (runs the bot locally)
5. Open `http://localhost:3000` and follow instructions to add the bot to one of your repositories.

At this point the `.env` files auto-fill the empty fields (`PRIVATE_KEY` and `APP_ID`) if it is not previously filled.
Now you can make changes to the repository on GitHub (e.g. add a task) and the bot should react.

6. After adding the bot (as a installed app) to your github you will need to restart the aforementioned `yarn start:watch`` so CTRL-C to stop the node daemon and `yarn start:watch` again
6. After adding the bot (as a installed app) to your github you will need to restart the aforementioned `bun start:watch`` so CTRL-C to stop the node daemon and `bun start:watch` again

You can, for example:

Expand Down Expand Up @@ -312,7 +312,7 @@ Make sure you have your local instance of [ubiquibot running](#quickstart).

## How to create a new release

1. Update the version in package.json: `yarn version --new-version x.x.x`
1. Update the version in package.json: `bun version --new-version x.x.x`
2. Commit and create a new tag: `git commit -am x.x.x && git tag -am x.x.x`
3. Push tags: `git push origin v"x.x.x"`
4. The Github action will create a release by recognizing the version tag
Expand Down
Binary file added bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ID = "d2668848-c2a6-411f-b884-004faee1942f"

[build]
command = "echo \"export const COMMIT_HASH = '$COMMIT_REF';\" > src/commit-hash.ts && yarn build"
command = "echo \"export const COMMIT_HASH = '$COMMIT_REF';\" > src/commit-hash.ts && bun build"
functions = "./.netlify/functions"
publish = "dist"

Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@
],
"scripts": {
"inspect": "node --inspect node_modules/.bin/probot run ./dist/main.js",
"build:gh-actions": "ncc build src/adapters/github/github-actions.ts -o ./",
"build": "tsc",
"build:watch": "tsc --watch",
"clean": "rimraf ./dist ./node_modules",
"format": "run-s format:prettier format:eslint format:cspell",
"format:prettier": "prettier --write src",
"format:eslint": "eslint --fix --ext .ts ./src",
"format:cspell": "cspell --config .cspell.json 'src/**/*.{js,ts,json,md,yml}'",
"start:gh-actions": "tsx src/adapters/github/github-actions.ts",
"start:watch": "nodemon --exec 'yarn start'",
"start:watch": "nodemon --exec 'bun start'",
"start": "probot run ./dist/main.js",
"format:knip": "knip",
"format:knip-ci": "knip --no-exit-code --reporter json",
"prepare": "husky install",
"test": "jest",
"logs:netlify": "yarn netlify logs:function webhooks"
"logs:netlify": "bun netlify logs:function webhooks"
},
"dependencies": {
"@commitlint/cli": "^17.4.3",
Expand Down Expand Up @@ -109,7 +105,7 @@
},
"verbose": true,
"ext": "ts",
"exec": "yarn start"
"exec": "bun start"
},
"packageManager": "yarn@4.0.2"
"packageManager": "bun@4.0.2"
}
12 changes: 6 additions & 6 deletions supabase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@ SUPABASE_KEY=XXX
- Run Supabase locally

```sh
yarn supabase start
bun supabase start
```

- Manager database migrations

```sh
yarn supabase migration
bun supabase migration
```

- CI/CD for releasing to production

```sh
yarn supabase db push
bun supabase db push
```

- Manager your supabase projects

```sh
yarn supabase projects
bun supabase projects
```

- Generate types directly from your database schemas

```sh
yarn supabase gen types
bun supabase gen types
```

3. Link the local project to the supabase project you created.

```sh
yarn supabase link -p PASSWORD --project-ref PROJECT_REF
bun supabase link -p PASSWORD --project-ref PROJECT_REF
```

For more information about arguments, please go through [here](https://supabase.com/docs/reference/cli/supabase-link)
Expand Down
46 changes: 0 additions & 46 deletions sweep.yaml

This file was deleted.

Loading

0 comments on commit 5990267

Please sign in to comment.