Skip to content
Open
Show file tree
Hide file tree
Changes from 12 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
7 changes: 6 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"extends": [
"oclif",
"oclif-typescript"
]
],
"rules": {
"no-prototype-builtins": 0,
"camelcase": 0,
"unicorn/filename-case": 0
}
}
Binary file added 1 - Adding a remote config.mov
Binary file not shown.
Binary file added 2 - Creating a new flag.mov
Binary file not shown.
Binary file added 3 - Dry run removing flag.mov
Binary file not shown.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,34 @@ EXAMPLES
$ flagsmith get -p
```

_See code: [dist/commands/get/index.ts](https://github.com/Flagsmith/flagsmith-cli/blob/v0.1.4/dist/commands/get/index.ts)_

## `flagsmith generate-types [ENVIRONMENT]`

Generate a fully typed set of your project's current features.

Note: This requires an API Key that is either generated for organisation settings or found in your account.

```
USAGE
$ FLAGSMITH_API_KEY=<KEY> flagsmith generate-types [PROJECT_ID]

ARGUMENTS
PROJECT_ID The flagsmith project id you are fetching the types for.

FLAGS
-a, --api=<value> [default: https://edge.api.flagsmith.com/api/v1/] The
API URL to fetch the feature flags from
-e, --exclude [default: null] Exclude any feature you intend to remove, can be a csv e.g feature_a,feature_b.
-o, --output=<value> [default: ./flagsmith.d.ts] The file path output
-p, --pretty Prettify the output JSON

DESCRIPTION
Retrieve type definitions for the features and their possible remote configuration values.
```



_See code: [dist/commands/get/index.ts](https://github.com/Flagsmith/flagsmith-cli/blob/v0.1.4/dist/commands/get/index.ts)_

## `flagsmith help [COMMANDS]`
Expand All @@ -135,3 +163,11 @@ FLAGS
DESCRIPTION
Display help for flagsmith.
```

### Type generation examples

[1 - Adding a remote config.mov](1%20-%20Adding%20a%20remote%20config.mov)

[2 - Creating a new flag.mov](2%20-%20Creating%20a%20new%20flag.mov)

[3 - Dry run removing flag.mov](3%20-%20Dry%20run%20removing%20flag.mov)
16 changes: 16 additions & 0 deletions example/flagsmith.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface FlagsmithTypes {
json_flag: JsonFlag;
number_flag: number;
string_flag: string;
}

export interface JsonFlag {
first_name: string;
last_name: string;
address: Address;
}

export interface Address {
line_1: string;
line_2: string;
}
Loading