This project, data-checks
, contains several scripts to help you with creating, deploying, and generating Cloudflare based functions to run checks on our data consistency. Below are instructions on how to use the repo.
Node.js and npm.
The following scripts are defined in the package.json
file:
To create a new data check, run the following command:
npm run create <name>
<name>
: Replace<name>
with the desired name of your data check directory.
This script will:
- Create a new directory under the
src
folder named after the provided<name>
. - Copy templates into the new directory.
- Replace placeholder text in
package.json
andwrangler.toml
files with the<name>
. - Install the necessary npm dependencies for the new data check.
- Generate necessary Cloudflare types.
To deploy your data check, run the following command:
npm run deploy
This script will execute the deploy.sh
script located in the scripts
directory.
To generate the necessary Cloudflare types, run the following command:
npm run cf-typegen
This script will execute the typegen.sh
script located in the scripts
directory.
data-checks/
├── package.json
├── scripts/
│ ├── create.sh
│ ├── deploy.sh
│ └── typegen.sh
└── src/
└── <name>/
├── package.json
└── wrangler.toml
To add variables to the data check, like DUNE API KEY, add them to the KV store defined in the add_env.sh script. The script will add the variables to the KV store, which will be accessible in the data check function.
- Ensure that the
scripts
folder contains all required script files:create.sh
,deploy.sh
, andtypegen.sh
. - The
<name>
placeholder in the scripts will be replaced with the actual name you provide when you run thenpm run create <name>
command.
Feel free to contribute to the project or report any issues you encounter.