Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

chore: switch to npm workspaces #869

Merged
6 changes: 2 additions & 4 deletions .github/workflows/ci-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ jobs:
run: npm i
- name: Run linter
run: npm run lint
- name: Type check client
run: cd client && npx tsc
- name: Type check server
run: cd server && npx tsc
- name: Build client
run: npm run build:client
- name: Build server
run: npm run build:server
- name: Run local tests
run: npm t
- name:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/cypress-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ jobs:
run: |
cp .env.example .env

- name: Install Dependencies
- name: Install dependencies
run: npm i

- name: Build client and server
run: npm run build

- name: Cypress run
uses: cypress-io/github-action@v2
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
ports:
- 1025:1025
- 8025:8025

steps:
- name: Set Action Environment Variables
run: |
Expand All @@ -46,21 +46,23 @@ jobs:
run: npm i -g npm@8

- name: Set Chapter Environment Variables
run: |
run: |
cp .env.example .env
echo DB_PORT=5432 >> .env

- name: Install Dependencies
- name: Install dependencies
run: npm i

- name: Build client and server
run: npm run build

- name: Seed Database
run: npm run db:reset

- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
build: npm run build:client
start: npm start
wait-on: 'http://localhost:3000, http://localhost:5000/graphql'
config: baseUrl=http://localhost:3000
Expand Down
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,17 @@ To learn more, take a look at their [docs](https://docs.codesee.io/projects/reco

</details>

<details><summary>How do I work with dependencies?</summary>

The client and server are npm [workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces). This means that adding and removing packages work slightly differently from the usual. All that changes is that commands are run from root with the `-w=name-of-workspace` flag.

For example, to add a new `express` to the client, run `npm i -w=client express`. Similarly, to remove it, run `npm un -w=client express`.
## Updating dependencies

We rely on renovate to update dependencies automatically.

</details>

# Server-side Technical Documentation

## API Specification
Expand Down Expand Up @@ -537,7 +548,7 @@ If starting the application for the first time, or syncronizing with the latest
* sync the database - to structure by setup tables based on the schema
* seed the database - development is easier with a database full of example entities. The process of creating example entities in the database is called seeding

The `npm run db:reset` command will do all three tasks by running `npm run db:sync` and `npm run db:seed` sequentially.
The `npm run db:reset` command will do all three tasks by running `npm run db:sync` and `npm run db:seed` sequentially. It also builds the server, since `db:sync` needs the compiled JavaScript to run.

_Troubleshooting:_ If using ElephantSQL you may have to submit each of these commands individually.

Expand Down
Loading