APITable Settings Generator
APITable Settings Generator convert APITable datasheet into JSON data.
For example, you have APITable like this:
name | emoji | category |
---|---|---|
jack_o_lantern | A | |
christmas_tree | B | |
fireworks | A | |
sparkler | C | |
firecracker | D |
It will generate JSON settings like this:
{
"jack_o_lantern": {
"emoji": "🎃",
"category": "A"
},
"christmas_tree": {
"emoji": "🎄",
"category": "B"
},
"fireworks": {
"emoji": "🎆",
"category": "A"
},
"sparkler": {
"emoji": "🎇",
"category": "C"
},
"firecracker": {
"emoji": "🧨",
"category": "D"
}
}
Use Case
- Localization
- Features Flag
- Software Settings
- Game Development
- ......
Usage
APITable Settings Generator provides 3 generated settings format:
-
rows
(default) columns
array
Assume you have this APITable:
id | en_US | zh_CN |
---|---|---|
login_title | Login APITable | 中文 APITable |
some text | some text en_US | some text zh_CN |
APITable Settings Generator generate settings in different mode:
Rows
Format: You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": {
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "rows",
"params": {
}
}
}
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": {
"login_title": {
"en_US": "Login APITable",
"zh_CN": "中文APITable"
},
"some text": {
"en_US": "some text en_US",
"zh_CN": "some text zh_CN"
}
}
}
Columns
Format: You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": {
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "columns",
"params": {
}
}
}
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx asg --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": {
"zh_CN": {
"login_title": "中文APITable",
"some text": "some text zh_CN"
},
"en_US": {
"login_title": "Login APITable",
"some text": "some text en_US"
}
}
}
Array
Format: You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": {
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "array",
"params": {}
}
}
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": [
{
"id": "login_title",
"en_US": "Login APITable",
"zh_CN": "中文APITable"
},
{
"id": "some text",
"en_US": "some text en_US",
"zh_CN": "some text zh_CN"
}
]
}
Conventions
We make some convetion that help you do more magic work:
- Ignore the column that name starts with
.
; - Ignore the Primary Key that valut starts with
.
;
If you want to more features, please new an issue for us.