Code for the Montana Free Press 2024 Election Guide.
This is a Next.js project.
-
To access the webservice locally run
npm run dev
and navigate tolocalhost:3000/election-guide-2024/
-
Set in
DistrictFinder.js
to use AWS CORS proxy deployment -
Can use CORS proxy locally
- Change
BASE_URL
tolocalhost:3000
(Don't forget to change it back) - Start the CORS proxy service first
- Start this service with
npm run dev
as normal (will start on port 3001 instead) and navigate tolocalhost:3001/election-guide-2024/
- Change
input
- Data pipelines for gathering structured information for the guideprocess
- Data processing code that bundles inputs into data for displaysrc
- Code for Next.js-based static web app using processsed data (page templates, components, styling, etc.)public
- Images and other static content
-
To update all YAML files (so the page updates) run
./update-data.sh
in the command line.# Data pipline updates node inputs/fec/fetch.js node inputs/coverage/fetch.js node process/legislative-candidates.js node process/main.js node process/make-candidate-list.js
-
To update, build and deploy to AWS, run
./build-and-update.sh
in the command line.#!/bin/sh # Set Node version # export NVM_DIR=$HOME/.nvm; # source $NVM_DIR/nvm.sh; # nvm use --lts # Use latest Node.js version # Data pipeline updates node inputs/fec/fetch.js node inputs/coverage/fetch.js node process/legislative-candidates.js node process/main.js node process/make-candidate-list.js # Build npm run build # Deploy aws s3 sync build s3://apps.montanafreepress.org/election-guide-2024 --delete aws cloudfront create-invalidation --distribution-id E3LVPS3XLJHLL5 --paths "/election-guide-2024/*"