Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 2.45 KB

CONTRIBUTING.md

File metadata and controls

59 lines (38 loc) · 2.45 KB

Contributing to the JavaScript client

This is a quick guide to help you contribute to the JavaScript client of Bgl Game Pot.

Getting started

Ensure you have pnpm installed and run the following command to install the client's dependencies.

pnpm install

You can then run the following commands to build, test and lint the client.

# Build the client.
pnpm build

# Test the client (requires building first).
pnpm build && pnpm test

# Test a specific file or set of files.
pnpm build && pnpm test test/somefile.test.js
pnpm build && pnpm test test/somePattern*

# Lint and/or format the client.
pnpm lint:fix
pnpm format:fix

When something changes in the program(s), make sure to run pnpm generate in the root directory, to re-generate the clients accordingly.

Publishing the JavaScript client

You can publish a new version of the JavaScript client by manually dispatching the "Publish JS Client" workflow in the GitHub Actions tab of the repository.

Click on the "Actions" tab, then on the "Publish JS Client" workflow, then on the "Run workflow" dropdown. Select your options before clicking on the final "Run workflow" button inside the dropdown body.

For this to work, some initial setup is required on the repository as explained below.

Setting up GitHub actions

To publish JavaScript clients using GitHub actions, we first need the following secret variables to be set up on the repository.

  • NPM_TOKEN — An access token that can publish your packages to NPM.
  • VERCEL_TOKEN — An access token that can deploy to Vercel.
  • VERCEL_ORG_ID — The ID of the Vercel organization you want to deploy to.

Then, we'll need to create a new GitHub environment called js-client-documentation for the generated documentation of the JavaScript client. We can then select the main branch only and add the following secret variable to this specific environment.

  • VERCEL_PROJECT_ID — The ID of the Vercel project you want to deploy to. The convention for Metaplex is to create a new Vercel project named bgl-game-pot-js-docs with the following deployment settings:

    • Build Command: pnpm run build:docs
    • Output Directory: docs
    • Install Command: pnpm install
    • Development Command: None

With all that set up, you can now run the "Publish JS Client" workflow by dispatching it from the GitHub UI.