Compare commits

..

No commits in common. "af7f1380bc8e9ca4032e1f7f5d19f8b2391d1380" and "42edbd3792dbd1b84b89e650037e7e2ac17a6b9c" have entirely different histories.

4 changed files with 307 additions and 320 deletions

View file

@ -2,7 +2,7 @@
This is probably outdated. This is probably outdated.
Welcome to the TomodachiShare development guide! This project uses [pnpm](https://pnpm.io/) for package management, [Next.js](https://nextjs.org/) with the app router for the backend, [Vite with React](https://vite.dev/) for the frontend, [Prisma](https://prisma.io) for the database, [TailwindCSS](https://tailwindcss.com/) for styling, and [TypeScript](https://www.typescriptlang.org/) for type safety. Welcome to the TomodachiShare development guide! This project uses [pnpm](https://pnpm.io/) for package management, [Next.js](https://nextjs.org/) with the app router for the front-end and back-end, [Prisma](https://prisma.io) for the database, [TailwindCSS](https://tailwindcss.com/) for styling, and [TypeScript](https://www.typescriptlang.org/) for type safety.
## Getting started ## Getting started
@ -14,21 +14,21 @@ $ cd tomodachi-share
$ pnpm install $ pnpm install
``` ```
Prisma types are generated automatically, however, if you changed the schema or need to trigger a manual refresh: Prisma types are generated automatically, however, sometimes you might need to:
```bash ```bash
# Generate Prisma client types # Generate Prisma client types
$ pnpm --filter backend prisma generate $ pnpm prisma generate
# Or, if you've added new database properties # Or, if you've added new database properties
$ pnpm --filter backend prisma migrate dev $ pnpm prisma migrate dev
$ pnpm --filter backend prisma generate $ pnpm prisma generate
``` ```
I recommend opting out of Next.js' telemetry program but it is not a requirement. I recommend opting out of Next.js' telemetry program but it is not a requirement.
```bash ```bash
$ pnpm --filter backend exec next telemetry disable $ pnpm exec next telemetry disable
``` ```
## Environment variables ## Environment variables
@ -62,11 +62,10 @@ services:
After starting the docker applications, apply TomodachiShare's database schema migrations. After starting the docker applications, apply TomodachiShare's database schema migrations.
```bash ```bash
$ pnpm --filter backend prisma migrate dev $ pnpm prisma migrate dev
``` ```
After, in both the backend and frontend, make a copy of the `.env.example` file and rename it to `.env`. After, make a copy of the `.env.example` file and rename it to `.env`. The database variables should be pre-configured, but you'll need to fill in the rest of the variables.
For the backend, the database variables should be pre-configured, but you'll need to fill in the rest of the variables.
For the `AUTH_SECRET`, run the following in the command line: For the `AUTH_SECRET`, run the following in the command line:
@ -75,7 +74,7 @@ $ pnpx auth secret
``` ```
> [!NOTE] > [!NOTE]
> This command may put the secret in a file named `.env.local`, if that happens copy it and paste it into `backend/.env` > This command may put the secret in a file named `.env.local`, if that happens copy it and paste it into `.env`
Now, let's get the Discord and GitHub authentication set up. If you don't plan on editing any code associated with authentication, you likely only need to setup one of these services. Now, let's get the Discord and GitHub authentication set up. If you don't plan on editing any code associated with authentication, you likely only need to setup one of these services.
@ -85,16 +84,10 @@ For GitHub, navigate to your profile settings, then 'Developer Settings', and cr
Google is annoying so I'm not explaining it. Google is annoying so I'm not explaining it.
## Development Server After configuring the environment variables, you can run a development server.
The frontend and backend need to be ran simulatenously, therefore you need two separate terminals.
```bash ```bash
# Terminal 1 $ pnpm dev
$ pnpm --filter backend dev
# Terminal 2
$ pnpm --filter frontend dev
``` ```
## Building ## Building
@ -103,10 +96,8 @@ It's a good idea to build the project locally before submitting a pull request.
```bash ```bash
# Build the project # Build the project
$ pnpm --filter backend build $ pnpm build
$ pnpm --filter frontend build
# Run the built version (Note: Vite likes to change the port when this happens, so you probably need to change both .env files) # Run the built version
$ pnpm --filter backend start $ pnpm start
$ pnpm --filter frontend build
``` ```

View file

@ -1,4 +0,0 @@
VITE_BASE_URL="http://localhost:5173"
VITE_API_URL="http://localhost:3000"
VITE_ADMIN_USER_ID=1
VITE_CONTRIBUTORS_USER_IDS=1

View file

@ -69,7 +69,7 @@ export default function MiiEditor({ instructions }: Props) {
{(Object.keys(TAB_COMPONENTS) as Tab[]).map((t) => { {(Object.keys(TAB_COMPONENTS) as Tab[]).map((t) => {
const TabComponent = TAB_COMPONENTS[t]; const TabComponent = TAB_COMPONENTS[t];
return ( return (
<div key={t} className={t === tab ? "grow relative p-3 min-h-0" : "hidden"}> <div key={t} className={t === tab ? "grow relative p-3" : "hidden"}>
<TabComponent instructions={instructions} /> <TabComponent instructions={instructions} />
</div> </div>
); );