Skip to content

Commit

Permalink
feat: completes the bun migration
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Nov 3, 2023
1 parent 3161561 commit 518f74b
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 65 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ If applicable, add screenshots to help explain your problem.

**Information (please complete the following information):**

- Node version [e.g. 18.17.0]
- Bun version [e.g. 1.0.8]

**Additional context**
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ jobs:

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: "1.0.8"

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.18.2"

- name: Install dependencies
run: bun install
Expand Down
56 changes: 23 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ In this guide, you will get an overview of the project structure and setup, as w
- [The tech stack](#the-tech-stack)
- [Getting stuff running](#getting-stuff-running)
- [Cloning the repo](#cloning-the-repo)
- [Volta](#volta)
- [Bun](#bun)
- [Installing dependencies](#installing-dependencies)
- [Environment Variables](#environment-variables)
- [Configuring your Database](#configuring-your-database)
- [Configuring Clerk](#configuring-clerk)
- [Configuring Upstash](#configuring-upstash)
- [Installing dependencies](#installing-dependencies)
- [Running stuff](#running-stuff)
- [Closing notes](#closing-notes)

Expand Down Expand Up @@ -69,9 +69,8 @@ If you would like to be more involved in the development of Noodle, we would lik

## The tech stack

The Environment:
The Runtime:

- [NodeJS](https://nodejs.org/en)
- [Bun](https://bun.sh/)

The Tech Stack:
Expand Down Expand Up @@ -112,39 +111,31 @@ To clone the repo, you firstly need to [fork](https://github.com/noodle-run/nood
git clone https://github.com/<your-gh-username>/noodle.git
```

### Volta
### Bun

To get the project running locally, it is advised that you have [Volta](https://volta.sh/) installed on your system. This allows you to have the exact same versions of [NodeJS](https://nodejs.org/en), further lowering the chances of you getting errors that we don't get.
Bun is used as the package manager of Noodle, with Bun, you actually don't need to have NodeJS installed at all on your system to be able to run Noodle. The only tool you need to install dependencies & run Noodle is Bun!

There are ways to do this using other tools such as NVM, but we take Noodle as an initiative to move people to arguably better tools such as Volta.
To install bun, head over to [their website](https://bun.sh/) which will tell you how to get it installed on your system.

With this out of the way, you should have the correct version of Nodejs once you change directory into Noodle's project folder. You can test this out as such:
To check that you have Bun installed, simply run the following command:

```bash
# cd into noodle
cd /path/to/noodle

# output node version
node --version
bun --version
```

### Bun
If this commands outputs a version number, you're all good to go.

TODO: write this
### Installing dependencies

```bash
# cd into noodle
cd /path/to/noodle
With bun installed on your machine, the next step would be to install the dependencies that Noodle relies upon to work, to do this, run the following command:

# output bun version
bun --version
```bash
bun install
```

And make sure that the version is the same as the one defined in the root `package.json` file in the `volta` section.

### Environment Variables

Now that Volta has been installed locally on your system, it's time to configure your environment variables so that the project works as expected:
Now that Bun & dependencies has been installed, it's time to configure your environment variables so that the project works as expected:

1. Duplicate the `.env.example` file as just `.env`

Expand Down Expand Up @@ -191,27 +182,26 @@ And now you got Auth!

And that's all for the redis part!

### Installing dependencies

To install the dependencies needed to run Noodle, you need to run `bun install`, this will install all of the packages that we use. After this is done, you are ready to run Noodle locally!

### Running stuff

```bash
# Run the project's dev server
bun run dev
bun dev

# Build the project
bun run build

# Run the built project in production mode
bun run start
bun start

# Run the typecheck script
bun typecheck

# Lint
bun run lint
# Lint using ESLint
bun lint

# Format
bun run format:write
# Format using Prettier
bun format
```

## Closing notes
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "dotenv/config";
import type { Config } from "drizzle-kit";
import { env } from "./src/env.mjs";

Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"author": "NOODLE RUN LTD",
"private": true,
"scripts": {
"postinstall": "cd ./node_modules/better-sqlite3 && bun run install && cd ../../",
"dev": "bun run db:migrate && bun run next dev",
"build": "bun run db:migrate && bun run next build",
"start": "next start",
Expand All @@ -16,7 +17,7 @@
"db:generate": "drizzle-kit generate:sqlite",
"db:push": "drizzle-kit push:sqlite",
"db:studio": "drizzle-kit studio",
"db:migrate": "tsx ./scripts/run-migrations.ts"
"db:migrate": "bun ./scripts/run-migrations.ts"
},
"dependencies": {
"@clerk/nextjs": "^4.25.6",
Expand Down Expand Up @@ -64,6 +65,7 @@
"@upstash/redis": "^1.23.4",
"@vercel/analytics": "^1.1.1",
"autoprefixer": "10.4.16",
"better-sqlite3": "^9.0.0",
"bufferutil": "^4.0.8",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
Expand Down Expand Up @@ -105,14 +107,8 @@
"@types/eslint": "^8.44.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"dotenv": "^16.3.1",
"drizzle-kit": "^0.19.13",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.6",
"tsx": "^3.14.0"
},
"volta": {
"node": "18.18.2",
"bun": "1.0.8"
"prettier-plugin-tailwindcss": "^0.5.6"
}
}
1 change: 0 additions & 1 deletion scripts/run-migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "dotenv/config";
import { migrate } from "drizzle-orm/libsql/migrator";
import { db } from "../src/db";

Expand Down
2 changes: 1 addition & 1 deletion src/app/(marketing)/_components/faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const FaqAccordion = () => {
return (
<Accordion>
{faq.map((item, i) => (
<AccordionItem key={i} {...item} aria-label={item.title} />
<AccordionItem key={i} title={item["aria-label"]} {...item} />
))}
</Accordion>
);
Expand Down
14 changes: 7 additions & 7 deletions src/app/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,34 +149,34 @@ export const features: FeatureCardProps[] = [
},
];

export const faq: Pick<AccordionItemProps, "title" | "children">[] = [
export const faq: Pick<AccordionItemProps, "aria-label" | "children">[] = [
{
title: "Why is the name Noodle",
"aria-label": "Why is the name Noodle",
children:
"The name came up from our usage of the platform Moodle throughout our university years. We wanted to build something with our idea for this platform and the name Noodle came up as a joke. We liked it and it stuck.",
},
{
title: "Is it an LMS platform",
"aria-label": "Is it an LMS platform",
children:
"The simple answer is no, we are not an LMS platform. We are a productivity platform so you can think of us as like Notion, Obsidian, Craft...etc but specifically for students. The specificality of Noodle is that we are built for students and we are built to be a blend of everything you need to be productive as a student.",
},
{
title: "When is it coming out",
"aria-label": "When is it coming out",
children:
"We are working hard to get the first initial version of Noodle out as soon as possible (beta), that would be closed and invite only for a number of people, from there on we will be launching and widening the userbase in phases.",
},
{
title: "Will I be given access",
"aria-label": "Will I be given access",
children:
"Yes, we will onboard the people on our waitlist based on a first come first serve basis, with a 500 user limit for our initial version. We will also be giving out invites to people who are active in our discord server.",
},
{
title: "What will be the pricing",
"aria-label": "What will be the pricing",
children:
"We currently have no idea, we would like to have some sort of a survey with our initial version users to see what they think is a fair price for the platform. Noodle will also always be open source and self hostable for individuals who want to do that.",
},
{
title: "What aspect of it is open source",
"aria-label": "What aspect of it is open source",
children:
"Noodle's DNA revolves around being open source, and with that we can confidentally say that we will keep it open source no matter what.",
},
Expand Down
8 changes: 2 additions & 6 deletions src/server/api/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { db } from "@/db";
import {
type SignedInAuthObject,
type SignedOutAuthObject,
getAuth,
} from "@clerk/nextjs/server";
import { getAuth } from "@clerk/nextjs/server";
import { TRPCError, initTRPC } from "@trpc/server";
import { type NextRequest } from "next/server";
import superjson from "superjson";
import { ZodError } from "zod";

type CreateContextOptions = {
auth: SignedInAuthObject | SignedOutAuthObject | null;
auth: ReturnType<typeof getAuth> | null;
};

const createInnerTRPCContext = ({ auth }: CreateContextOptions) => {
Expand Down

0 comments on commit 518f74b

Please sign in to comment.