JSPM

  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q76835F
  • License MIT

A simple CLI to manage multi-server deployment

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wukong-deploy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    wukong-dev Logo


    npm package npm downloadsy GitHub license GitHub stars GitHub issues


    wukong-deploy

    English | 简体中文

    ⚡️ A lightweight CLI tool for remote server deployment based on Node.js.

    🧠 Features

    • 🚀 One-command deployment to remote servers
    • 🔐 Secure SSH + SCP support
    • 📁 Custom file/folder inclusion
    • 📦 Easily configurable with config.mjs

    📦 Installation

    npm install -g wukong-deploy

    🚀 Quick Start

    wukong-deploy init     # Generate config file
    wukong-deploy deploy   # Deploy to remote server

    📷 Example Screenshot

    ✅ Deployed ./dist to root@your.server.com:/var/www/html/project

    Usage

    Initialize Configuration

    wukong-deploy init

    This will generate a sample .env and config/config.mjs file in your current working directory.

    Deploy

    wukong-deploy deploy

    You will be prompted to select a target server interactively.

    Or specify the server key directly:

    wukong-deploy deploy [serverKey]
    • [serverKey] is the key defined in your configuration file (e.g., test, prod).

    Example:

    wukong-deploy deploy test

    Configuration Example

    config/config.mjs:

    export default {
      showCommandLog: true,
      servers: {
        test: {
          name: 'Test Server',
          host: '192.168.0.123',
          username: 'root',
          passwordEnv: 'SERVER_53_PASSWORD',
          commands: [
            {
              // Some commands may return code=0, but the standard error contains a critical error
              cmd: 'git pull',
              cwd: '/your/project',
              description: 'Pull the latest code',
              // If the command outputs standard error (std err), it is considered to have failed execution
              exitOnStdErr: false,
              // If the standard error matches this rule, it is also considered a execution failure
              errorMatch: /Permission denied/
            },
            {
              cmd: 'npm run build',
              cwd: '/your/project',
              description: 'Build Project',
              exitOnStdErr: false,
              // If the standard error matches this rule, it is also considered a execution failure
              errorMatch: /Permission denied/
            }
          ],
          finishMsg: '🎉 Deployment completed'
        },
        prod: {
          name: 'Production Server',
          host: 'your.prod.ip',
          username: 'ubuntu',
          privateKey: '~/.ssh/id_rsa',
          commands: [
            {
              cmd: 'git pull',
              cwd: '/your/project',
              description: 'Pull the latest code',
              exitOnStdErr: false,
              //  If the standard error matches this rule, it is also considered a execution failure
              errorMatch: /Permission denied/
            },
            {
              cmd: 'pm2 restart app',
              cwd: '/your/project',
              description: 'restart server',
              exitOnStdErr: false,
              //  If the standard error matches this rule, it is also considered a execution failure
              errorMatch: /Permission denied/
            }
          ],
          finishMsg: '✅ Build completed'
        }
      }
    }

    Environment Variable Example (.env)

    SERVER_53_PASSWORD=your_password_here

    changelog

    License

    MIT