Command line tools for deploying based on node.js

@nebulae-cli/deploy

Command line tools for deploying, github: https://github.com/longlongago2/deploy-cli

Since my native language is Chinese, please forgive me for the language of the CLI tool, you can modify it after forking


This content originally appeared on DEV Community and was authored by longlongago

Image description

@nebulae-cli/deploy

Command line tools for deploying, github: https://github.com/longlongago2/deploy-cli

Since my native language is Chinese, please forgive me for the language of the CLI tool, you can modify it after forking

Features

  • 🪄 Support multiple configuration file formats, such as json, yaml, js.

  • đźš© Supports configuring multiple tasks.

  • ⚡ Supports individual step execution, such as connect, clean, backup, upload.

  • 🌍 Support global configuration

Translations

简体中文

Installation

  • Global install
npm install @nebulae-cli/deploy -g

test deploy --version, If the version number is successfully displayed, it means the installation is successful

or

  • Project install
npm install @nebulae-cli/deploy -D

If you did not install globally, the command should be invoked using ./node_modules/.bin/deploy --version

Usage

How to use command line tools?

1. Generate deploy config file

deploy init

usage:

Usage: deploy init|generate [options]

init(generate) deploy config file

Options:
  -t, --type <type>      file type: "json" | "yaml" | "javascript" (default: "javascript")
  -m, --module <module>  javascript module type: "commonjs" | "cjs" | "esm" | "mjs" (default: "cjs")
  -g, --global           generate global config file
  -h, --help             display help for command

2. Modify the configuration file

/** @type {import("@nebulae-cli/deploy").ConfigOptions} */
module.exports = {
  host: 'xxx.xx.xxx.x',
  port: 22,
  username: 'server_ssh_name',
  // password: '',
  // privateKey: '',
  // autoBackup: true,
  // autoClean: false, // If the task attribute does not exist, it will take effect
  tasks: [
    {
      name: 'task name',
      disabled: false,
      target: 'your/dist/path',
      remoteDir: '/your/server/path',
      autoBackup: true,
      autoClean: false, // All attributes support upward merging. For example, configuration common to all tasks can be configured on the root property
      // backupDir: '',
      // deployedCommands: [], // Remote commands executed after deployment, such as ['cd/var/applications', 'java - jar xxx. jar'], will use && to merge multiple commands
    },
  ],
};

3. Test the connection

deploy connect

usage:

Usage: deploy connect [options]

test the connection to server

Options:
  -h, --host <host>              ssh server address
  -p, --port <port>              ssh server port (default: "22")
  -u, --username <username>      ssh server username
  -w, --password <password>      ssh server password
  -k, --privateKey <privateKey>  ssh private key path
  -c, --config <config>          config file path
  --help                         display help for command

4. Deploy

deploy

useage:

Usage: deploy [options] [command]

CLI for deploy project to server

Options:
  -V, --version            output the version number
  -c, --config             config file path
  -h, --help               display help for command

Commands:
  init|generate [options]  init(generate) deploy config file
  connect [options]        test the connection to server
  backup [options]         backup remote project from server to local
  clean [options]          clean server directory
  upload [options]         upload local project dist to ssh server

you can add scripts to package.json

  "scripts": {
    "deploy": "deploy",
  },

then, use npm run deploy

5. Other commands

deploy view config

useage:

Usage: deploy view [options] <config>

view deploy config file info

Options:
  -c, --config <config>  config file path
  -h, --help             display help for command


This content originally appeared on DEV Community and was authored by longlongago


Print Share Comment Cite Upload Translate Updates
APA

longlongago | Sciencx (2024-07-16T02:51:45+00:00) Command line tools for deploying based on node.js. Retrieved from https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/

MLA
" » Command line tools for deploying based on node.js." longlongago | Sciencx - Tuesday July 16, 2024, https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/
HARVARD
longlongago | Sciencx Tuesday July 16, 2024 » Command line tools for deploying based on node.js., viewed ,<https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/>
VANCOUVER
longlongago | Sciencx - » Command line tools for deploying based on node.js. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/
CHICAGO
" » Command line tools for deploying based on node.js." longlongago | Sciencx - Accessed . https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/
IEEE
" » Command line tools for deploying based on node.js." longlongago | Sciencx [Online]. Available: https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/. [Accessed: ]
rf:citation
» Command line tools for deploying based on node.js | longlongago | Sciencx | https://www.scien.cx/2024/07/16/command-line-tools-for-deploying-based-on-node-js/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.