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-code

v0.0.1

Published

使用JSON文件完成代码上线部署;

Downloads

3

Readme

deploy-code

使用JSON文件完成代码上线部署;

常见代码上线是由一些列动作组成,常见的动作打包、复制、上传等。通过将这些动作转化成一个JSON配置文件,从而省去开发shell脚本的成本;

每个人的文件目录结构都不一样,一个多人开发项目当有文件目录相关操作时,每个人都要有属于自己上线shell文件。这个问题可以通过服务端打包上线来解决。如果没有一台单独上线服务器可以使用deploy-code来解决,deploy-code可以给项目的每个人单独生成一个配置。

快速开始

使用deploy-code模块分为三步

  1. 安装模块
  2. 创建部署配置文件
  3. 执行部署命令

1.安装模块

yarn add deploy-code

或者

npm install deploy-code

2.创建部署流程

执行创建命令

npx deploy-code --create

按照命令选择每一步内容

最终会生成一个deploy.json的配置文件, 同时会在package中创建相应的命令

演示gif图-w100%

3.执行部署命令

通过yarn run方法执行部署命令

yarn run preview //部署到预览环境

演示gif图-w100%

API 描述

每个场景都是一个key/value形式,key是场景名称,value是一个数组包含部署每一个步骤; 比如下面配置文件,有previewonline两个场景;

{
    "preview":[{
        "type": "command",
        "command": "yarn run test"
    },{
        "type": "upload",
        "host": "10.152.81.208",
        "username": "root",
        "password": "****",
        "path": "/usr/local/***",
        "source": "./test/**"
    }],
    "online": [{
        "type": "copy",
        "source": "./test/test1/a.js",
        "dest": "./test/test2"
    },{
        "type": "git-commit"
    }]
}

API 列表:

  • upload
  • command
  • copy
  • cd
  • delete
  • git-pull
  • git-commit

通用字段:

  • title: 说明当前步骤是什么

upload

将文件上传到服务器上, 对应字段如下

  • host: 服务器地址(可以是 IP 地址)
  • username: 用户名
  • password: 密码
  • path: 指定服务器上传路径
  • source: 需要上传的文件路径
{
    "type": "upload",
    "host": "10.152.81.208",
    "username": "root",
    "password": "****",
    "path": "/usr/local/***",
    "source": "./test/**"
}

command

需要执行的命令

  • command: 命令名称
{
    "type": "command",
    "command": "yarn run test"
}

copy

复制文件和文件夹

  • source: 需要复制文件和文件夹路径
  • dest: 目标路径
{
    "type": "copy",
    "source": "./test/test1/a.js",
    "dest": "./test/test2"
}

cd

进入指定文件夹路径

  • path: 指定文件夹路径
{
    "type": "cd",
    "path": "../test/"
}

delete

删除指定文件或者文件夹

create

创建指定文件或者文件夹

git-pull

通过git pull拉取代码

{
    "type": "git-pull"
}

git-commit

通过git commit提交代码

  • message: 提交的文案; 如果这个字段不存在,会自动提示填写字段;
{
    "type": "git-commit"
    "message": "修改xxx文件"
}