Skip to content

CLI

@sevigram/loom-cli provides the loom command. Storefronts made with npm create @sevigram/loom already include it, with an npm run check script.

To add it to another project:

Terminal window
npm install --save-dev @sevigram/loom-cli
Terminal window
npx loom check # reads ./.env
npx loom check --env .env.production

It checks, one line each:

  • SEVIGRAM_STOREFRONT_TOKEN is set and starts with sfpub_, and the optional SEVIGRAM_STOREFRONT_PRIVATE_TOKEN starts with sfprv_. Swapped tokens are called out.
  • SEVIGRAM_API_BASE_URL, which defaults to https://api.sevigram.com/storefront/v1, targets API v1.
  • APP_ORIGIN is set, and the API accepts the public token from that origin.
  • The API accepts the private token, when one is set.

Variables already in the environment win over the file. Tokens are never printed beyond their first 10 characters.

The exit code is 0 when every check passes and 1 otherwise, so you can run it in CI before you deploy.

When a check fails, it says what to do in plain words, for example “add http://localhost:5173 to allowed origins”. For other API errors it prints the HTTP status and error code.