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

migrate: use bun #246

Merged
merged 7 commits into from
Jan 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
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
50 changes: 15 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,29 @@ on:
pull_request:

jobs:
ci-workflow:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- 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: Install dependencies
run: bun install

- name: Set up Node v16
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Run linter
run: bun run check
build:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

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

- name: Run TypeScript Compiler
run: pnpm run build

- name: Run linter
run: pnpm run lint

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

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

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
33 changes: 18 additions & 15 deletions apps/docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
domains: ["raw.githubusercontent.com"],
},
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config) => {
// this will override the experiments
config.experiments = { ...config.experiments, topLevelAwait: true };
// this will just update topLevelAwait property of config.experiments
// config.experiments.topLevelAwait = true
return config;
},
reactStrictMode: true,
swcMinify: true,
images: {
domains: ["raw.githubusercontent.com"],
},
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config) => {
// this will override the experiments
config.experiments = {
...config.experiments,
topLevelAwait: true,
};
// this will just update topLevelAwait property of config.experiments
// config.experiments.topLevelAwait = true
return config;
},
};

module.exports = nextConfig;
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"
}
}
}
8 changes: 4 additions & 4 deletions apps/docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
31 changes: 21 additions & 10 deletions apps/docs/src/components/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IconDefinition } from "@fortawesome/free-solid-svg-icons";
import { faBox, faBook, faHome } from "@fortawesome/free-solid-svg-icons";
import { faBook, faBox, faHome } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Link from "next/link";
import { useRouter } from "next/router";
Expand All @@ -13,15 +13,30 @@ export const Breadcrumb = () => {
if (typeof lib !== "string") return null;

const defaultPaths: Path[] = [
{ name: "Home", icon: faHome, path: "/" },
{ name: "Docs", icon: faBook, path: "/docs" },
{ name: lib, icon: faBox, path: `/docs/${lib}` },
{
name: "Home",
icon: faHome,
path: "/",
},
{
name: "Docs",
icon: faBook,
path: "/docs",
},
{
name: lib,
icon: faBox,
path: `/docs/${lib}`,
},
];

const splittedPaths: Path[] = asPath
.split("/")
.slice(3)
.map((x) => ({ name: capitalize(x), path: `/docs/${lib}/${x}` }));
.map((x) => ({
name: capitalize(x),
path: `/docs/${lib}/${x}`,
}));
const combinedPaths = [...defaultPaths, ...splittedPaths];
const activePath = combinedPaths.find((x) => x.path === asPath);
if (activePath) activePath.isActive = true;
Expand All @@ -32,11 +47,7 @@ export const Breadcrumb = () => {
{combinedPaths.map((path, index, arr) => {
const res = (
<li className="inline-flex items-center" key={index}>
<Link
className={`inline-flex items-center text-xs md:text-sm font-medium ${path.isActive ? "text-guilded" : "text-white hover:text-guilded"
}`}
href={path.path}
>
<Link className={`inline-flex items-center text-xs md:text-sm font-medium ${path.isActive ? "text-guilded" : "text-white hover:text-guilded"}`} href={path.path}>
{path.icon && <FontAwesomeIcon className="pr-2" icon={path.icon} />}
{path.name}
</Link>
Expand Down
Loading