# leancloud-auto

> Automatically generate LeanCloud classes and docs from schema definition.

Latest version **1.1.1** (published 2018-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install leancloud-auto
pnpm add leancloud-auto
yarn add leancloud-auto
bun add leancloud-auto
```

Provides the command `leanauto`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2018-04-08 |
| First published | 2018-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 64.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lk |
| Maintainers | lkspc |

## Links

- npm: https://www.npmjs.com/package/leancloud-auto
- Repository: https://github.com/lkspc/leancloud-auto
- Homepage: https://github.com/lkspc/leancloud-auto#readme
- Issues: https://github.com/lkspc/leancloud-auto/issues
- npm.io page: https://npm.io/package/leancloud-auto

## Dependencies (3)

- [ora](https://npm.io/package/ora.md) ^2.0.0
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [leancloud-storage](https://npm.io/package/leancloud-storage.md) ^3.6.4

## Recent versions

- 1.1.1 (latest) — 2018-04-08
- 1.1.0 — 2018-04-05
- 1.0.2 — 2018-04-04
- 1.0.1 — 2018-04-04
- 1.0.0 — 2018-04-04

## README

# leancloud-auto
Automatically generate `LeanCloud` classes and docs from schema definition. 
Which make it easy to migrate to LeanCloud from other data source.

**[中文](https://github.com/lkspc/leancloud-auto/blob/master/README.zh_CN.md)**

## Install

```bash
# use yarn
$ yarn global add leancloud-auto
# or use npm
$ npm install -g leancloud-auto
```

## Usage

There are something that to be explained firstly, the following docs use the keywords `Schema` and `Class`, which are both referred to *LeanCloud Class*. It is called `Class` in cloud, while called `Schema` at local.

### Generate classes from a local schema file

```bash
leanauto init -i appId -k appKey -m masterKey ./schema.json
```
This command will first create some classes which defined in file `schema.json`. Then compare the generated schema with the local schema and tell you whether they are perfectly matched.

Feel free to use this command, it would not delete your original schema or data. But you should make sure that the same schema not exists when runing this command, otherwise your original schema would be dirted.

### Generate docs from local schemas or cloud schemas

```bash
# from cloud schema
leanauto doc -i appId -k appKey -m masterKey -o ./structure.html

# from local schema
leanauto doc ./schema.json -o ./structure.html
```
This command will generate documents of the specified schema, representing as `HTML` tables. Open it in browser then have a look.

If not specify the `-o` option, it will print the markdown style string in terminal instead of writing to a HTML file.

### Generate `GraphQL` language schema

```bash
leanauto graphql ./schema.json -d ./graphql
```
This command will generate some files named {{className}}.js, which could simply integrate with GraphQL by another tool [egg-graphql](https://github.com/lkspc/egg-graphql).

## Test

See [test/test.js](https://github.com/lkspc/leancloud-auto/blob/master/test/test.js).

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