Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Checks

on:
pull_request:
push:
branches-ignore:
- main
- master
branches-ignore: [main, master]

permissions:
contents: read

jobs:
ci:
name: Checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/setup-node@v4
- uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ on:
- main
- master

permissions:
contents: write

jobs:
ci:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/setup-node@v4
- uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ npm-debug.log*
dist
datafiles
out
catalog
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# featurevisor-example-cloudflare

Example Featurevisor project utilizing [Cloudflare Pages](https://developers.cloudflare.com/pages).
Example Featurevisor project using [Cloudflare Pages](https://developers.cloudflare.com/pages).

For more documentation, visit https://featurevisor.com.
For more documentation, visit [featurevisor.com](https://featurevisor.com).

## Accessing datafiles

The generated datafiles from this repository is accessible via these URLs:
The generated target datafiles from this repository are available at these URLs:

- `production`: https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-tag-all.json
- `staging`: https://featurevisor-example-cloudflare.pages.dev/staging/featurevisor-tag-all.json
Expand All @@ -15,21 +15,21 @@ The generated datafiles from this repository is accessible via these URLs:

Install the SDK in your application:

```
$ npm install --save @featurevisor/sdk
```sh
npm install @featurevisor/sdk
```

Then use it in your application:

```js
import { createInstance } from "@featurevisor/sdk";
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 = createInstance({
const sdk = createFeaturevisor({
datafile: datafileContent,
});
```
Expand All @@ -38,32 +38,36 @@ Learn more about [SDK usage here](https://featurevisor.com/docs/sdks/javascript/

## Installation

Since this example app lives outside of the Featurevisor [monorepo](https://github.com/featurevisor/featurevisor), you are recommended to make sure [`package.json`](./package.json) has the latest version of [`@featurevisor/cli`](https://www.npmjs.com/package/@featurevisor/cli) package.

```
$ npm ci
```sh
npm ci
```

## Usage

### Lint YAMLs

```
$ npx featurevisor lint
```sh
npx featurevisor lint
```

### Build datafiles

```
$ npx featurevisor build
```sh
npx featurevisor build
```

Checkout output in `datafiles` directory.
Review the output in the `datafiles` directory.

### Test features

```sh
npx featurevisor test
```
$ npx featurevisor test

### Explore the Catalog

```sh
npx featurevisor catalog
```

## Cloudflare
Expand All @@ -76,7 +80,7 @@ Make sure you already have a Cloudflare Pages project set up, and then use it in

This example project is configured to run its CI/CD pipeline with [GitHub Actions](https://github.com/features/actions).

You are free to choose any other CI/CD provider of your choice.
You can use another CI/CD provider if preferred.

### Settings

Expand All @@ -91,7 +95,7 @@ You can find the GHA workflow files in [`.github/workflows`](./.github/workflows

### Secrets

Follow the guide [here](https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/), and set up these two secrets in your GitHub repository's `Settings > Secrects and variables > Actions` section:
Follow the [Cloudflare guide](https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/) and add these secrets under `Settings > Secrets and variables > Actions`:

- `CLOUDFLARE_ACCOUNT_ID`
- `CLOUDFLARE_API_TOKEN`
Expand Down
Loading