@wjwjq/release-helper 0.1.9 → 0.2.1

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.
Files changed (59) hide show
  1. package/dist/deploy/pkg/nginx_binary/g++/gcc-c++-4.8.5-39.el7.x86_64.rpm +0 -0
  2. package/dist/deploy/pkg/nginx_binary/g++/libstdc++-4.8.5-39.el7.x86_64.rpm +0 -0
  3. package/dist/deploy/pkg/nginx_binary/gcc/cpp-4.8.5-39.el7.x86_64.rpm +0 -0
  4. package/dist/deploy/pkg/nginx_binary/gcc/gcc-4.8.5-39.el7.x86_64.rpm +0 -0
  5. package/dist/deploy/pkg/nginx_binary/gcc/glibc-devel-2.17-307.el7.1.x86_64.rpm +0 -0
  6. package/dist/deploy/pkg/nginx_binary/gcc/glibc-headers-2.17-307.el7.1.x86_64.rpm +0 -0
  7. package/dist/deploy/pkg/nginx_binary/gcc/kernel-headers-3.10.0-1127.el7.x86_64.rpm +0 -0
  8. package/dist/deploy/pkg/nginx_binary/gcc/libmpc-1.0.1-3.el7.x86_64.rpm +0 -0
  9. package/dist/deploy/pkg/nginx_binary/gcc/mpfr-3.1.1-4.el7.x86_64.rpm +0 -0
  10. package/dist/deploy/pkg/nginx_binary/nginx-1.22.1.tar.gz +0 -0
  11. package/dist/deploy/pkg/nginx_binary/openssl/keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm +0 -0
  12. package/dist/deploy/pkg/nginx_binary/openssl/krb5-devel-1.15.1-46.el7.x86_64.rpm +0 -0
  13. package/dist/deploy/pkg/nginx_binary/openssl/krb5-libs-1.15.1-46.el7.x86_64.rpm +0 -0
  14. package/dist/deploy/pkg/nginx_binary/openssl/libcom_err-devel-1.42.9-17.el7.x86_64.rpm +0 -0
  15. package/dist/deploy/pkg/nginx_binary/openssl/libkadm5-1.15.1-46.el7.x86_64.rpm +0 -0
  16. package/dist/deploy/pkg/nginx_binary/openssl/libselinux-devel-2.5-15.el7.x86_64.rpm +0 -0
  17. package/dist/deploy/pkg/nginx_binary/openssl/libverto-devel-0.2.5-4.el7.x86_64.rpm +0 -0
  18. package/dist/deploy/pkg/nginx_binary/openssl/openssl-1.0.2k-19.el7.x86_64.rpm +0 -0
  19. package/dist/deploy/pkg/nginx_binary/openssl/openssl-devel-1.0.2k-19.el7.x86_64.rpm +0 -0
  20. package/dist/deploy/pkg/nginx_binary/pcre/pcre-8.32-17.el7.x86_64.rpm +0 -0
  21. package/dist/deploy/pkg/nginx_binary/pcre/pcre-devel-8.32-17.el7.x86_64.rpm +0 -0
  22. package/dist/deploy/pkg/nginx_binary/zlib/zlib-1.2.7-18.el7.x86_64.rpm +0 -0
  23. package/dist/deploy/pkg/nginx_binary/zlib/zlib-devel-1.2.7-18.el7.x86_64.rpm +0 -0
  24. package/dist/deploy/script/nginx.sh +81 -25
  25. package/dist/prepare.js +1 -1
  26. package/package.json +4 -2
  27. package/.release/README.md +0 -73
  28. package/.release/doc//351/203/250/347/275/262/346/211/213/345/206/214.md +0 -418
  29. package/.release/nginx/ca/ca.crt +0 -32
  30. package/.release/nginx/ca/ca.key +0 -54
  31. package/.release/nginx/ca/client.crt +0 -100
  32. package/.release/nginx/ca/client.csr +0 -16
  33. package/.release/nginx/ca/client.p12 +0 -0
  34. package/.release/nginx/ca/client.pem +0 -30
  35. package/.release/nginx/ca/server.crt +0 -101
  36. package/.release/nginx/ca/server.csr +0 -17
  37. package/.release/nginx/ca/server.key +0 -27
  38. package/.release/nginx/ca/server.pem +0 -30
  39. package/.release/nginx/nginx.conf +0 -179
  40. package/.release/release.conf.yaml +0 -17
  41. package/dist/.release/README.md +0 -73
  42. package/dist/.release/doc//351/203/250/347/275/262/346/211/213/345/206/214.md +0 -418
  43. package/dist/.release/nginx/ca/ca.crt +0 -32
  44. package/dist/.release/nginx/ca/ca.key +0 -54
  45. package/dist/.release/nginx/ca/client.crt +0 -100
  46. package/dist/.release/nginx/ca/client.csr +0 -16
  47. package/dist/.release/nginx/ca/client.p12 +0 -0
  48. package/dist/.release/nginx/ca/client.pem +0 -30
  49. package/dist/.release/nginx/ca/server.crt +0 -101
  50. package/dist/.release/nginx/ca/server.csr +0 -17
  51. package/dist/.release/nginx/ca/server.key +0 -27
  52. package/dist/.release/nginx/ca/server.pem +0 -30
  53. package/dist/.release/nginx/nginx.conf +0 -179
  54. package/dist/.release/release.conf.yaml +0 -17
  55. package/dist/deploy/pkg/nginx_binary/compile.sh +0 -39
  56. package/dist/deploy/pkg/nginx_binary/nginx-arm-ssl1.1.1.tar.gz +0 -0
  57. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
  58. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
  59. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl3.0.7.tar.gz +0 -0
@@ -208,6 +208,32 @@ open_port_80() {
208
208
  firewall-cmd --reload
209
209
  }
210
210
 
211
+ function check_dependency(){
212
+ if [[ -z $(rpm -qa | grep ^gcc | grep -v grep) ]];
213
+ then
214
+ cd ${nginx_binary_pkg_path}/gcc && rpm -Uvh *.rpm --nodeps --force
215
+ fi
216
+ if [[ -z $(rpm -qa | grep ^gcc-c++ | grep -v grep) ]];
217
+ then
218
+ cd ${nginx_binary_pkg_path}/g++ && rpm -Uvh *.rpm --nodeps --force
219
+ fi
220
+ if [[ -z $(rpm -qa | grep ^zlib-devel | grep -v grep) ]];
221
+ then
222
+ cd ${nginx_binary_pkg_path}/zlib && rpm -Uvh *.rpm --nodeps --force
223
+ fi
224
+ if [[ -z $(rpm -qa | grep ^openssl-devel | grep -v grep) ]];
225
+ then
226
+ cd ${nginx_binary_pkg_path}/openssl && rpm -Uvh *.rpm --nodeps --force
227
+ fi
228
+ if [[ -z $(rpm -qa | grep ^pcre-devel | grep -v grep) ]];
229
+ then
230
+ cd ${nginx_binary_pkg_path}/pcre && rpm -Uvh *.rpm --nodeps --force
231
+ fi
232
+
233
+ cd $project_path/script
234
+ }
235
+
236
+
211
237
  # 安装nginx可执行程序
212
238
  install_nginx_binary() {
213
239
  log "install nginx to path: ${nginx_binary_install_path}"
@@ -215,40 +241,66 @@ install_nginx_binary() {
215
241
  arch=$(uname -m)
216
242
  ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
217
243
 
218
- if [[ -z "${arch}" ]]; then
219
- arch="x86_64"
220
- fi
244
+ # if [[ -z "${arch}" ]]; then
245
+ # arch="x86_64"
246
+ # fi
221
247
 
222
- if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
223
- arch="arm"
224
- fi
248
+ # if [[ $arch == arm* ]] || [[ $arch = aarch64 ]]; then
249
+ # arch="arm"
250
+ # fi
225
251
 
226
- if [[ "${ssl_version}" == "1.0" ]]; then
227
- ssl_version="1.0.2"
228
- fi
252
+ # if [[ "${ssl_version}" == "1.0" ]]; then
253
+ # ssl_version="1.0.2"
254
+ # fi
229
255
 
230
- if [[ "${ssl_version}" == "1.1" ]]; then
231
- ssl_version="1.1.1"
232
- fi
256
+ # if [[ "${ssl_version}" == "1.1" ]]; then
257
+ # ssl_version="1.1.1"
258
+ # fi
233
259
 
234
- if [[ "${ssl_version}" == "3.0" ]]; then
235
- ssl_version="3.0.7"
236
- fi
260
+ # if [[ "${ssl_version}" == "3.0" ]]; then
261
+ # ssl_version="3.0.7"
262
+ # fi
237
263
 
238
- if [[ -z "${ssl_version}" ]]; then
239
- ssl_version="1.0.2"
240
- fi
264
+ # if [[ -z "${ssl_version}" ]]; then
265
+ # ssl_version="1.0.2"
266
+ # fi
241
267
 
242
- pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
268
+ # pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
243
269
 
244
- if [ ! -f "$pkg" ]; then
245
- log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
246
- exit 1
247
- fi
270
+ # if [ ! -f "$pkg" ]; then
271
+ # log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
272
+ # exit 1
273
+ # fi
274
+
275
+ # log "current arch: $arch, current ssl_version: $ssl_version"
248
276
 
249
- log "current arch: $arch, current ssl_version: $ssl_version"
277
+ # tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
250
278
 
251
- tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
279
+
280
+ check_dependency
281
+ # 检测是否安装成功
282
+ if [[ $? == 0 ]]; then
283
+ log_success "dependency installation successfully!"
284
+ else
285
+ log_error "dependency installation failed!"
286
+ fi
287
+
288
+ log "start to complie and install nginx"
289
+
290
+ tar_name=$(ls ${nginx_binary_pkg_path}|grep nginx-.*.tar.gz)
291
+ tar_dir=${tar_name%.tar.gz*}
292
+ tar -zxvf "${nginx_binary_pkg_path}"/"${tar_name}"
293
+ cd "${tar_dir}"
294
+
295
+ ./configure \
296
+ --prefix=${nginx_binary_install_path} \
297
+ --with-http_ssl_module \
298
+ --with-http_v2_module \
299
+ --with-http_gzip_static_module \
300
+ --with-http_stub_status_module \
301
+ --with-stream
302
+
303
+ make && make install
252
304
  # 检测是否安装成功
253
305
  if [[ $? == 0 ]]; then
254
306
  log_success "nginx installation successfully!"
@@ -256,7 +308,11 @@ install_nginx_binary() {
256
308
  log_error "nginx installation failed!"
257
309
  fi
258
310
 
311
+ cp $nginx_binary_install_path/conf/mime.types $nginx_binary_install_path
312
+
313
+ mkdir -p /usr/local/bin
259
314
  ln -sf "$nginx_binary_install_path"sbin/nginx /usr/sbin/nginx
315
+ cd ..
260
316
 
261
317
  # 修改/etc/nginx 用户(组)
262
318
  chown -R $user:$usergroup "$nginx_binary_install_path"
package/dist/prepare.js CHANGED
@@ -61,7 +61,7 @@ async function prepare({ callBy } = { callBy: "postinstall" }) {
61
61
  }
62
62
  }
63
63
  async function checkEnvInfo() {
64
- const { stdout: isGitRepo } = await $(`git rev-parse --is-inside-work-tree`);
64
+ const { stdout: isGitRepo } = await $`git rev-parse --is-inside-work-tree`;
65
65
  if (isGitRepo !== "true") {
66
66
  logger.error("\u5F53\u524D\u9879\u76EE\u4E0D\u662Fgit\u4ED3\u5E93");
67
67
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjwjq/release-helper",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "generate deployment package for frontend, include nginx...",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -63,8 +63,10 @@
63
63
  "node": "^18.20.0 || >=20.0.0"
64
64
  },
65
65
  "scripts": {
66
- "localpack": "pnpm build && pnpm link --global",
66
+ "local": "pnpm build && pnpm link --global",
67
67
  "postinstall": "node dist/start_prepare.js",
68
+ "test:pak": "pnpm build & node ./bin/index.js pack",
69
+ "test:release": "pnpm build & node ./bin/index.js release",
68
70
  "build": "rm -rf dist && rollup -c",
69
71
  "prepublish": "pnpm build"
70
72
  }
@@ -1,73 +0,0 @@
1
- # release-helper
2
-
3
- 打包 和发布辅助工具, 集成nginx二进制文件,支持supervisor和systemctl启动安装模式
4
-
5
- 服务器端安装和更新,请看发布后文档
6
-
7
- ## 使用
8
-
9
- ### 推荐
10
-
11
- 在package.json中添加如下命令, 后续通过pnpm pak/pub/publish使用
12
-
13
- ```bash
14
- "pak": "release-helper pack",
15
- "pub": "release-helper publish",
16
- "release": "release-helper release",
17
- ```
18
-
19
- ### 单独使用命令
20
-
21
- 请在项目根目录,使用命令
22
-
23
- #### 初始化
24
-
25
- 常规来讲,通过pnpm安装时,会自动在项目根目录位置,生成.release目录,若未生成,请手动生成
26
-
27
- ```bash
28
- release-helper init
29
- ```
30
-
31
- #### 打包
32
-
33
- 仅打包成xx.tar.gz 需指定release.conf.yaml中assetsDir字段
34
-
35
- ```bash
36
- release-helper pack
37
- ```
38
-
39
- #### 发版
40
-
41
- 发布git release相关版本; 需指定release.conf.yaml中host等相关字段
42
-
43
- ```bash
44
- release-helper release
45
- ```
46
-
47
- ## .release 目录说明
48
-
49
- ### doc 目录
50
-
51
- 用于release时附带的文档,文档中可以使用指定变量占位,后续执行release-helper release时会自动遍历,并替换所有变量
52
-
53
- 可使用变量及说明:
54
-
55
- | **占位符** | **含义** |
56
- | ------------- | ---------------------------------------------------- |
57
- | \$APP\_NAME\$ | 应用名称(自动读取package.json中name字段值) |
58
- | \$VERSION\$ | 用户指定的版本号 |
59
- | \$PKG_NAME\$ | tar.gz包名称(值为\$APP_NAME\$\_\$VERSION\$.tar.gz) |
60
-
61
- ### nginx 目录
62
-
63
- 用于存放服务器端nginx的启动配置文件等,部分占位说明及占位符请勿删除,会在服务器端安装或更新时,由脚本自动替换
64
-
65
- 文件说明:
66
- | **文件或目录** | **说明** |
67
- | -------------- | --------------------------------------------------------- |
68
- | ca | nginx https使用到的证书,变更时需对应修改nginx.conf中的值 |
69
- | nginx.conf | nginx启动时 需要的配置文件 |
70
-
71
- ### release.conf.yaml
72
-
73
- 打包发布相关配置项