Skip to content

Commit

Permalink
migrate to npm, improve dev instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodingwizard committed Feb 10, 2024
1 parent dc5a97a commit 5c25a81
Show file tree
Hide file tree
Showing 4 changed files with 8,292 additions and 5,020 deletions.
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ This IDE is built and maintained by [Nathan Wang](https://github.com/thecodingwi

## Running Locally

This project uses the [Firebase Realtime Database](https://firebase.google.com/docs/database). [This tutorial](https://firebase.google.com/codelabs/firestore-web) is helpful (even though Cloud Firestore is not what's being used here). You'll need to install the [firebase CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli) and [Yarn](https://classic.yarnpkg.com/en/docs/install).
This project uses the [Firebase Realtime Database](https://firebase.google.com/docs/database). [This tutorial](https://firebase.google.com/codelabs/firestore-web) is helpful (even though Cloud Firestore is not what's being used here). You'll need to install the [firebase CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli) and Node.js 18.

```
yarn install
FIREBASE_AUTH_EMULATOR_HOST="127.0.0.1:9099" yarn dev
# in a separate tab. make sure you are using emulators iff SHOULD_USE_FIREBASE_EMULATOR is true!
firebase emulators:start
npm install
npm run dev
```

Note that FIREBASE_AUTH_EMULATOR_HOST must be set; otherwise you'll get a "Firebase ID token has no kid claim" error message when a nextjs function tries to decode a firebase auth token.

Also, if you do not want to run the yjs server locally, or if you don't want to use firebase emulators, edit `src/dev_constants.ts`.
`npm run dev` will start a Firebase emulator for you. By default, the dev server uses a local firebase emulator and the production YJS server. To change these settings, edit `src/dev_constants.ts`.

Note: If you get a firebase emulators timeout error on Mac, see [firebase/firebase-tools#2379 (comment)](https://github.com/firebase/firebase-tools/issues/2379#issuecomment-951884721) and Issue #67 in this repo.

### Playwright Tests

```
yarn playwright test
npm run dev # Start the dev server in a separate terminal
npm run test
```

We use Playwright for our e2e tests. The VSCode extension for Playwright can be useful for debugging tests.

### Configuring Firebase

You can update the Firebase configuration (if you want to use a custom firebase project, for example) by modifying `pages/_app.tsx`.
Expand Down Expand Up @@ -254,10 +253,6 @@ cp -r ./node_modules/monaco-editor-workers/dist/workers/editorWorker* ./public/m

This is used by MonacoEditor.tsx (Monaco uses web workers).

### Playwright Debugging

We use the [Playwright Test test runner](https://playwright.dev/docs/intro), not the Playwright library. If you use VSCode, the Playwright Test test runner extension for VSCode is really nice.

### Troubleshooting `firebase emulators:exec`

If `firebase emulators:exec` fails for unknown reason, try running `firebase emulators:exec "yarn playwright test" || cat firebase-debug.log`.
Expand Down
Loading

0 comments on commit 5c25a81

Please sign in to comment.