Skip to content

Commit

Permalink
Merge pull request #11 from ls1intum/2-issue-create-a-monoreopo-for-a…
Browse files Browse the repository at this point in the history
…pollon2

feat: Create a monoreopo for apollon2
  • Loading branch information
egenerse authored Dec 16, 2024
2 parents f67ca6c + 5671d9a commit 47fab64
Show file tree
Hide file tree
Showing 37 changed files with 5,166 additions and 4,894 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jest-cache/
jest-output/

# Monorepo specific
apps/*/node_modules/
packages/*/node_modules/
apps/*/dist/
packages/*/dist/
standalone/*/node_modules/
library/*/node_modules/
standalone/*/dist/
library/*/dist/

# Lint and Prettier files
eslintcache
.prettiercache

.yarn/
library/stats.html
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn commitlint --edit $1
npx --no -- commitlint --edit $1
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
yarn prettier
yarn lint:w
npm run format
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.18.0
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc.yml

This file was deleted.

139 changes: 139 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Monorepo Setup

Welcome to the Apollon2 Monorepo! This repository uses **npm workspaces** to manage multiple packages (including a server, webapp, and library) in a single codebase.

## Requirements

Ensure you have the following installed:

1. **Node.js**:

- This project uses a specific Node.js version as indicated in the `.nvmrc` file.
- Use [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm) to install/manage Node versions:
```bash
brew install nvm
```
Then, load `nvm` into your shell:
```bash
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"
```

Once `nvm` is set up:

```bash
nvm install
nvm use
```

2. **npm**(comes with Node.js):
- This monorepo uses npm workspaces, which are supported out-of-the-box in npm 7+.
- Verify your npm version:
```bash
npm -v
```

## Setup Instructions

1. Clone the repository:

```bash
git clone git@github.com:ls1intum/Apollon2.git
cd Apollon2
```

2. Use the correct Node.js version:

```bash
nvm install
nvm use
```

3. Install dependencies for all packages:

```bash
npm install
```

4. Build all packages:

```bash
npm run build
```

5. Start the project:
```bash
npm run start
```

## Verifying Versions

After setup, verify that you have the correct versions installed:

- **Node.js:**
```bash
node -v
```
This should match the version specified in the `.nvmrc` file.

## Project Structure

Here is a brief overview of the project structure:

```
apollon2/
├── standalone/
│ ├── server/
│ │ ├── src/
│ │ ├── package.json
│ │ └── ...
│ └── webapp/
│ ├── src/
│ ├── package.json
│ └── ...
├── library
│ ├── src/
│ ├── package.json
| └── ...
├── .nvmrc # Specifies the Node.js version
├── .prettierrc # Configuration file for formating typescript files
├── commitlint.config.mj # Checking commit messages in format
└── README.md # Project documentation
```
## Scripts Overview
Here are the commonly used scripts defined in the monorepo:
- **Install dependencies:**
```bash
npm install
```
- **Build all packages:**
```bash
npm run build
```
- **Start the project:**
```bash
npm run start
```

## Troubleshooting

- If you encounter issues with Node.js versions, ensure you have the correct version installed by running:
```bash
nvm use
```
- If a package fails to build, check its individual `package.json` for specific build scripts and dependencies.

## Contributing

We welcome contributions! Please follow the steps below to contribute:

1. Fork the repository.
2. Create a feature branch.
3. Commit your changes and push them to your fork.
4. Submit a pull request.

Thank you for using and contributing to our monorepo!
28 changes: 0 additions & 28 deletions apps/client/eslint.config.js

This file was deleted.

29 changes: 0 additions & 29 deletions apps/client/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions apps/client/tsconfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions apps/server/eslint.config.mjs

This file was deleted.

18 changes: 0 additions & 18 deletions apps/server/package.json

This file was deleted.

12 changes: 0 additions & 12 deletions apps/server/src/server.ts

This file was deleted.

9 changes: 0 additions & 9 deletions apps/server/tsconfig.json

This file was deleted.

39 changes: 0 additions & 39 deletions eslint.config.mjs

This file was deleted.

File renamed without changes.
27 changes: 27 additions & 0 deletions library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@apollon2/library",
"version": "0.0.1",
"type": "module",
"main": "dist/main.js",
"types": "dist/main.d.ts",
"files": [
"dist"
],
"sideEffects": [
"**/*.css"
],
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview"
},
"peerDependencies": {
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"typescript": "5.7.2",
"vite": "6.0.1",
"@vitejs/plugin-react": "4.3.4"
}
}
Loading

0 comments on commit 47fab64

Please sign in to comment.