Skip to content

rankingdigitalrights/index2022

Repository files navigation

Ranking Digital Rights - 2022 Corporate Accountability Index

Surveying internet and telecommunications companies on user privacy and freedom of expression

Setup Development Environment

Make sure to have a recent version of NodeJS. This project is developed using NodeJS 14.

Once NodeJS is setup install all dependencies:

npm install

I want to do ...

There are a few common tasks that developers and administrators of this website want to commonly do. This is a summary of each of these tasks and recipes on how to them. All of those tasks are executed on the terminal. Please see Setup Development Environment and make sure the environment and dependencies are set up.

Update the site data

  1. Fetch the latest version.
  2. Run yarn data to regenerate the complete data structures for the website. See below for more information.
  3. Commit data changes.
  4. Optionally: Run the local development server to verify the changes are working as expected.
  5. Deploy website.

The yarn data commands regenerates the complete data structure for the website. This is usually the command you want to call. The yarn data command is a wrapper for several more specialized commands that each generate a different aspect of the website data.

  • The index raw data are stored in different CSV files in ./csv. The yarn data:csv command generates JSON data that can be used by the website.
  • Narrative content is stored on Google Docs. To only update the narrative content run yarn data:google.

Calling yarn data is equivalent to calling each of the specialized data commands individually.

Update HTML meta tags

  1. Fetch the latest version.
  2. Edit data/html-meta.json and update fields as needed. The file is in JSON format and consists of keys and values. Each key generates one entry in the HTML <head> section in the form of <meta name="<key>" content="<value>" />. The only required keys in this file are title and description. The other keys are taken as they are.
  3. Commit data changes.
  4. Optionally: Run the local development server to verify the changes are working as expected.
  5. Deploy website.

Fetch the latest version

git pull
yarn install

Commit data changes

git add data
git commit -m "update website data"
git push

Deploy website

The website can be deployed to staging or to production. The deploy works such that it builds the complete website locally on your own computer and then copies your version of the website to the remote server.

Deploy to staging

yarn deploy

Deploy to production

Use the -p flag to deploy to production instead.

yarn deploy -p

Run the local development server

yarn dev

Open http://localhost:3000/index2022 with your browser to see the result.

Verify code quality

yarn verify

This will run yarn lint and yarn type-check.

Start Storybook

There is a Storybook for UI component development.

yarn storybook

The Storybook is accessible at http://localhost:6006.

Other bits and pieces

indexctl

The bin/indexctl.ts script provides operational support for the index 2020. The command can be invoked with yarn indexctl. See all available commands by calling yarn indexctl -h.