From 3bf64a5c307a79e200bab542a0ca62aef139cd06 Mon Sep 17 00:00:00 2001 From: Anissa Chadouli Date: Thu, 7 Sep 2023 20:02:05 +0900 Subject: [PATCH] docs: update instructions for emulator (#248) * docs: update instructions for emulator Prior to this commit some devs were experiencing problems with the seeds not appearing in the emulator. This adds instructions to the README to solve this problem. * feat: add project id to scripts package.json In previous commit I added a command when seed data was not visible in emulator to the README, but it was better to just add this to the scripts --- README.md | 37 +++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index be605e6b..97d8fd32 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,10 @@ We love and welcome contributions to our front-end repository which can be found ## Prerequisites -- [Node](https://nodejs.org) - - We recommend using [nvm](https://github.com/nvm-sh/nvm) and running `nvm use` in this directory to sync with the project's Node version. However, if you wish to install Node your own way and ensure a consistent version with `.nvmrc`, that's fine too -- [Yarn Berry](https://yarnpkg.com/getting-started/install) -- [Docker Desktop](https://www.docker.com/products/docker-desktop/) +- [Node](https://nodejs.org) + - We recommend using [nvm](https://github.com/nvm-sh/nvm) and running `nvm use` in this directory to sync with the project's Node version. However, if you wish to install Node your own way and ensure a consistent version with `.nvmrc`, that's fine too +- [Yarn Berry](https://yarnpkg.com/getting-started/install) +- [Docker Desktop](https://www.docker.com/products/docker-desktop/) # Setup @@ -75,10 +75,13 @@ npm -g i firebase-tools #### a.2 Install Java on a mac, we recommend using [homebrew](https://brew.sh/) + ```sh brew install java ``` + on a windows pc, we recommend using [chocolatey](https://chocolatey.org/) + ```sh choco install java ``` @@ -103,6 +106,12 @@ Select "Use an existing project" yarn dev:startlocaldb ``` +### 3.c Starting the dev server and seeding the emulator + +```sh +yarn dev +``` + This will run until you shut down the instance hitting `ctrl^+C` ### (Optional) Connecting to Production database @@ -140,7 +149,7 @@ yarn prod This runs locally and can easily be debugged with vscode! Click on the `Run and Debug` vscode tab, and then choose `Javascript Debug Terminal`, then run `yarn dev` in there and the debugger will automatically connect. -Then, just add breakpoints by clicking on the line number of your code. +Then, just add breakpoints by clicking on the line number of your code. # How to Test your code @@ -153,17 +162,17 @@ Then, just add breakpoints by clicking on the line number of your code. npm install jest --global ``` - 2. Start the Docker container: +2. Start the Docker container: - ```sh - yarn test:dockerstart - ``` - - 3. Run the tests: +```sh +yarn test:dockerstart +``` - ```sh - yarn test - ``` +3. Run the tests: + +```sh +yarn test +``` diff --git a/package.json b/package.json index 3ff69c59..08c31edb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "yarn && yarn generate && yarn dev:startserver", "dev:startserver": "ts-node-dev --transpile-only --no-notify --exit-child src/index.ts", - "dev:startlocaldb": "firebase login && firebase emulators:start --only firestore", + "dev:startlocaldb": "firebase login && firebase --project=find-a-doc-japan emulators:start --only firestore", "test": "jest --runInBand --detectOpenHandles --forceExit --setupFiles", "test:dockerstart": "docker-compose -f 'docker/docker-compose-test.yml' up -d --build", "test:dockerstop": "docker-compose -f 'docker/docker-compose-test.yml' down",