swimlane-js
===========

### Setup
```bash
./setup-swimlane-js -h SWIMLANE_HOST -u SWIMLANE_USER
```

SWIMLANE_USER should be the user used when installing Swimlane (the owner of /opt/swimlane). Defaults to swimlane-host if not specified

This script automates setting up the git repo taking these steps:
* create a new ed25519 SSH key if one doesn't already exist in the default location and adds it to the authorized_keys for the swimlane user
* set up a git repo for the swimlane-js code
* set a post-receive hook to update the docker container when code is pushed
* add an entry in importmap.json to enable importing code from widgets
* adds a remote to the git repo named swimlane-dev
* pushes the "main" branch to the new remote to trigger the deployment of the code to the sw_web docker

### Usage

Import it into a widget with
```javascript
import {SwimlaneAPI} from 'swimlane-js';
```

The constructor takes the api token as a parameter. If instantiated inside a SwimlaneElement
```javascript
const cli = new SwimlaneAPI(this.contextData.token);
```

### Example code (may not be current)
There's an example index.html that can be used as a reference
* Fill in the relevant values in config.skel.js and move it to config.js
* start a web server and load index.html
