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

deploy-cli-win-service

v1.0.8

Published

前端一键自动化部署脚手架服务(windows版本)

Downloads

15

Readme

deploy-cli-win-service

前端项目一键部署服务器,针对windows服务前端一键部署(目前代码只适用于windows服务器)

前端一键自动化部署脚手架服务,支持开发、测试、生产多环境配置。配置好后一键即可自动完成部署。

(服务器为windows适用,linux服务器可找原作者项目https://github.com/fuchengwei/deploy-cli-service)

github

https://github.com/lovisnd/deploy-cli-win-service

npm

https://www.npmjs.com/package/deploy-cli-win-service

1 安装

全局安装 deploy-cli-win-service

npm install deploy-cli-win-service -g

本地安装 deploy-cli-win-service

npm install deploy-cli-win-service --save-dev

查看版本,表示安装成功

deploy-cli-win-service - v

注:本地安装的需要在调用前加 npx

npx deploy-cli-win-service -v

2 使用(以下代码都以全局安装为例)

2.1 查看帮助

deploy-cli-win-service -h

2.2 初始化配置文件(在项目目录下)

deploy-cli-win-service init # 或者使用简写 deploy-cli-win-service i

根据提示填写内容,会在项目根目录下生成 deploy.config.js 文件,初始化配置只会生成 dev (开发环境)、test (测试环境)、prod (生产环境) 三个配置,再有其他配置可参考模板自行配置。

2.3 手动创建或修改配置文件

在项目根目录下手动创建 deploy.config.js 文件,复制以下代码按情况修改即可。

module.exports = {
  projectName: 'vue_samples', // 项目名称
  privateKey: '/Users/lovisnd/.ssh/id_rsa',
  passphrase: '',
  readyTimeout: 20000, // 超时时间(毫秒)
  cluster: [], // 集群部署配置,要同时部署多台配置此属性如: ['dev', 'test', 'prod']
  dev: {
    // 环境对象
    name: '开发环境', // 环境名称
    script: 'npm run build', // 打包命令
    host: '192.168.0.1', // 服务器地址
    port: 22, // 服务器端口号
    username: 'test', // 服务器登录用户名
    password: '1234', // 服务器登录密码
    distPath: 'dist', // 本地打包生成目录
    windowsPath:'D:\\nginx-1.23.4\\web\\test\\',//windows服务需配置服务器本地项目路径
    webDir: '/test/dist', // 服务器部署路径(不可为空或'/')
    bakDir: 'D:\\nginx-1.23.4\\web\\back\\', // 备份路径 (打包前备份之前部署目录 最终备份路径为 /usr/local/nginx/backup/html.zip)
    isRemoveRemoteFile: true, // 是否删除远程文件(默认true)
    isRemoveLocalFile: true // 是否删除本地文件(默认true)
  }
}

2.4 部署 (在项目目录下)

注意:命令后面需要加 --mode 环境对象 (如:--mode dev

deploy-cli-win-service deploy --mode dev # 或者使用 deploy-cli-win-service d --mode dev

输入 Y 确认后即可开始自动部署,看见如下提示说明部署完成

2.5 集群部署 (在项目目录下)

注意:集群配置需要在 deploy-cli-win-service 中 配置 cluster 字段 (如:cluster: ['dev', 'test', 'prod']

deploy-cli-win-service deploy # 或者使用 deploy-cli-win-service d

输入 Y 确认后即可开始自动部署,看见如下提示说明部署完成

2.6 更新优化

如果不想把服务器密码保存在配置文件中,也可以在配置文件中删除 password 字段。在部署的时候会弹出输入密码界面。

如果不想在部署前执行打包命令,在配置文件中删除 script 字段即可。

如果需要部署前备份,在配置文件中配置 bakDir 字段,为空不会备份。ps: 服务器需要安装 zip 模块,可使用 yum install zip 命令。

2.7 本地安装扩展

如果使用本地安装命令的话,可以在项目根目录下的 package.json 文件中 scripts 脚本中添加如下代码

"scripts": {
  "serve": "vue-cli-service serve",
  "build": "vue-cli-service build",
  "lint": "vue-cli-service lint",
  "deploy": "deploy-cli-win-service deploy",
  "deploy:dev": "deploy-cli-win-service deploy --mode dev",
  "deploy:test": "deploy-cli-win-service deploy --mode test",
  "deploy:prod": "deploy-cli-win-service deploy --mode prod"
}

然后使用下面代码也可以完成部署操作

npm run deploy:dev

最后如果大家觉得还不错挺好用的话,麻烦给个 Star 😜😜😜。