- Make sure the
DEBUGenvironment variable is set toTrueso that Django and Docker serve updated compiled files correctly. - Run
docker-compose upfrom the root of the codebase (not from./frontend). - Develop as usual.
- SCSS files are located in
./foundation_cms/static/scss. - These are automatically compiled into
.cssfiles as part of the build process.
- The frontend is composed of two yarn workspaces defined in a root
package.jsonfile. The two workspaces are located infrontend/legacyandfrontend/redesign. Runningyarncommands from the root will trigger the root scripts defined in the rootpackage.jsonand are helper scripts defined to run for all workspaces. To runyarncommands from an individual workspace, you cancdinto the workspace, or you can use workspace syntax from the root directory (for exapmle:yarn workspace redesign lint)
From the ./frontend/redesign directory:
- Run
yarn lintto check JavaScript and SCSS files for linting errors.
To lint separately:
- Run
yarn lint:jsto check JavaScript files for linting errors. - Run
yarn lint:scssto check SCSS files using Stylelint.
From the ./frontend/redesign directory:
- Run
yarn fixto automatically fix JavaScript and SCSS linting errors.
To fix them separately:
- Run
yarn fix:jsto automatically fix fixable linting issues using ESLint. - Run
yarn fix:scssto automatically fix SCSS linting issues.
We use Prettier to enforce consistent code formatting.
From the ./frontend/redesign directory:
- Run
yarn check-formatto check whether JavaScript and SCSS files are correctly formatted.
To check them separately:
- Run
yarn format:jsto check whether JavaScript files are correctly formatted. - Run
yarn format:scssto check whether SCSS files are correctly formatted.
We use Prettier to enforce consistent code formatting.
From the ./frontend/redesign directory:
- Run
yarn formatto automatically format JavaScript and SCSS files.
To format them separately:
- Run
yarn format:jsto automatically format JS code - Run
yarn format:scssto automatically format SCSS code
Similar to the Mozilla Festival site, the fake data generator can generate a site structure for the Donation site that can be served under it's own domain.
For local development, the donate site can be found at donate.localhost:8000.
As this is REST API and CMS built on top of Django, there are some "gotcha!"s to keep in mind due to the high level of magic in the Django code base (where things will happen automatically without the code explicitly telling you).
The DEBUG flag does all sorts of magical things, to the point where testing with debugging turned on effectively runs a completely different setup compared to testing with debugging turned off. When debugging is on, the following things happen:
- Django bypasses the
ALLOWED_HOSTrestrictions, which again can lead to400 Bad Requesterrors inDEBUG=Falsesetting. - Rather than HTTP error pages, Django will generate stack traces pages that expose pretty much all environment variables except any that match certain substrings such as
KEY,PASS, etc. for obvious security reasons. - ...there are probably more gotchas just for
DEBUGso if you find any please add them to this list.
Translations of UI strings (from the Django and React apps) are stored in the fomo-l10n repository. Translations are happening in Pontoon, in multiple projects: Foundation website, *Privacy Not Included and Mozilla Festival.
The latest source strings are regularly exposed to Pontoon by a Localization PM using the following process:
- Clone the
fomo-l10nrepository locally. - Set the
LOCAL_PATH_TO_L10N_REPOvariable in your.envfile. Use the absolute path to your copy of thefomo-l10nrepository and include the trailing slash. E.g.LOCAL_PATH_TO_L10N_REPO=/Users/username/Documents/GitHub/fomo-l10n/
- Make sure your local repositories of
fomo-l10nandfoundation.mozilla.orgare matching the latest revision from main. - Run
inv docker-makemessagesfrom yourfoundation.mozilla.orgrepository. - Files should have been updated in your
fomo-l10nrepository. You can now create a pull-request.
Latest translations are uploaded to S3. To get them, run:
curl -o translations.tar https://foundation-site-translations.s3.amazonaws.com/translations.tartar -C foundation_cms -xvf translations.tar
You don't need to run compilemessages and it works for both pipenv or docker workflows.
The translations_github_commit_[...] file from the archive is only used for debug purposes on Heroku. It can be safely deleted if needed.
We love contributors, but the team maintaining this project is small and not structured to significantly support new and inexperienced contributors. If there's an unassigned issue that catches your eye, feel free to open a PR for it, but keep in mind our support will be limited. We usually don't have the capacity to walk you through the process of spinning up the project, opening a PR or describing what the solution to the issue could be.