Skip to content

mtfreepress/mt-2024-elections

Repository files navigation

Montana 2024 Elections

Code for the Montana Free Press 2024 Election Guide.

This is a Next.js project.

Local Deployment

  • To access the webservice locally run npm run dev and navigate to localhost:3000/election-guide-2024/

  • Set in DistrictFinder.js to use AWS CORS proxy deployment

  • Can use CORS proxy locally

    1. Change BASE_URL to localhost:3000 (Don't forget to change it back)
    2. Start the CORS proxy service first
    3. Start this service with npm run dev as normal (will start on port 3001 instead) and navigate to localhost:3001/election-guide-2024/

Structure

  • input - Data pipelines for gathering structured information for the guide
  • process - Data processing code that bundles inputs into data for display
  • src - Code for Next.js-based static web app using processsed data (page templates, components, styling, etc.)
  • public - Images and other static content

Helpful Commands

  • To update all YAML files (so the page updates) run ./update-data.sh in the command line.

    - This will run:

      # 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.

    - This will run:

          #!/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/*"
    

About

Montana Free Press 2024 election guide

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published