Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create monorepo using pnpm #52

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ dist-ssr

*.gitignored.*

server/.env
server/*.local
packages/api/.env
packages/api/*.local
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm*.yaml
61 changes: 51 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,69 @@

Interactive notebooks for JavaScript.

## Repo architecture
## Setup

The repository is split between client code (found at the root level) and server code, found under [/server](/server).
- Node 22+
- pnpm 9+

## Development

First, run the server:
To run the app, you'll need to start both the API and Web servers.

Run the API:

```shell
pnpm run dev-api
```

Run the Web server:

```shell
pnpm run dev-web
```

Then visit http://localhost:5173

## Running pnpm scripts

Same as NPM, check top-level package.json for scripts.

```shell
pnpm run lint-web
```
$ cd server/
$ npm i
$ npm run dev

To run a script defined in one of the packages:

```shell
pnpm --filter api typecheck
```

Then, run the client:
## Adding a dependency

To add a dependency from npm registry:

```shell
# Add npm dependency to the API package
pnpm add <dep> --filter api

# Add npm dev dependency to the API package
pnpm add -D <dep> --filter api
```
$ # from root of repository
$ npm i
$ npm run dev

To add a dependency from within the workspace:

```shell
# Add the shared package to the API package.
pnpm add @srcbook/shared --workspace --filter api

# Add the shared package as a dev dependency to the API package.
pnpm add -D @srcbook/shared --workspace --filter api
```

To remove a package, use `remove` instead of `add` in the commands above.

## Env

You can pass the following env variables:

- `SRC_BOOK_CONFIG_DIR`: this is the directory where the local config.json will live
Expand Down
Loading