npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yaoxfly/deploy

v1.0.16

Published

自动化部署

Downloads

60

Readme

English | 中文

@yaoxfly/deploy

Automatically package the project, compress the target folder or file, upload it to the specified directory of the remote server and automatically decompress it, support multiple environment configurations, provide the function of uploading the specified environment, and also provide the backup and restore function, which can specify the environmen.

environment:The target files or folders uploaded to different servers or different paths of the same server can be simply understood as development, test, formal and other environments.

install

npm i  @yaoxfly/deploy -g

// Run the yx-deploy -V command to check the version number and check whether the installation is successful

configure

add a configuration file in the root directory, supporting the following naming conventions.

  • yx.deploy.config
  • yx.deploy.config.ts
  • yx.deploy.config.js

Single environment configuration


module.exports = {
  //Server connection -- Required
  connect: {
    host: 'Host ip',
    port: 'SSH connection port', //It's usually 22,  
    username: 'User name',
    password: 'User login password'
  },

  //Upload -- Required
  upload: {
    name: 'File name or directory name',   //For example 'dist'
    path: 'The uploaded file or directory is relative to the path of the yx.deploy.config configuration file. If it is a file, the suffix is required', //For example './dist' 
    remotePath: 'Directory to upload to the server' //For example '/home/'
  },

  //Packaging - Optional projects that need to be packaged before uploading can be configured, such as front-end project npm run build
  build: {
    command: "Pack command to execute - Empty does not pack",
  },

  //Backup -- Optional
  backup: {
    open: true, //Enabling the Backup function
    outputDir: 'backup', //If the backup output directory is not created, it is automatically created in the root directory. Multi-level directories cannot be created
    quantity: 5 //Keep only the latest five versions. If the current configuration is deleted or the value is set to false or 0, it indicates no limit
  }
}

Multi-environment configuration

module.exports = [
  {
    //Environment Configuration -- Required
    env: {
      name: 'Environment name', // For example dev
      description: 'Environment description' //For example Development environment -- can be empty
    },

    // Server Connection -- Required
    connect: {
      host: 'Host ip',
      port: 'SSH connection port', //It's usually 22,  
      username: 'User name',
      password: 'User login password'
    },

 // Upload -- Required
    upload: {
      name: 'File name or directory name',   //For example 'dist'
      path: 'The uploaded file or directory is relative to the path of the yx.deploy.config configuration file. If it is a file, the suffix is required', //For example './dist' 
      remotePath: 'Directory to upload to the server' //For example '/home/'
    },

   // Packaging - Optional projects that need to be packaged before uploading can be configured, such as front-end project npm run build
    build: {
      command: "Pack command to execute - Empty does not pack",
    },

   // Backup -- Optional
    backup: {
      open: true, //Enabling the Backup function
      outputDir: 'backup', //If the backup output directory is not created, it is automatically created in the root directory. Multi-level directories cannot be created
      quantity: 5 //Keep only the latest five versions. If the current configuration is deleted or the value is set to false or 0, it indicates no limit
    }
  }
]

upload

Upload files/folders to the server. In multiple environments, you will be asked to specify an environment to upload

 yx-deploy upload 
 or
 yx-deploy u //abbreviation

Multi-environment without asking, quickly upload to the specified environment

 yx-deploy upload  --env  [Environment name]
 or
 yx-deploy u -e  [Environment name] //abbreviation

The server needs to install unzip,otherwise, the decompression fails。

Backup Restore

You can select the most recently uploaded version to restore. In multiple environments, you will be asked to specify an environment to restore

 yx-deploy revert 
 or
 yx-deploy r //abbreviation

Quickly restore to the latest version

 yx-deploy revert --latest 
 or
 yx-deploy r -l //abbreviation

Quickly restore to an environment without asking for multiple environments

 yx-deploy revert --env [Environment name]
 or
 yx-deploy r -e [ Environment name ]  //abbreviation

The current function needs to be in the yx.deploy.config configuration file with backup.open set to true and backup.outputDir needs to be configured.

support

Fully supported on the LTS version of Node.js. And it needs at least v12.