# @canner/canner-tools

> canner tools

Latest version **0.3.18** (published 2017-10-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @canner/canner-tools
pnpm add @canner/canner-tools
yarn add @canner/canner-tools
bun add @canner/canner-tools
```

Provides the command `canner`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.18 |
| Published | 2017-10-16 |
| First published | 2017-05-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 32 |
| Known vulnerabilities | 0 (+10 in 5 direct dependencies) |
| Install scripts | no |
| Author | abz53378 |
| Maintainers | abz53378, wwwy3y3, ctxhou, chilijung |

## Links

- npm: https://www.npmjs.com/package/@canner/canner-tools
- npm.io page: https://npm.io/package/@canner/canner-tools

## Dependencies (32)

- [co](https://npm.io/package/co.md) ^4.6.0
- [koa](https://npm.io/package/koa.md) ^2.3.0
- [ora](https://npm.io/package/ora.md) ^1.3.0
- [gaze](https://npm.io/package/gaze.md) ^1.1.2
- [open](https://npm.io/package/open.md) ^0.0.5
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [fresh](https://npm.io/package/fresh.md) ^0.5.2
- [serve](https://npm.io/package/serve.md) ^6.0.1
- [unzip](https://npm.io/package/unzip.md) ^0.1.11
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [is-gzip](https://npm.io/package/is-gzip.md) ^1.0.0
- [request](https://npm.io/package/request.md) ^2.81.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.7
- [checksum](https://npm.io/package/checksum.md) ^0.1.1
- [firebase](https://npm.io/package/firebase.md) ^4.4.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^4.0.2
- [inquirer](https://npm.io/package/inquirer.md) ^3.0.6
- [co-prompt](https://npm.io/package/co-prompt.md) ^1.0.0
- [columnify](https://npm.io/package/columnify.md) ^1.5.4
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [image-size](https://npm.io/package/image-size.md) ^0.6.1
- [koa-morgan](https://npm.io/package/koa-morgan.md) ^1.0.1
- [superagent](https://npm.io/package/superagent.md) ^3.5.2
- [configstore](https://npm.io/package/configstore.md) ^3.0.0
- [compressible](https://npm.io/package/compressible.md) ^2.0.11
- [exports-loader](https://npm.io/package/exports-loader.md) ^0.6.4
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^3.2.0
- [@canner/statics](https://npm.io/package/@canner/statics.md) ^1.1.1
- [require-relative](https://npm.io/package/require-relative.md) ^0.8.7
- [lambda-webpack-zip](https://npm.io/package/lambda-webpack-zip.md) ^1.0.0
- [@canner/canner-types](https://npm.io/package/@canner/canner-types.md) ^0.4.2
- [@canner/canner-functions](https://npm.io/package/@canner/canner-functions.md) ^0.4.0

## Recent versions

- 0.3.18 (latest) — 2017-10-16
- 0.3.17 — 2017-10-16
- 0.3.16 — 2017-09-29
- 0.3.15 — 2017-09-28
- 0.3.14 — 2017-09-26
- 0.3.13 — 2017-09-25
- 0.3.12 — 2017-09-21
- 0.3.11 — 2017-09-15
- 0.3.10 — 2017-09-14
- 0.3.9 — 2017-09-14
- 0.3.8 — 2017-09-14
- 0.3.7 — 2017-09-14
- 0.3.6 — 2017-09-05
- 0.3.5 — 2017-08-26
- 0.3.4 — 2017-08-17
- … 22 more at https://npm.io/package/@canner/canner-tools/versions

## README

# canner-tools
> These are the Canner Command Line Interface (CLI) Tools



* [Installation](#installation)
* [Commands](#commands)
  * [Administrative Commands](#administrative-commands)
  * [App Commands](#app-commands)
  * [Schema Commands](#schema-commands)
  * [Data Commands](#data-commands)
  * [Statics Commands](#statics-commands)
* [Files](#files)
  * [.cannerrc](#cannerrc)
  * [canner.schema.js](#cannerschemajs)
  * [canner.data.js](#cannerdatajs)

## Installation

``` sh
$ npm install -g canner-tools
```

## Usage

``` sh
canner --help
```

## Get Started

![example](./canner-tools.gif?raw=true "Title")


## Commands

The command `canner --help` lists the available commands and `canner <command> --help` shows more details for and individual command.

Remeber to `login` first before you start to use these commands.

### Administrative Commands

<table>
  <tr>
    <td>Command</td>
    <td>Description</td>
  </tr>
  <tr>
    <td>login</td>
    <td>
      Log in to canner. Required before using other commands
    </td>
  </tr>
  <tr>
    <td>logout</td>
    <td>Log out from canner.</td>
  </tr>
  <tr>
    <td>init</td>
    <td>Create <a href="#.cannerrc"><code>.cannerrc</code></a> configureation file in your current directory. Also you can use this to change the configureation if you want.</td>
  </tr>
</table>

### App Commands

<table>
  <tr>
    <td>Command</td>
    <td>Description</td>
  </tr>
  <tr>
    <td>app:list</td>
    <td>List all your apps their infos.</td>
  </tr>
</table>

### Schema Commands

<table>
  <tr>
    <td>Command</td>
    <td>Description</td>
  </tr>
  <tr>
    <td>schema:deploy</td>
    <td>
      Deploy your <a href="#cannerschemajs"><code>canner.schema.js</code></a> to the default app url which setted in <code>.cannerrc</code>, or you can use option <code>-u &lt;url&gt;, --url &lt;url&gt;</code> to deploy schema to the specific app.
    </td>
  </tr>
</table>

### Data Commands

<table>
  <tr>
    <td>Command</td>
    <td>Description</td>
    <td>Options</td>
  </tr>
  <tr>
    <td>data:import</td>
    <td>
      Import your <a href="#cannerdatajs"><code>canner.data.js</code></a>  to the default app url which setted in <code>.cannerrc</code>.
      在 Canner 與 Firebase 上的表現有些許差異。
      <li>在 Canner 上如果是 <code>object</code> 會直接覆蓋資料，如果是 <code>array</code> 會 append 在原本資料後面。 </li>
      <li>在 Firebase 上只要有相同 key 的資料，就無法 import。 必須使用 <code>-d, --drop-first</code> </li>
    </td>
    <td>
      <li><code>-u &lt;url&lt;, --url &lt;url&gt;</code> to import data to the specific app.</li>
      <li><code>-d, --drop-first</code> to drop the data before import. Be careful to use this option</li>
    </td>
  </tr>
</table>

####

### Statics Commands

You can use Canner to host your statics files, like html, css, js, image and etc.
Just upload them to the app. 

html files have to be placed in `pages`, and others in `statics`

* pages
  * index.html
  * other.html
  * otherFolder
    * other1.html
* statics
  * anyfiles

<table>
  <tr>
    <td>Command</td>
    <td>Description</td>
  </tr>
  <tr>
    <td>serve</td>
    <td>
      This will serve the current folder.
      Before you upload statics files to app, you could use this command to confirm the result is correct.
    </td>
  </tr>
  <tr>
    <td>statics:upload</td>
    <td>
      Upload the directories, <code>pages</code> and <code>statics</code> to the default app url which setted in <code>.cannerrc</code>, or you can use option <code>-u &lt;url&lt;, --url &lt;url&gt;</code> to upload statics files to the specific app.
    </td>
  </tr>
</table>

## Files

### .cannerrc

 The file created when you use command `canner init`. You can also create this manually.

``` json
{
  "app": {
    "default": "<your app url>"
  }
}
```

### canner.schema.js

 This file declares the data info, and would be deploy when you use command `canner schema:deploy`. It's written with `CannerTypes`. To know more, you could read [`Canner Handbook`](https://www.gitbook.com/book/canner/canner-handbook/details)

``` js
// canner.schema.js
/* global CannerTypes */
module.exports = {
  home: CannerTypes.object({
    intro: CannerTypes.string().description('介紹')
  }).description('首頁');
}
```

### canner.data.js

 This js file is the data you want to import to your app, would be imported when you use command `canner data:import`. To know more, you could read [`Canner Handbook`](https://www.gitbook.com/book/canner/canner-handbook/details)

``` js
// canner.data.js
module.exports = {
  home: {
    intro: 'canner.data.js exports the data'
  }
}
```

You can use `ImageService` to uplaod image.

``` js
// canner.data.js
/* global ImageService */
module.exports = {
  home: {
    backgroundImg: ImageService.image('relative/path/to/img')
  }
}
```


### .canner-image-uploaded.json

If you use feature `auto upload image` in `canner.data.js`. This json file saves the `checksum` and `url` of the uploaded images to prevent from uploading the duplicated images.


### .canner-statics-uploaded.json

This json file saves the `checksum` of the statics file to prevent from uploading the duplicated files.

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