Skip to content

Commit dbf80ff

Browse files
authored
chore: upgrade to Featurevisor v2.0 (#6)
1 parent 4931618 commit dbf80ff

File tree

10 files changed

+1192
-712
lines changed

10 files changed

+1192
-712
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
3838
- name: Upload to Cloudflare Pages
3939
run: |
40-
echo "<html><body>It works.</body></html>" > dist/index.html
41-
npx wrangler pages deploy dist --project-name="featurevisor-example-cloudflare"
40+
echo "<html><body>It works.</body></html>" > datafiles/index.html
41+
npx wrangler pages deploy datafiles --project-name="featurevisor-example-cloudflare"
4242
env:
4343
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
4444
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ npm-debug.log*
44
.DS_Store
55

66
dist
7+
datafiles
78
out

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,23 @@ $ npm install --save @featurevisor/sdk
2222
Then use it in your application:
2323

2424
```js
25-
import { createInstance } from '@featurevisor/sdk';
25+
import { createInstance } from "@featurevisor/sdk";
26+
27+
const DATAFILE_URL =
28+
"https://featurevisor-example-cloudflare.pages.dev/production/datafile-tag-all.json";
29+
30+
const datafileContent = await fetch(DATAFILE_URL).then((res) => res.json());
2631

2732
const sdk = createInstance({
28-
datafileUrl: 'https://featurevisor-example-cloudflare.pages.dev/production/datafile-tag-all.json',
33+
datafile: datafileContent,
2934
});
3035
```
3136

37+
Learn more about [SDK usage here](https://featurevisor.com/docs/sdks/javascript/).
38+
3239
## Installation
3340

34-
Since this example app lives outside of the Featurevisor [monorepo](https://github.com/fahad19/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.
41+
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.
3542

3643
```
3744
$ npm ci
@@ -42,19 +49,21 @@ $ npm ci
4249
### Lint YAMLs
4350

4451
```
45-
$ npm run lint
52+
$ npx featurevisor lint
4653
```
4754

4855
### Build datafiles
4956

5057
```
51-
$ npm run build
58+
$ npx featurevisor build
5259
```
5360

61+
Checkout output in `datafiles` directory.
62+
5463
### Test features
5564

5665
```
57-
$ npm test
66+
$ npx featurevisor test
5867
```
5968

6069
## Cloudflare

attributes/country.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
archived: false
21
description: country code in lower case (two lettered)
32
type: string

attributes/deviceId.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
description: Device ID
22
type: string
3-
capture: true

attributes/userId.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
description: User ID
22
type: string
3-
capture: true

features/baz.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ tags:
44

55
bucketBy: userId
66

7-
environments:
7+
rules:
88
staging:
9-
rules:
10-
- key: "1"
11-
segments: "*"
12-
percentage: 100
9+
- key: everyone
10+
segments: "*"
11+
percentage: 100
1312
production:
14-
rules:
15-
- key: "1"
16-
segments: "*"
17-
percentage: 80
13+
- key: everyone
14+
segments: "*"
15+
percentage: 80

features/my_feature.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ tags:
44

55
bucketBy: deviceId
66

7-
environments:
7+
rules:
88
staging:
9-
rules:
10-
- key: "1"
11-
segments: "*"
12-
percentage: 100
9+
- key: everyone
10+
segments: "*"
11+
percentage: 100
1312
production:
14-
rules:
15-
- key: "1"
16-
segments: "*"
17-
percentage: 100
13+
- key: everyone
14+
segments: "*"
15+
percentage: 100

0 commit comments

Comments
 (0)