### StandardJS Linting Setup Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Instructions for setting up StandardJS for linting, including installing necessary IDE plugins and global packages for ES7 features. ```javascript // For linting we use StandardJS. It's recommended that you install the necessary IDE plugin. // Since this repo uses ES7 features, you'll need a global install of both the standard and babel-eslint packages. ``` -------------------------------- ### Build and Start Local Servers Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Commands to build Docker images for local servers and then start them. ```bash npm run docker-build npm run docker-up ``` -------------------------------- ### Project Setup Scripts Source: https://github.com/brave-intl/bat-ledger/blob/master/test/secrets/README.md This snippet shows the commands to run for setting up the project. It includes removing old files, creating new certificates, and generating client configurations. ```bash rm broker1* consumer*kafka* snakeoil-ca* ./create-certs.sh ./generate-client.sh ``` -------------------------------- ### npm Install with Ignored Scripts Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Instructions for performing an npm install while ignoring postinstall scripts, which may be necessary in certain environments. ```sh # npm install you may also have to use npm without running the postinstall scripts. use the `--ignore-scripts` flag. ``` -------------------------------- ### Prepare .env file Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Steps to prepare the .env file for local development, including copying the example and ensuring variables match CI configuration. ```sh # Prepare .env file 1. Copy example over: `cp .env.example .env`. 2. Confirm .env vars match the contents of `.github/workflows/ci.yaml` section `env`. 3. Fill in the remaining `{CHANGE_ME}` .env vars appropriately; please consult your local BAT dev to find the answers. ``` -------------------------------- ### Debugging with Node Inspector Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Command to start the eyeshade-web service with Node.js inspector enabled, allowing remote debugging on port 9229. ```bash docker-compose run --rm -p 9229:9229 eyeshade-web npm run start-eyeshade -- --inspect=0.0.0.0 ``` -------------------------------- ### Add Surveyor Contribution Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Example using curl to POST a surveyor contribution to the ledger service API. Requires an authorization token and specific JSON payload. ```sh curl -X POST --header 'Authorization: Bearer foobarfoobar' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"adFree":{"fee":{"USD":5},"votes":50,"altcurrency":"BAT","probi":"27116311373482831368"}}' 'http://127.0.0.1:3001/v2/surveyor/contribution' ``` -------------------------------- ### Running Ava Tests Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Commands for executing tests using the Ava test runner, both locally and within Docker containers. Includes passing arguments to Ava. ```bash # Running Individual tests `bat-ledgers` is executing tests using `ava` which can be executed via `npm run ava` and the requires args for any individual test can be passed to the command using `npm` scripts args syntax. See below: npm run ava -- -v -s eyeshade/workers/referrals.test.js Or, if invoking the container externally, docker-compose run --rm -p 9229:9229 eyeshade-web npm run ava -- -v -s test/eyeshade/suggestions.integration.test.js ``` -------------------------------- ### Running Docker Compose Services Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Commands to manage Docker Compose services for the bat-ledger project. This includes bringing up all services, specific services, running in the background, and stopping services. ```bash # To bring up all the services : docker-compose up # Logs from all services presented interleaved, you can press ctrl-c to stop. # Ledger listens on port 3001, eyeshade on 3002, and balance on 3003 # Note you can run any subset of services (e.g. only eyeshade) docker-compose up eyeshade-web eyeshade-consumer # You can also launch and run services in the background docker-compose up -d eyeshade-web eyeshade-consumer # And stop running background services with docker-compose stop ``` -------------------------------- ### Run Tests with Docker Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Command to execute all tests within the Docker environment. ```bash npm run docker-test ``` -------------------------------- ### Postgres Migrations Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Commands to manage database schema migrations using Docker. This includes applying all pending migrations and reverting a specific migration. ```bash # You can run all migrations to upgrade the schema to the latest version using: npm run docker-migrate-up # You can reverse a particular migration by running: npm run docker-migrate-down -- migrations/0001_transactions/down.sql ``` -------------------------------- ### Docker Compose Network Configuration Source: https://github.com/brave-intl/bat-ledger/blob/master/README.md Configuration snippet to allow other Docker containers to join the 'ledger' network for inter-container communication. ```yaml networks: ledger: external: true ``` -------------------------------- ### Disallow All Crawling Source: https://github.com/brave-intl/bat-ledger/blob/master/static/robots.txt This configuration disallows all web crawlers from accessing any part of the project. It is typically used for private or sensitive repositories. ```robots User-agent: * Disallow: / ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.