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

webpack-automatic-deployment

v1.2.1

Published

webpack前端项目打包后的代码自动化部署到服务器插件 Automated deployment of packaged project code to server plugins

Downloads

11

Readme

webpack-automatic-deployment

webpack把代码打包后自动布署到服务器中 process.env.NODE_ENV === "production" 时才会打包上传

Installation 安装

npm install webpack-automatic-deployment --save-dev
# OR
yarn add webpack-automatic-deployment --dev
# OR
pnpm add webpack-automatic-deployment --save-dev

Usage 使用

This plugin will delete the files on the server for you and upload the packaged files to the server. Just add the plugin to your webpack config as follows: 该插件将为您把服务器上的文件删除,并把打包后的文件上传到服务器中,只需要您将插件添加到 webpack 配置中,如下所示:

webpack使用方法:配置webpack.config.js

const WebpackAutomaticDeployment = require('webpack-automatic-deployment')

module.exports = {
  plugins: [
    new WebpackAutomaticDeployment(Options)
  ]
}

vue cli使用方法:配置vue.config.js

const WebpackAutomaticDeployment = require("webpack-automatic-deployment");

module.exports = {
  configureWebpack: {
    new WebpackAutomaticDeployment(Options)
  }
};

Options 配置

You can pass a hash of configuration options to webpack-automatic-deployment. Allowed values are as follows: 您可以将配置的选项传递给 webpack-automatic-deployment 插件。允许的值如下:

|Name键名|Explain说明|Type类型|Description描述| |:--:|:--:|:--:|:----------| |host|ServerIP/服务器IP|{string}|example/例: 123.123.123.124| |port|ServerPort/服务器端口|{number}|default: 22| |username|ServerUsers/服务器用户名|{string}|example/例: root| |password|ServerPassword/服务器密码|{string}|example/例: ****| |remotePath|ProjectPath/项目路径|{string}|example/例: /root/www/project_demo|

Here's an example webpack config illustrating how to use these options 下面是一个示例 webpack 配置,说明如何使用这些选项

webpack使用方法:配置webpack.config.js

{
  plugins: [
    new WebpackAutomaticDeployment({
      host: 'your server ip',
      username: 'your server users',
      password: 'your server password',
      remotePath: 'your project path on the server '
    })
  ]
}

vue cli使用方法:配置vue.config.js

const WebpackAutomaticDeployment = require("webpack-automatic-deployment");

module.exports = {
  configureWebpack: {
    plugins: [new WebpackAutomaticDeployment({
      host: 'your server ip',
      username: 'your server users',
      password: 'your server password',
      remotePath: 'your project path on the server '
    })],
  }
};

🔥 After configuration, run the npm run build command to automatically upload and deploy the code to the server after packaging

💪 配置好后,运行 npm run build 命令即可实现代码打包后自动上传部署至服务器

⚠️ Attention:

  • 1.The configuration in the project should have process.env.NODE_ ENV is the value of production, otherwise the plugin will not take effect
  • 2.The project path on the server needs to be specified to the project folder, as the folder will be deleted before each upload

⚠️ 特别注意:

  • 1.项目中配置的要有process.env.NODE_ENV为production的值,否则插件不会生效
  • 2.服务器上的项目路径要指定到项目文件夹,因为每次上传前会先删除文件夹
    • 如:您项目上传服务器的地址为:/root/www,你的项目文件夹名为 project_demo,那么对应配置的时候remotePath的值应为:/root/www/project_demo