1.0.64 • Published 1 year ago

nodejs-auto-publish v1.0.64

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

基于nodejs的前端gitflow自动化代码部署。

NodeJS-based front-end GitFlow automates code deployment

说明 (illustrate):

运用git worktree 实现前端自动部署,源码工作区和生产分支互不干扰。一键运行,自动部署。

Use Git Worktree to implement automatic front-end deployment, and the source code workspace and production branch do not interfere with each other.

准备工作 (preparations):

  • 前端 --- front-end
    • 需至少准备一个源码分支以外的生产分支(You need to prepare at least one production branch other than the source code branch)
    • branches eg:
      • master -- 源码主分支
      • test -- 测试分支
      • release -- 生产代码分支
      • ...其他分支
  • 服务端 --- server * 服务端对接代码仓库的各生产分支,部署于对应服务上。(The server connects to each production branch of the code repository and deploys it on the corresponding service.)

使用 (usage):

// ./scripts/publish.mjs
import autoPublish from 'nodejs-auto-publish';

// 只有一个打包分支 only one packaging branch
autoPublish({
  branch: 'release',
  dist:'myDistPath',
  npmScript: 'app:prod',
  master:'master'  // Package qualifies the source branch that must be switched to
});

// 有多个打包分支 monorepo or multiple packaging branch
autoPublish({
  branch: {
    1: {
      name: 'release-branch-1',
      dist: 'myDistPath/app1',
      npmScript: 'app1:prod',
      master:'master'
    },
    2: {
      name: 'release-branch-2',
      dist: 'myDistPath/app2',
      npmScript: 'app2:prod'
    }
  }
});

// run node ./scripts/publish.mjs in terminal 
// 终端运行 node ./scripts/publish.mjs
proptypedescdefault
masterstring你的主源码分支,如果设置为null,则任意分支均可以打包发布代码,否则必须切换到master分支才能进行master
branchstring / object打包分支名,请参照上述示例release
npmScriptstring打包脚本,参照package.json的打包脚本,内部会执行npm run ${npmScript},只在单个打包分支下有效,多个打包分支参照示例配置
debugboolean调试模式,在git commit 后结束进程,不会触发 git pushfalse
customCommitfunction自定义git commit message({release,currentSrcBranch})=>{}
diststring打包输出的目录,只在单个打包分支下有效,多个打包分支参照示例配置dist
shortCommitboolean简短的commit hashtrue
1.0.64

1 year ago

1.0.61

1 year ago

1.0.55

1 year ago

1.0.54

1 year ago

1.0.53

1 year ago

1.0.52

1 year ago

1.0.51

1 year ago

1.0.50

1 year ago

1.0.49

1 year ago

1.0.48

1 year ago

1.0.46

1 year ago

1.0.45

1 year ago

1.0.44

1 year ago

1.0.42

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago