Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
7 changes: 6 additions & 1 deletion .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on: push

jobs:
main:
name: Run ESLint + Prettier
name: Run ESLint + Prettier + TypeScript
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -28,3 +30,6 @@ jobs:

- name: Run Prettier
run: npm run format:check

- name: Run TypeScript
run: npm run type:check
1 change: 1 addition & 0 deletions .github/workflows/update-autocomplete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive

- name: Create or reset the update branch
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/nebula-library"]
path = src/nebula-library
url = https://github.com/UTDNebula/nebula-library.git
6 changes: 0 additions & 6 deletions .mocharc.json

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/server/db/migrations/*
next-env.d.ts
data
src/nebula-library/*
1 change: 1 addition & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const config = {
importOrder: [
'<BUILTIN_MODULES>', // Node.js built-in modules
'<THIRD_PARTY_MODULES>', // Imports not matched by other special words or groups.
'^(@nebula-library)(/.*)$', // Nebula library
'^(@src)(/.*)$',
'^[.]', // relative imports
],
Expand Down
72 changes: 68 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ Please make sure you have at least [NodeJS v21.1.0](https://nodejs.org/en) or gr
Start by cloning the repository to your local machine.

```bash
git clone https://github.com/UTDNebula/utd-notebook.git
git clone https://github.com/UTDNebula/utd-notebook.git --recurse-submodules
```

> [!NOTE]
> If you already cloned the repository but don't have the `src/nebula-library` folder, run the following command:
>
> ```bash
> git submodule update --init --recursive
> ```

Next, navigate to the project directory and install the dependencies.

```bash
Expand All @@ -40,15 +47,21 @@ Make sure you have a `.env` file in the root of the project. If you do not, copy

#### Environment Variables

This project uses [BetterAuth](https://better-auth.com) for authentication. BetterAuth, with their built-in [providers](https://better-auth.com/docs/introduction), makes it easy for users to use preexisting logins. Currently, we are using Discord and Google as OAuth Providers, so you will need to create a Client ID and Client Secret for [Google](https://better-auth.com/docs/authentication/google) and [Discord](https://better-auth.com/docs/authentication/discord) respectively (or remove the providers if you'd like).
This project uses [Better Auth](https://www.better-auth.com/) for authentication. Better Auth, with their built-in [providers](https://www.better-auth.com/docs/authentication/google), makes it easy for users to use preexisting logins. Currently, we are using Discord and Google as OAuth Providers, so you will need to create a Client ID and Client Secret for [Google](https://www.better-auth.com/docs/authentication/google) and [Discord](https://www.better-auth.com/docs/authentication/discord) respectively (or remove the providers if you'd like).

Once you have your Client ID and Client Secrets, add them to your `.env` file.

The `BETTER_AUTH_URL` variable should be set to `http://localhost:3000` for local development.
The `BETTER_AUTH_SECRET` variable should be set to a random string of characters. You can generate one [using this website](https://randomkeygen.com/).
or by running the following command in your terminal.

```bash
openssl rand -hex 32
```

UTD Notebook uses an ORM called [Drizzle](https://orm.drizzle.team/) to interact with the database. In order to connect to the database, you will need to add the `DATABASE_URL` variable to your `.env` file. Your project lead will give this to you upon request.

The Nebula API is used for image storage. The `NEBULA_API_URL` variable should be set to `https://api.utdnebula.com/` and the `NEBULA_API_STORAGE_BUCKET` variable to `jupiter`. An API key and storage key should be requested from the project lead for the `NEBULA_API_KEY` and `NEBULA_API_STORAGE_KEY` variables.
The Nebula API is used for file storage. The `NEBULA_API_URL` variable should be set to `https://api.utdnebula.com/` and the `NEBULA_API_STORAGE_BUCKET` variable to `notebook`. An API key and storage key should be requested from the project lead for the `NEBULA_API_KEY` and `NEBULA_API_STORAGE_KEY` variables.

Finally, start the development server.

Expand All @@ -64,5 +77,56 @@ When working on a new feature, please create a new branch with the following nam
git checkout -b feature/<feature-name>
```

When you are ready to merge your branch into the `develop` branch, please create a pull request and request a review from the Jupiter Dev Team.
When you are ready to merge your branch into the `develop` branch, please create a pull request and request a review from the Notebook Dev Team.
Please include details about what issue you are addressing with the pull request, what changes you made, and any other relevant information.

### Nebula Library

When working in the `src/nebula-library` folder, you are working in a shared component library that is part of a nested Git repository. Follow these steps to create a secondary **pull request** (PR) for your library changes:

#### 1. Checkout a branch

```bash
cd src/nebula-library
# Replace <feature-name> with a branch name
git checkout -b feature/<feature-name>
```

#### 2. Make your changes in the `src/nebula-library` folder

#### 3. Push your changes

```bash
git push
cd ../..
```

#### 4. Make a pull request in the `nebula-library` repository

Make a PR from your branch into `main` at [github.com/UTDNebula/nebula-library](https://github.com/UTDNebula/nebula-library) and request your project lead as a reviewer.

Wait for your PR to be approved.

> [!TIP]
> In the meantime, you can make a regular PR on the [UTD Notebook repository](https://github.com/UTDNebula/utd-notebook). Its checks and build may not pass without your changes in `src/nebula-library`, so you can switch the branch and push with the following commands:
>
> ```bash
> # Replace <feature-name> with the feature name you used in step 1
> git submodule set-branch --branch feature/<feature-name> src/nebula-library
> git push
> ```
>
> If you do this, just make sure to run the following command before the next step:
>
> ```bash
> git submodule set-branch --default src/nebula-library
> ```

#### 5. After your `nebula-library` pull request is merged…

Pull your changes from the library and push them to Notebook. Then make a regular PR on Notebook.

```bash
git submodule update --recursive --remote
git push
```
25 changes: 25 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,32 @@ const eslintConfig = defineConfig([
'next-env.d.ts',
'styleguide/build/**',
'styleguide.config.js',
'src/nebula-library/**',
]),
// Allow HTML <img> elements in Next.JS generated image metadata files
{
files: ['src/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}'],
rules: {
'@next/next/no-img-element': 'off',
},
},
// Enforce shorter path alias '@nebula-library/*' instead of '@src/nebula-library/*'
{
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@src/nebula-library', '@src/nebula-library/*'],
message:
"Please use the shorter path alias '@nebula-library/*' instead of '@src/nebula-library/*'.",
},
],
},
],
},
},
]);

export default eslintConfig;
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config: JestConfigWithTsJest = {
},
detectOpenHandles: true,
forceExit: true,
testPathIgnorePatterns: ['<rootDir>/src/nebula-library'],
};

export default config;
Loading
Loading