suce

A tool to deploy node application to servers.

Usage no npm install needed!

<script type="module">
  import suce from 'https://cdn.skypack.dev/suce';
</script>

README

suce

A tool to deploy node application to servers.

# global
npm install suce -g

# local
npm install suce --save-dev

.gitignore

# ignore suce tmp directory

.suce

command line

suce <command> [args]

sync: upload local files to server, with executing shell scripts on server

suce sync <entry>

project config

Defined in suce.config.js of project root directory.

module.exports = ({entry, cmd}) => config;

src

  • desc: gulp src
  • type: string/array
  • since: v0.1.0
  • example:
'**/*'

['entry1/**/*', 'entry2/**/*']

server

  • desc: options for gulp-ssh
  • type: map
  • since: v0.1.0
  • example:
{
  ignoreErrors: true,
  {
    host: 'localhost',
    username: 'senntyou',
    password: 'senntyou',
  },
}

remotePath

  • desc: remote server path
  • type: string
  • since: v0.1.0

pre

  • desc: shell scripts to execute before uploading files
  • type: string/array
  • since: v0.1.0
  • example:
['cd ~/suce', 'ls -lh --color=never']

Pre shell scripts will generate a pre.log file in .suce directory of project root directory.

post

  • desc: shell scripts to execute after uploading files
  • type: string/array
  • since: v0.1.0
  • example:
['cd ~/suce/project', 'npm install', 'npm restart']

Post shell scripts will generate a post.log file in .suce directory of project root directory.

multiple server environments

If you need to support multiple server environments(test, gray, prod), you can do like this:

suce sync entry --env test
suce sync entry --env gray
suce sync entry --env prod

With minimist.

# suce.config.js

const argv = require('minimist')(process.argv.slice(2));

const configs = {
  test: { ... },
  gray: { ... },
  prod: { ... },
};

module.exports = configs[argv.env];