switch to pnpm workspaces
This commit is contained in:
@@ -15,11 +15,11 @@ We welcome contributions of any kind; however, for **feature changes or addition
|
|||||||
2. Follow the [setup guide](./README.md#getting-started) from the README to install the necessary dependencies and run the development servers.
|
2. Follow the [setup guide](./README.md#getting-started) from the README to install the necessary dependencies and run the development servers.
|
||||||
3. You may now make your changes and commit them to your branch.
|
3. You may now make your changes and commit them to your branch.
|
||||||
|
|
||||||
When adding new dependencies or running other commands from the root directory, you can specify the workspace with the `-w` flag. For example, `npm run build -w client` or `npm install express -w server`.
|
When adding new dependencies or running other commands from the root directory, you can specify the workspace with the `--filter` flag before the command. For example, `pnpm --filter client lint` or `pnpm --filter server add express`.
|
||||||
|
|
||||||
### Formatting and linting
|
### Formatting and linting
|
||||||
|
|
||||||
We use ESLint and Prettier to enforce code style and formatting. Please make sure to run `npm run lint-fix` and `npm run format` before committing your changes.
|
We use ESLint and Prettier to enforce code style and formatting. Please make sure to run `pnpm lint:fix` and `pnpm format` before committing your changes.
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
@@ -56,5 +56,5 @@ PGDATABASE=chessu
|
|||||||
- Follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
- Follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||||
- Make sure your changes are thoroughly tested.
|
- Make sure your changes are thoroughly tested.
|
||||||
- Keep your commits atomic and descriptive.
|
- Keep your commits atomic and descriptive.
|
||||||
- Ensure that your code is formatted and linted using `npm run lint-fix` and `npm run format`.
|
- Ensure that your code is formatted and linted using `pnpm lint:fix` and `pnpm format`.
|
||||||
- Make your pull requests as descriptive as possible.
|
- Make your pull requests as descriptive as possible.
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -29,7 +29,7 @@ Built with Next.js 13, Tailwind CSS + daisyUI, react-chessboard, chess.js, Expre
|
|||||||
|
|
||||||
> Node.js 18 or newer is recommended.
|
> Node.js 18 or newer is recommended.
|
||||||
|
|
||||||
This project is structured as a monorepo using npm workspaces, separated into three packages:
|
This project is structured as a monorepo using **pnpm** workspaces, separated into three packages:
|
||||||
|
|
||||||
- `client` - Next.js application for the front-end, deployed to [ches.su](https://ches.su) via Vercel.
|
- `client` - Next.js application for the front-end, deployed to [ches.su](https://ches.su) via Vercel.
|
||||||
- `server` - Node/Express.js application for the back-end, deployed to [server.ches.su](https://server.ches.su) via Railway.
|
- `server` - Node/Express.js application for the back-end, deployed to [server.ches.su](https://server.ches.su) via Railway.
|
||||||
@@ -37,17 +37,18 @@ This project is structured as a monorepo using npm workspaces, separated into th
|
|||||||
|
|
||||||
### Getting started
|
### Getting started
|
||||||
|
|
||||||
1. Install the necessary dependencies by running `npm install` in the root directory of the project.
|
1. Install [pnpm](https://pnpm.io/installation).
|
||||||
2. In the `server` directory, create a `.env` file for your PostgreSQL database. You can try [ElephantSQL](https://www.elephantsql.com/) or [Aiven](https://aiven.io/postgresql) for a free hosted database.
|
2. Install the necessary dependencies by running `pnpm install` in the root directory of the project.
|
||||||
|
3. In the `server` directory, create a `.env` file for your PostgreSQL database. You can try [ElephantSQL](https://www.elephantsql.com/) or [Aiven](https://aiven.io/postgresql) for a free hosted database.
|
||||||
```env
|
```env
|
||||||
PGHOST=db.example.com
|
PGHOST=db.example.com
|
||||||
PGUSER=exampleuser
|
PGUSER=exampleuser
|
||||||
PGPASSWORD=examplepassword
|
PGPASSWORD=examplepassword
|
||||||
PGDATABASE=chessu
|
PGDATABASE=chessu
|
||||||
```
|
```
|
||||||
3. Run the development servers with `npm run dev`.
|
4. Run the development servers with `pnpm dev`.
|
||||||
- To run the frontend and backend servers separately, use `npm run dev -w client` and `npm run dev -w server`, respectively.
|
- To run the frontend and backend servers separately, use `pnpm dev:client` and `pnpm dev:server`, respectively.
|
||||||
4. You can now access the frontend at http://localhost:3000 and the backend at http://localhost:3001.
|
5. You can now access the frontend at http://localhost:3000 and the backend at http://localhost:3001.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
20
package.json
20
package.json
@@ -3,16 +3,18 @@
|
|||||||
"private": "true",
|
"private": "true",
|
||||||
"author": "nizefoo",
|
"author": "nizefoo",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
|
||||||
"client",
|
|
||||||
"server",
|
|
||||||
"types"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"npm run dev -w client\" \"npm run dev -w server\"",
|
"dev": "concurrently 'pnpm --filter client dev' 'pnpm --filter server dev'",
|
||||||
"lint": "eslint . --ignore-path .gitignore",
|
"dev:client": "pnpm --filter client dev",
|
||||||
"lint-fix": "eslint --fix . --ignore-path .gitignore",
|
"dev:server": "pnpm --filter server dev",
|
||||||
"format": "prettier --write . --ignore-path .gitignore"
|
"build:client": "pnpm --filter client build",
|
||||||
|
"build:server": "pnpm --filter server build",
|
||||||
|
"start": "concurrently 'pnpm --filter client start' 'pnpm --filter server start'",
|
||||||
|
"start:client": "pnpm --filter client start",
|
||||||
|
"start:server": "pnpm --filter server start",
|
||||||
|
"lint": "eslint . --ignore-pattern 'pnpm-lock.yaml' --ignore-path .gitignore",
|
||||||
|
"lint:fix": "eslint --fix . --ignore-pattern 'pnpm-lock.yaml' --ignore-path .gitignore",
|
||||||
|
"format": "prettier --write . '!pnpm-lock.yaml' --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^8.2.0",
|
||||||
|
|||||||
4412
pnpm-lock.yaml
generated
Normal file
4412
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
4
pnpm-workspace.yaml
Normal file
4
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
packages:
|
||||||
|
- "client"
|
||||||
|
- "server"
|
||||||
|
- "types"
|
||||||
Reference in New Issue
Block a user