@cables/cables
cables command line tool
Last updated 2 months ago by steam0r .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cables/cables 
SYNC missed versions from official npm registry.

cables-cli

Command line tool to export and download cables patches from the command line

             C   A   B   L   E   S   >>>  ___:_ _
       _ _:_______________ _____________ /   |\   _ _______
          |  _           /\\_           \    |\\.  _)     /\       ______         
    _____ | (/)        _/\\\(_______    /    |\\| /    __/\\\     /     /\    
   /   _/\_      _    /_\\\/_\\\\ _/   /     |\\|/     \_\\\/___ /     /\\\ 
  /   /_\\|_     |\     \\(    /\ \   /_    _:\\/__ /\_/       /_\   _/_\\/___
_/   /(     \    |_\     \__  /_\\_)    \         (_          /   \          /\
\           _\   \___     _/             \         /         /     \_       /\\\
 \_________(    _|\\\\     \_ ___________/   _    /_________/       /      /\\\/
  \\\\\\\\|_____)\\\        |\\\\\/         (/)  /\\\\\\\/                /_\\/
   \\\\\\\\\\\\\\\\\\_______:\\.\/______________/\\\\\\\\\_________________(\\ 
 _|.._     \\\\\\\)  \\\\\\\\\\| \\\\\\\\\\\\\\\\\\\/     \\\\\\\\\\\\\\\\\\\\
(_|||_)               \\\\\\\\\|  \\\\\\\\\\\\\\\\\/       \\\\\\\\\\\\\\\\\\( 
 ---|-->> 

Installation

Run npm install -g @cables/cables.
Create an API key on cables.gl/settings —> navigate to API key —> press Generate. When you first start the tool it will show a prompt for the API key. Once entered your API key will be stored in ~/.cablesrc.

Run

Export

To export and download a cables patch into a specific directory run:

cables --export [CABLES PATCH ID] -d [DESTINATION]

You can find the patch ID by opening your patch in the cables editor – the last part of the URL is the patch ID, e.g.:

https://cables.gl/ui/#/project/5a7daa8b285c9aca0982bba2
—> 5a7daa8b285c9aca0982bba2 is the patch ID

Example:

cables --export 5a7daa8b285c9aca0982bba2 -d 'my-patch'

Please note: Running the command will overwrite everything in the my-patch-folder.

Arguments

  • -e / --export [PATCH ID]: Export patch
  • -d / --destination [DESTINATION]: Folder to download the patch to, can either be absolute or relative
  • -i / --no-index : Removes the index.html file when set
  • -x / --no-extract : do not extract the downloaded zip file
  • -j / --json-filename [JSON FILENAME] : Define the filename of the patch json file
  • -c / --combine-js : combine javascript and json into a single patch.js
  • -o / --old-browsers: load a version made compatible with older browsers using babel
  • -a / --assets <auto|all|none>: export assets of patch, defaults to "auto"

Deploy to netlify

Create an account on netlify, create a site by uploading a folder with a simple index.html. Go to the new site's settings and copy the "API ID". Then run the following commands (if you do this for the first time cables-cli will ask you for your netlify-api-key, create and copy one at/from "Site Settings > Access control").

Deploy the current directory to netlify:

cables --deploy netlify -d [SITE ID]

Deploy any directory to netlify (useful with webpack buildir or cables --export -d)

cables --deploy netlify -d [SITE ID] -s build/

Please note: Running the command will overwrite everything in the netlify site. They version their deploys, though.

Arguments

  • --deploy netlify: Deploy patch to netlify
  • -d / --destination [SITE ID]: Netlify-Site API ID to upload the files to
  • -s / --src [DIRECTORY]: which directory to send to netlify, defaults to current working directory

Use as a module

Install as dependency:

npm install --save @cables/cables

Export:

cables.export(options, onFinished, onError);

Simple Export Example:

var cables = require('@cables/cables');

cables.export({
  patchId: '5a4ea356429259dd579a0fea',
  destination: 'patch' 
}, onFinished, onError);

function onFinished() {
  console.log('Export finished!');
}

function onError(err) {
  console.log('There was an error exporting your patch :/');
}

Simple Deploy Example:

var cables = require('@cables/cables');

cables.netlify({
  destination: 'YOURNETLIFYSITEID' 
}, onFinished, onError);

function onFinished() {
  console.log('Deploy finished!');
}

function onError(err) {
  console.log('There was an error deploying your patch :/');
}

Advanced Export Example:

var cables = require('@cables/cables');

cables.export({
  patchId: '5a4ea356429259dd579a0fea',
  destination: 'patch',
  noIndex: true,
  jsonFilename: 'my-patch' /* patch will be stored as my-patch.json */
}, onFinished, onError);

function onFinished(filename) {
  console.log('Export finished: '+filename);
}

function onError(err) {
  console.log('There was an error exporting your patch :/');
}

Use in package.json:

{
  "scripts": {
      "patchup": "cables -c -i -d 'public' -e 5a4ea356429259dd579a0fea",
      "deploy": "cables --deploy netlify -d [SITE ID] -s public/"
  }
}

The project contains an example-package.json with patchup and deploy as predefined scripts.

Further Infos

For more infos on the cables API see cables API docs.

Current Tags

  • 0.7.0                                ...           latest (2 months ago)

15 Versions

  • 0.7.0                                ...           2 months ago
  • 0.6.3                                ...           3 months ago
  • 0.6.2                                ...           3 months ago
  • 0.6.1                                ...           4 months ago
  • 0.6.0                                ...           6 months ago
  • 0.5.3                                ...           6 months ago
  • 0.5.2                                ...           6 months ago
  • 0.5.1                                ...           6 months ago
  • 0.5.0                                ...           6 months ago
  • 0.4.0                                ...           8 months ago
  • 0.3.2                                ...           9 months ago
  • 0.2.0                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 15
This Month 15
Last Day 0
Last Week 2
Last Month 19
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |