Example Featurevisor project using Cloudflare Pages.
For more documentation, visit featurevisor.com.
The generated target datafiles from this repository are available at these URLs:
production: https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-tag-all.jsonstaging: https://featurevisor-example-cloudflare.pages.dev/staging/featurevisor-tag-all.json
Install the SDK in your application:
npm install @featurevisor/sdkThen use it in your application:
import { createFeaturevisor } from "@featurevisor/sdk";
const DATAFILE_URL =
"https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-tag-all.json";
const datafileContent = await fetch(DATAFILE_URL).then((res) => res.json());
const sdk = createFeaturevisor({
datafile: datafileContent,
});Learn more about SDK usage here.
npm cinpx featurevisor lintnpx featurevisor buildReview the output in the datafiles directory.
npx featurevisor testnpx featurevisor catalogFor this example, we are going to be uploading to and serving our datafiles from Cloudflare Pages.
Make sure you already have a Cloudflare Pages project set up, and then use it in the publish workflow.
This example project is configured to run its CI/CD pipeline with GitHub Actions.
You can use another CI/CD provider if preferred.
Make sure you have Read and write permissions enabled in your GitHub repository's Settings > Actions > General > Workflow permissions section.
You can find the GHA workflow files in .github/workflows directory.
checksworkflow: runs against non-master(non-main) branchespublishworkflow: runs againstmaster(main) branch
Follow the Cloudflare guide and add these secrets under Settings > Secrets and variables > Actions:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN
MIT © Fahad Heylaal