Skip to content

Commit

Permalink
Update pnpm usage in contributing and mentions of moved packages (#38)
Browse files Browse the repository at this point in the history
* update contributing docs to use pnpm

* update mentions of docs & packages that were moved

* promote running all packages in dev

* simplify build command

* add notice when API doesn't start up
  • Loading branch information
azrikahar authored Jul 15, 2022
1 parent 2d227e1 commit e1fc683
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
12 changes: 4 additions & 8 deletions contributing/codebase-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
## Monorepo

The primary Directus repository is located at [`directus/directus`](https://github.com/directus/directus) and houses the
Admin App (Vue.js 3 w/ Composition API), API (Node.js), project documentation (Markdown), API Specification (OpenAPI),
and other smaller packages used internally. Directus follows a monorepo design similar to React or Babel — this page
will outline our monorepo's design and structure.
Admin App (Vue.js 3 w/ Composition API), API (Node.js), API Specification (OpenAPI), and other smaller packages used
internally. Directus follows a monorepo design similar to React or Babel — this page will outline our monorepo's design
and structure.

## `/api`

Expand Down Expand Up @@ -115,13 +115,9 @@ Utility functions used in various parts of the app.

The (two) main views used in the app: public / private. Also contains "internal" coupled components for those two views.

## `/docs`

Contains all the platform's documentation, written in markdown with additional VuePress formatting.

## `/packages`

The various sub-packages of the platform. Including the SDK, the file-storage adapters, title formatter, etc.
The various sub-packages of the platform. Including the file-storage adapters, schema, specs, etc.

## `/tests`

Expand Down
58 changes: 35 additions & 23 deletions contributing/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ version of Directus.
You can use the JavaScript tool manager [volta](https://volta.sh/) to automatically install the current node and npm
versions.

You will also need to have the package manager [pnpm](https://pnpm.io/) installed. You can install pnpm using the
following command: `npm install -g pnpm`.

:::

## 1. Fork the Directus repository
Expand All @@ -35,8 +38,8 @@ git checkout -b YOUR-BRANCH-NAME
## 4. Install the dependencies and build the project

```bash
npm install
npm run build
pnpm install
pnpm build
```

## 5. Create a `.env` file
Expand All @@ -53,25 +56,41 @@ To start the initialization run the following command:

```bash
# From within the root of the project
npm run cli bootstrap
pnpm cli bootstrap

# For SQLite you need to run the command in the 'api' context (to ensure the database file is created in the right directory)
npm run cli bootstrap --workspace=api
pnpm --dir api cli bootstrap
```

This will set-up the required tables for Directus and make sure all the migrations have run.

## 7. Start the development server

First you need to choose what packages you want to work on. Then, you should run the `dev` script on that package. You
can see their names and list of scripts in their related `package.json`. Example of running APP:
You can run all packages in development with the following command:

```bash
pnpm dev
```

::: warning Race Conditions

When running multiple or all packages, sometimes `ts-node` may not start up the API properly because of race conditions
due to changes happening to other packages. You can either rerun the command to restart the API or opt to choose what
packages to work on as described below.

:::

If you wish to choose what packages to work on, you should run the `dev` script for that package. You can see their
names and list of scripts in their related `package.json`.

Example of running the Api only:

```bash
npm run dev -w @directus/app
pnpm --filter directus dev
```

If you want to work on multiple packages at once, you should create a new instance of your terminal for each package:
Example of running Api, App:
If you want to work on multiple packages at once, you should create a new instance of your terminal for each package.
Example of running both the Api and App at the same time:

<table>
<tr>
Expand All @@ -86,14 +105,14 @@ Example of running Api, App:
<td>

```bash
npm run dev -w directus
pnpm --filter directus dev
```

</td>
<td>

```bash
npm run dev -w @directus/app
pnpm --filter @directus/app dev
```

</td>
Expand All @@ -102,19 +121,12 @@ npm run dev -w @directus/app

---

To work on the Documentation (public website version), you should navigate to the `docs` directory and run the following
command:
To work on the Documentation (public website version), you should clone the
[`directus/docs`](https://github.com/directus/docs) repository and run the following command:

```bash
npm install
```

<sup>ℹ This is necessary because the way vue-server-renderer imports vue</sup>

Then you should run

```bash
npm run dev:site
npm run dev
```

::: tip
Expand Down Expand Up @@ -143,7 +155,7 @@ Install [Docker](https://docs.docker.com/get-docker/) and ensure that the servic

```bash
# Ensure that you are testing on the lastest codebase
npm run build
pnpm build

# Clean up in case you ran the tests before
docker compose -f tests/docker-compose.yml down -v
Expand All @@ -152,5 +164,5 @@ docker compose -f tests/docker-compose.yml down -v
docker compose -f tests/docker-compose.yml up -d --wait

# Run the tests
npm run test:e2e
pnpm test:e2e
```

0 comments on commit e1fc683

Please sign in to comment.