# apitable-settings-generator

> Generate settings with APITable power.

Latest version **1.1.0** (published 2022-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install apitable-settings-generator
pnpm add apitable-settings-generator
yarn add apitable-settings-generator
bun add apitable-settings-generator
```

Provides the commands `asg`, `apitable-settings-generator`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-12-01 |
| First published | 2022-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 58.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Kelly Peilin Chan |
| Maintainers | apitableinc |
| Keywords | settings, generator, apitable |

## Links

- npm: https://www.npmjs.com/package/apitable-settings-generator
- Repository: https://github.com/apitable/apitable-settings-generator
- Issues: https://github.com/apitable/apitable-settings-generator/issues
- npm.io page: https://npm.io/package/apitable-settings-generator

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [apitable](https://npm.io/package/apitable.md) ^0.8.1
- [commander](https://npm.io/package/commander.md) ^9.4.1
- [dot-object](https://npm.io/package/dot-object.md) ^2.1.4

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-12-01
- 1.0.9 — 2022-11-24
- 1.0.8 — 2022-11-18
- 1.0.7 — 2022-11-18
- 1.0.6 — 2022-11-18
- 1.0.5 — 2022-11-18
- 1.0.4 — 2022-11-18
- 1.0.3 — 2022-11-18
- 1.0.2 — 2022-11-18
- 1.0.1 — 2022-11-18
- 1.0.0 — 2022-11-18

## README

![cover](https://socialify.git.ci/apitable/apitable-settings-generator/image?description=1&font=Inter&language=1&name=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Dark)

# APITable Settings Generator

[![npm](https://img.shields.io/npm/v/apitable-settings-generator)](https://www.npmjs.com/package/apitable-settings-generator)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/apitable/apitable-settings-generator/npm-publish)](https://github.com/apitable/apitable-settings-generator/actions)
[![npm bundle size](https://img.shields.io/bundlephobia/min/apitable-settings-generator)](https://www.npmjs.com/package/apitable-settings-generator)
[![npm](https://img.shields.io/npm/dm/apitable-settings-generator)](https://www.npmjs.com/package/apitable-settings-generator)

APITable Settings Generator convert APITable datasheet into JSON data.

For example, you have [APITable](https://apitable.com) 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:

```json
{
  "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:

### Format: `Rows`

You have this JSON config file `config.json`:

```json
[
  {
    "dirName": "./generated",
    "fileName": "i18n.generated.json",
    "tables": {
      {
        "datasheetId": "dstbUhd5coNXQoXFD8",
        "datasheetName": "strings",
        "format": "rows",
        "params": {
        }
      }
    }
  }
]
```

Run APITable Settings Generator (`asg`):

```bash
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
```

Generated settings `i18n.generated.json`:

```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"
    }
  }
}
```

### Format: `Columns`

You have this JSON config file `config.json`:

```json
[
  {
    "dirName": "./generated",
    "fileName": "i18n.generated.json",
    "tables": {
      {
        "datasheetId": "dstbUhd5coNXQoXFD8",
        "datasheetName": "strings",
        "format": "columns",
        "params": {
        }
      }
    }
  }
]
```

Run APITable Settings Generator (`asg`):

```bash
# run in bash
npx asg --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
```

Generated settings `i18n.generated.json`:

```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"
    }
  }
}
```

### Format: `Array`

You have this JSON config file `config.json`:

```json
[
  {
    "dirName": "./generated",
    "fileName": "i18n.generated.json",
    "tables": {
      {
        "datasheetId": "dstbUhd5coNXQoXFD8",
        "datasheetName": "strings",
        "format": "array",
        "params": {}
      }
    }
  }
]
```

Run APITable Settings Generator (`asg`):

```bash
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
```

Generated settings `i18n.generated.json`:

```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](https://github.com/apitable/apitable-settings-generator/issues/new) for us.

---
_Source: https://npm.io/package/apitable-settings-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
