Forms for meshdb. Live version hosted at https://forms.nycmesh.net/
This repo currently powers three separate forms:
You will either need a copy of meshdb
running locally, or point your local copy of this package to the beta/production
endpoints in order to do development:
https://devdb.nycmesh.net
as the value for MESHDB_URL
http://127.0.0.1:8000
for MESHDB_URL
To get started with this package, first, create your own copy of the .env
file:
cp .env.sample .env
Edit the MESHDB_URL
value based on your choice above in your favorite text editor. For example:
nano .env
# Press Ctrl-X and then y to exit
Next run the following commands to run the nextjs app on your local machine:
npm install
npm run dev
Finally, open http://127.0.0.1:3000
in your web browser to interact with your copy of the application
We use Prettier for formatting our code. There is a GitHub check that will get mad at you if you don't format your code correctly.
To appease it, run npx prettier . --write
[!WARNING]
Make sure you run playwright from the root of the repo, otherwise you will get some errors about invalid URLs.
We use playwright
to do integration tests. You can run them with the following instructions:
Setup a dev instance of meshdb
Copy .env.sample
into .env.local
(.env
will not work!) and fill it out
Run the integration tests with npx playwright test
Run with npx playwright test --ui
to get a nice UI to see your tests with.
https://playwright.dev/docs/running-tests#run-tests-in-ui-mode
Playwright will show you the browser window it is using with --headed
,
and you can pause a test to examine the browser by inserting page.pause()
in your test.
To run a specific test, you can use -g
:
npx playwright test -g 'missing name'
See the docs for more information about playwright.
If you get an error like this one:
[WebServer] [Error: ENOENT: no such file or directory, open '/home/wilnil/Code/nycmesh/meshforms/.next/BUILD_ID'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/wilnil/Code/nycmesh/meshforms/.next/BUILD_ID'
}
Error: Process from config.webServer was not able to start. Exit code: 1
Try running npm run build
[!NOTE] Do you speak a language besides English? Please help us by adding more languages, validating our existing translations, or translating more of Meshforms!
We use next-intl
as a library for internationalization.
To add a new language:
messages/
directorymiddleware.ts
and src/i18n/routing.ts
src/i18n/request.ts
messages/
directory (this one: "locale": "{locale, select, en {🇺🇸 English} es {🇪🇸 Español} fr {🇫🇷 Français} ht {🇭🇹 Haitian Creole} zh {🇨🇳 中文} other {Unknown}}"
)[!WARNING] Please keep the language codes alphabetical!
Thank you for your contributions!