npm install @canner/canner-tools* Installation
* Commands
* Administrative Commands
* App Commands
* Schema Commands
* Data Commands
* Statics Commands
* Files
* .cannerrc
* canner.schema.js
* canner.data.js
`` sh`
$ npm install -g canner-tools
` sh`
canner --help
The command canner --help lists the available commands and canner shows more details for and individual command.
Remeber to login first before you start to use these commands.
| Command | Description |
| login | Log in to canner. Required before using other commands |
| logout | Log out from canner. |
| init | Create .cannerrc configureation file in your current directory. Also you can use this to change the configureation if you want. |
| Command | Description |
| app:list | List all your apps their infos. |
| Command | Description |
| schema:deploy | Deploy your canner.schema.js to the default app url which setted in .cannerrc, or you can use option -u <url>, --url <url> to deploy schema to the specific app. |
| Command | Description | Options |
| data:import | Import your canner.data.js to the default app url which setted in .cannerrc.在 Canner 與 Firebase 上的表現有些許差異。 object 會直接覆蓋資料,如果是 array 會 append 在原本資料後面。 -d, --drop-first | -u <url<, --url <url> to import data to the specific app.-d, --drop-first to drop the data before import. Be careful to use this option |
####
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
| Command | Description |
| serve | This will serve the current folder. Before you upload statics files to app, you could use this command to confirm the result is correct. |
| statics:upload | Upload the directories, pages and statics to the default app url which setted in .cannerrc, or you can use option -u <url<, --url <url> to upload statics files to the specific app. |
The file created when you use command canner init. You can also create this manually.
` json`
{
"app": {
"default": "
}
}
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
` js`
// canner.schema.js
/ global CannerTypes /
module.exports = {
home: CannerTypes.object({
intro: CannerTypes.string().description('介紹')
}).description('首頁');
}
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
` 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')
}
}
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.
This json file saves the checksum` of the statics file to prevent from uploading the duplicated files.