Skip to content

Commit

Permalink
migrate: use bun
Browse files Browse the repository at this point in the history
  • Loading branch information
zaida04 committed Jan 19, 2024
1 parent 99433aa commit ba52708
Show file tree
Hide file tree
Showing 25 changed files with 105 additions and 7,584 deletions.
6 changes: 3 additions & 3 deletions .changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ We have a quick list of common questions to get you started engaging with this p

The release steps follows this:

- "pnpm run prerelease"
- "pnpm i -r"
- "pnpm recursive publish"
- "bun run prerelease"
- "bun install -r"
- "bun run publish"
10 changes: 0 additions & 10 deletions .config/.eslintignore

This file was deleted.

41 changes: 0 additions & 41 deletions .config/.eslintrc.js

This file was deleted.

27 changes: 0 additions & 27 deletions .config/.eslintrc.web.js

This file was deleted.

5 changes: 0 additions & 5 deletions .config/.lintstagedrc.json

This file was deleted.

11 changes: 0 additions & 11 deletions .config/.prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions .config/.prettierrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ If you wish to contribute to the codebase or documentation, feel free to fork th
To get ready to work on the codebase, please do the following:

- Fork & clone the repository, and make sure you're on the main branch
- Run pnpm install -r
- Run bun install -r
- Code your heart out!
- Run pnpm run test to run ESLint and ensure any JSDoc changes are valid
- Run bun run test to run Biome and ensure any JSDoc changes are valid
- Submit a pull request (Make sure you follow the conventional commit format)

> Adapted from https://github.com/discordjs/discord.js/blob/master/.github/CONTRIBUTING.md
40 changes: 5 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,14 @@ jobs:
steps:
- name: Clone repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.6.3
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Set up Node v16
uses: actions/setup-node@v3
with:
node-version: "16"
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: pnpm install -r
run: bun install

- name: Run TypeScript Compiler
run: pnpm run build
run: bun run build

- name: Run linter
run: pnpm run lint

- name: Run Prettier
run: pnpm run prettier:check

# - name: Run tests
# run: pnpm run test
run: bun run check

23 changes: 6 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,16 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.API_TOKEN_GITHUB }}

- name: Install PNPM
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
version: 8.6.3

- name: Set up Node v16
uses: actions/setup-node@v3
with:
node-version: "16"
cache: "pnpm"
registry-url: " https://registry.npmjs.org"
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: pnpm install -r
run: bun install

- name: Build Package
run: pnpm run build
- name: Build packages
run: bun run build

- name: Apply version changes to packages
run: pnpm run changeset:version
run: bun run changeset:version

- name: Commit package.json changes
uses: EndBug/add-and-commit@v9
Expand All @@ -42,7 +31,7 @@ jobs:
push: true

- name: Release
run: pnpm recursive publish
run: bun recursive publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
20 changes: 5 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,16 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install PNPM
uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb
with:
version: 8.6.3

- name: Install Node v14
uses: actions/setup-node@v3
with:
node-version: "16"
cache: "pnpm"
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: pnpm install -r

run: bun install
- name: Build project
run: pnpm run build
run: bun run build

- name: Build the docs
run: pnpm run docs
run: bun run docs

- name: Commit the Docs
uses: cpina/github-action-push-to-another-repository@main
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 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged --config .config/.lintstagedrc.json
bun run check:fix
3 changes: 1 addition & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"scripts": {
"lint": "eslint --ignore-path ../../.config/.eslintignore --config ../../.config/.eslintrc.web.js src",
"dev": "next dev",
"build": "next build",
"start": "next start"
Expand All @@ -28,4 +27,4 @@
"react-code-blocks": "0.0.9-0",
"react-dom": "18.2.0"
}
}
}
25 changes: 25 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"ignore": [
"dist",
"node_modules",
"types",
".next"
],
"enabled": true,
"lineEnding": "lf",
"indentWidth": 200,
"indentStyle": "tab",
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
Binary file added bun.lockb
Binary file not shown.
29 changes: 12 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@
"description": "Overarching repository for the Guilded.JS repository",
"author": "Zaid \"Nico\" <contact@nico.engineer>",
"scripts": {
"build": "pnpm --filter=!docs recursive run build",
"build:typecheck": "pnpm --filter=!docs recursive run build:typecheck",
"lint": "pnpm recursive --no-bail run lint",
"lint:fix": "pnpm run lint --fix",
"prettier": "prettier --ignore-path .config/.prettierignore --config .config/.prettierrc.json --write **/*.{ts,js,json,yml,yaml,md}",
"prettier:check": "prettier --ignore-path .config/.prettierignore --config .config/.prettierrc.json --check **/*.{ts,js,json,yml,yaml,md}",
"build": "turbo run build",
"build:typecheck": "turbo run build:typecheck",
"check": "biome check apps packages services",
"check:fix": "biome check --apply-unsafe apps packages services",
"changeset": "changeset",
"changeset:version": "changeset version",
"docs": "typedoc && cd docs && find . -type f -name \"*.html\" -exec sed -i'' -e 's/__namedParameters/options/g' {} +",
"prepublishOnly": "pnpm run lint && pnpm recursive run prepublishOnly",
"prepublishOnly": "turbo run prepublishOnly",
"prepare": "husky install"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@types/node": "18.16.12",
"dotenv": "16.0.3",
"eslint": "8.40.0",
"eslint-config-neon": "0.1.47",
"gen-esm-wrapper": "1.1.3",
"husky": "7.0.4",
"lint-staged": "13.2.2",
"nodemon": "^2.0.22",
"pnpm": "8.5.1",
"prettier": "2.8.8",
"rimraf": "5.0.1",
"ts-node": "10.9.1",
"turbo": "^1.11.2",
"typedoc": "0.24.7",
"typescript": "5.0.4"
},
Expand All @@ -56,8 +50,9 @@
"url": "https://github.com/DaStormer"
}
],
"engines": {
"npm": "only-allow pnpm",
"node": ">= 16.0.0"
}
}
"workspaces": [
"packages/*",
"services/*",
"apps/*"
]
}
7 changes: 3 additions & 4 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
"main": "dist/index.js",
"types": "types/index.d.ts",
"scripts": {
"lint": "eslint --ignore-path ../../.config/.eslintignore --config ../../.config/.eslintrc.js lib",
"build": "tsc && gen-esm-wrapper . ./dist/index.mjs",
"build:typecheck": "tsc --noEmit",
"prepublishOnly": "rimraf dist/ && rimraf types/ && pnpm run build",
"prepublishOnly": "rimraf dist/ && rimraf types/ && bun run build",
"router:preserve": "ts-node scripts/pre-gen-router.ts",
"router:restore": "ts-node scripts/post-gen-router.ts",
"generate:ws": "openapi-typescript \"https://www.guilded.gg/api/v1/socket-open-api-schema.json\" --output lib/generated/api-typings/v1/ws.ts",
"generate:long:router": "pnpx openapi-typescript-codegen --input \"https://www.guilded.gg/api/v1/open-api-schema.json\" --output lib/generated/router --name GuildedRouter --useOptions --postfixModels Payload --useUnionTypes",
"generate:router": "pnpm router:preserve && pnpm generate:long:router && prettier -w lib/generated/router/**/*.ts && pnpm router:restore"
"generate:router": "bun run router:preserve && bun run generate:long:router && biome check --apply-unsafe lib/generated/router/**/*.ts && pnpm router:restore"
},
"devDependencies": {
"@types/fs-extra": "^11.0.1",
Expand Down Expand Up @@ -84,4 +83,4 @@
"url": "https://github.com/zaida04/guilded.js/issues"
},
"gitHead": "eee38a19e0bfa812d7136cc78a6bc99e0b402b0c"
}
}
Loading

0 comments on commit ba52708

Please sign in to comment.