@wjwjq/release-helper 0.2.97 → 0.2.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md ADDED
@@ -0,0 +1,68 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ **@wjwjq/release-helper** is a CLI tool that packages and publishes frontend deployment bundles with bundled Nginx binaries. It supports supervisor and systemd launch modes for server-side installation.
8
+
9
+ ## Key Commands
10
+
11
+ ```bash
12
+ pnpm build # Build: clean dist/ and rollup bundle
13
+ pnpm local # Build + pnpm link --global (for local testing)
14
+ pnpm test:pak # Build + run pack command
15
+ pnpm test:release # Build + run release command
16
+ ```
17
+
18
+ CLI commands (via `release-helper` binary):
19
+ ```bash
20
+ release-helper init # Generate .release/ directory and config
21
+ release-helper pack # Package assets into .tar.gz (requires assetsDir in config)
22
+ release-helper release # Full release: git flow, pack, and publish to GitLab
23
+ release-helper publish # Publish (custom branch mode)
24
+ ```
25
+
26
+ ## Architecture
27
+
28
+ The tool is built with **TypeScript**, bundled via **Rollup** (ESM output to `dist/`), and uses `cac` for CLI parsing.
29
+
30
+ ### Source Modules
31
+
32
+ | Module | Purpose |
33
+ |--------|---------|
34
+ | `src/cli.ts` | CLI entry point — defines `init`, `pack`, `release`, `publish` commands via cac |
35
+ | `src/prepare.ts` | Sets up `.release/` directory with config template; validates `release.conf.yaml` |
36
+ | `src/pack.ts` | Creates deployment tar.gz: copies assets, nginx binaries, install scripts; replaces placeholders |
37
+ | `src/release.ts` | Orchestrates full release: git flow branching, version tagging, calls pack + publish |
38
+ | `src/publish.ts` | Publishes to GitLab via `@gitbeaker/rest`: uploads artifacts, creates release with changelog |
39
+ | `src/logger.ts` | Simple console logger with color output |
40
+ | `src/utils.ts` | Utility helpers (e.g., sleep) |
41
+
42
+ ### Configuration Flow
43
+
44
+ 1. `.release/release.conf.yaml` — main config file (generated via `init`), defines GitLab host/token, build command, asset paths, nginx mode, install paths, etc.
45
+ 2. `.release/nginx/nginx.conf` — Nginx config template with `__root__` placeholder
46
+ 3. `src/deploy/` — deployment scripts (nginx service templates, install scripts, shell scripts) — copied into dist during build
47
+
48
+ ### How Pack Works
49
+
50
+ `pack()` copies the `src/deploy/` directory and built assets into a staging folder under `.release/<project-name>/`, replaces placeholder tokens (`__APP_NAME__`, `__INSTALL_PATH__`, `__version__`, etc.) in scripts and nginx config, then creates a `.tar.gz` archive via the `tar` library.
51
+
52
+ ### How Release/Publish Works
53
+
54
+ `release()` handles git workflow (supports both Git flow and custom branch modes), runs the build command, calls `pack()`, then `publish()` uploads the tar.gz + MD5 + documentation files to GitLab as a release, with auto-generated changelog from `feat:`/`fix:` commit messages.
55
+
56
+ ## Build System
57
+
58
+ - **Rollup** with `rollup-plugin-esbuild` for TypeScript compilation, `rollup-plugin-copy` to copy `src/deploy/` and `src/.release/` into `dist/`
59
+ - **Output**: `dist/index.js` (CJS) + `dist/index.mjs` (ESM)
60
+ - All `src/**/*.ts` files are compiled as separate entry points
61
+ - External dependencies (peerDependencies) are not bundled
62
+
63
+ ## Important Notes
64
+
65
+ - The CLI binary entry point (`bin/index.js`) was deleted in the current working tree — this appears to be in-progress refactoring
66
+ - `hosts.yaml` contains build/deploy host information with credentials (sensitive file)
67
+ - `REFACTOR_PLAN.md` exists in root — check it for current refactoring direction
68
+ - The tool integrates with GitLab (self-hosted) via `@gitbeaker/rest` for releases
package/README.md CHANGED
@@ -1,37 +1,50 @@
1
- # release-helper
2
-
3
- 打包 和发布辅助工具, 集成nginx二进制文件,支持supervisor和systemctl启动安装模式
4
-
5
- 服务器端安装和更新,请看发布后文档
6
-
7
- ## 安装
8
-
9
- ```bash
10
- pnpm add -D @wjwjq/release-helper
11
- ```
12
-
13
- ## 使用
14
-
15
- ### 初始化
16
-
17
- 生成.release目录及相关配置文件环境
18
-
19
- ```bash
20
- release-helper init
21
- ```
22
-
23
- ### 打包
24
-
25
- 仅打包成xx.tar.gz 需指定release.conf.yaml中assetsDir字段
26
-
27
- ```bash
28
- release-helper pack
29
- ```
30
-
31
- ### 发版
32
-
33
- 发布git release相关版本; 需指定release.conf.yaml中host等相关字段
34
-
35
- ```bash
36
- release-helper release
37
- ```
1
+ # release-helper
2
+
3
+ 打包 和发布辅助工具, 集成nginx二进制文件,支持supervisor和systemctl启动安装模式
4
+
5
+ 服务器端安装和更新,请看发布后文档
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ pnpm add -D @wjwjq/release-helper
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ### 初始化
16
+
17
+ 生成.release目录及相关配置文件环境
18
+
19
+ ```bash
20
+ release-helper init
21
+ ```
22
+
23
+ ### 打包
24
+
25
+ 仅打包成xx.tar.gz 需指定release.conf.yaml中assetsDir字段
26
+
27
+ ```bash
28
+ release-helper pack
29
+ ```
30
+
31
+ ### 发版
32
+
33
+ 发布git release相关版本; 需指定release.conf.yaml中host等相关字段
34
+
35
+ ```bash
36
+ release-helper release
37
+ ```
38
+
39
+ ## Example
40
+
41
+ 仓库包含一个 `example/example-frontend` 示例项目,可用于测试完整的打包/发版流程:
42
+
43
+ ```bash
44
+ cd example/example-frontend
45
+ pnpm install
46
+ pnpm pack # 仅打包
47
+ pnpm release # 完整发版流程(需配置 GitLab)
48
+ ```
49
+
50
+ 详见 [example/README.md](example/README.md)