1.3.6 • Published 4 years ago

burguer v1.3.6

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Burguer - deployment tool

semantic-release travis npm github license

Install

Install with yarn

yarn add -D burguer

Install with npm

npm install -D burguer

Example (cli)

Create deploy.yml

config:
  local: .
  remote: /var/www
  host: hostname
  username: www-data
  privateKey: ~/.ssh/private-key

commands:
  - connect
  - push: index.js
  - push: package.json
  - remote: yarn install
  - disconnect

Run with yarn

yarn burguer deploy.yml

Run with npx

npx burguer deploy.yml

Example (library)

Create deploy.js

const Burguer = require('burguer')

async function start() {

  const burguer = new Burguer({
    local: '.',
    remote: '/var/www',
    host: 'hostname',
    username: 'www-data',
    privateKey: '~/.ssh/private-key'
  })

  await burguer.connect()
  await burguer.push('index.js')
  await burguer.push('package.json')
  await burguer.remote('yarn install')
  burguer.disconnect()

}

start()

Run with node

node deploy.js

API

// description: create a new Burguer instance
Burguer(config: BuguerConfig): Burguer

// description: connect to the ssh server
// requires: BuguerConfig.host, BuguerConfig.username, BuguerConfig.privateKey 
Burguer.connect(): Promise

// description: disconnect from the ssh server
// requires: Buguer.connect()
Burguer.disconnect()

// description: push a file from the local cwd to the remote cwd
// requires: Buguer.connect(), BurguerConfig.local, BurguerConfig.remote
// params:
//  - local: path relative to the local cwd (current working directory)
//  - remote: path relative to the remote cwd (current working directory). Same as local, if not set
Burguer.push(local: String, remote?: String): Promise

// description: pull a file from the remote cwd to the local cwd
// requires: Buguer.connect(), BurguerConfig.local, BurguerConfig.remote
// params:
//  - remote: path relative to the remote cwd (current working directory)
//  - local: path relative to the local cwd (current working directory). Same as remote, if not set
Burguer.pull(remote: String, local?: String): Promise

// description: execute a command in the local shell
// requires: BurguerConfig.local
// optional: BurguerConfig.localShell, BurguerConfig.localShellArgs
// params:
//  - command: the command path and arguments. e.g. echo hello world
//  - options:
//    - cwd: current working directory
//    - exitCode: the command expected exit code. default: 0
// returns: stdout, stderr and exit code from the command
Burguer.local(command: String, options?: { cwd?: String, exitCode?: Number }): Promise<BurguerResult>

// description: change the local cwd (current working directory)
Burguer.local.cd(path: String)

// description: execute a command in the remote shell
// requires: Buguer.connect(), BurguerConfig.remote
// optional: BurguerConfig.remoteShell, BurguerConfig.remoteShellArgs
// params:
//  - command: the command path and arguments. e.g. echo hello world
//  - options:
//    - cwd: current working directory
//    - exitCode: the command expected exit code. default: 0
// returns: stdout, stderr and exit code from the command
Burguer.remote(command: String, options?: { cwd?: String, exitCode?: Number }): Promise<BurguerResult>

// description: change the remote cwd (current working directory)
Burguer.remote.cd(path: String)

BuguerConfig = {
  // absolute or relative local project root path. e.g.: c:\project or ~/project or .
  local: String, 
  // absolute or relative remote project root path. e.g.: /var/www/project or ~/project or .
  remote: String, 
  // hostname or ip. e.g.: my-hostname.com or 192.168.0.100
  host: String, 
  // ssh username to access the remote. Must be used with password or privateKey, not both
  username: String, 
  // ssh password to access the remote
  password: String, 
  // absolute or relative path to the ssh private key. e.g.: c:\privatekey or ~/.ssh/privatekey
  privateKey: String, 
  // function called when an output is available. default: console.log
  stdout: Function,
  // function called when an error is available. default: console.error
  stderr: Function,
  // shell for local commands. e.g.: powershell.exe or /bin/bash.
  localShell: String,
  // arguments for the local shell. e.g.: '-c' or [ '/s', '/k' ]
  localShellArgs: String | String[],
  // shell for remote commands. e.g.: powershell.exe or /bin/bash.
  remoteShell: String
  // arguments for the remote shell. e.g.: '-c' or [ '/s', '/k' ]
  remoteShellArgs: String | String[]
}

BurguerResult = {
  code: Number,
  stdout: String,
  stderr: String
}
1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago