This repository houses the NOMO Nouns project, including the nomo-nouns-webapp located in the packages
folder. The project uses Lerna for managing multiple packages, including the web application. Follow these instructions to set up, clean, and run the project in various modes.
To initialize the environment, install all dependencies by running:
yarn
If you encounter issues or need to reset the environment, you can clean up with the following commands:
-
Remove
node_modules
(both in the root and all packages):find . -name "node_modules" -type d -exec rm -rf {} +
-
Clear Only Vite Cache Files (in all package
node_modules
directories):find . -path "*/node_modules/.cache/vite" -type d -exec rm -rf {} +
-
Clear Yarn Cache:
yarn cache clean
After performing these steps, you can start fresh by re-running yarn
or yarn install
.
The project supports different modes, which can be run as described below.
To run the project in dev mode, connecting to the Firebase dev database (nomo-nouns-dev
), use:
npx lerna run dev --scope=nomo-nouns-webapp
To run in local emulator mode with the Firebase database set to use a local export file:
-
Start the Firebase emulators with the database import option:
firebase emulators:start --project demo-nomo-nouns --import="packages/nomo-nouns-webapp/fixtures/database_export"
-
Then, in a separate terminal window, start the web app with:
npx lerna run dev:emulator --scope=nomo-nouns-webapp
In this mode, the Firebase emulator will utilize the demo-nomo-nouns
configuration and the specified local export file.
To run the project in preview mode, which uses the Firebase dev database, use (this is also set as default):
npx lerna run dev --scope=nomo-nouns-webapp --mode preview
The Firebase configuration and project aliases are specified in the .firebaserc
file:
{
"projects": {
"default": "nomo-nouns-dev",
"dev": "demo-nomo-nouns",
"preview": "nomo-nouns-dev",
"prod": "nomo-nouns-prod"
}
}
- default and preview: Use the
nomo-nouns-dev
database on Firebase. - dev: Uses the
demo-nomo-nouns
configuration for local emulator mode.
Lerna is configured to manage packages in the packages
folder. The lerna.json
configuration includes:
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}
- Custom
@nomonouns/assets
Package: This project uses a forked version of the@nouns/assets
package, maintained by Benbodhi, found here. This package is included as@nomonouns/assets
and serves as a custom asset handler for the project. You can choose to use this npm package or the original@nouns/assets
package in your own project. We decided to maintain our own so we can integrate new nouns traits as soon as they're added to the protocol.
-
To verify project installation:
firebase projects:list
-
To set a Firebase project alias, use:
firebase use --add <alias>
Replace <alias>
with the appropriate project alias as defined in .firebaserc
.
If you experience issues with Firebase authentication, caching, or data loading, consider the following:
-
Clear Firebase CLI Cache (if authentication issues arise):
firebase logout firebase login
-
Ensure Project Aliases Are Correct: Verify that the Firebase project aliases in
.firebaserc
match the intended configurations. -
Run Emulator UI: Access the Firebase emulator UI at
http://127.0.0.1:5005
when running emulators. -
Check Emulator Logs: Logs for the Firebase database and functions emulators can be found in
database-debug.log
andui-debug.log
within the emulator session.
For detailed debugging information, check firebase-debug.log
for errors related to the CLI and emulators.