Example Featurevisor project utilizing Cloudflare Pages.
For more documentation, visit https://featurevisor.com.
The generated datafiles from this repository is accessible via these URLs:
production
: https://featurevisor-example-cloudflare.pages.dev/production/datafile-tag-all.jsonstaging
: https://featurevisor-example-cloudflare.pages.dev/staging/datafile-tag-all.json
Install the SDK in your application:
$ npm install --save @featurevisor/sdk
Then use it in your application:
import { createInstance } from '@featurevisor/sdk';
const sdk = createInstance({
datafileUrl: 'https://featurevisor-example-cloudflare.pages.dev/production/datafile-tag-all.json',
});
Since this example app lives outside of the Featurevisor monorepo, you are recommended to make sure package.json
has the latest version of @featurevisor/cli
package.
$ npm ci
$ npm run lint
$ npm run build
$ npm test
For 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 are free to choose any other CI/CD provider of your choice.
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.
checks
workflow: runs against non-master
(non-main
) branchespublish
workflow: runs againstmaster
(main
) branch
Follow the guide here, and set up these two secrets in your GitHub repository's Settings > Secrects and variables > Actions
section:
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_API_TOKEN
MIT © Fahad Heylaal