@wjwjq/release-helper 0.2.0 → 0.2.2

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 (32) 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/publish.js +2 -2
  26. package/dist/release.js +13 -13
  27. package/package.json +1 -1
  28. package/dist/deploy/pkg/nginx_binary/compile.sh +0 -39
  29. package/dist/deploy/pkg/nginx_binary/nginx-arm-ssl1.1.1.tar.gz +0 -0
  30. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.0.2.tar.gz +0 -0
  31. package/dist/deploy/pkg/nginx_binary/nginx-x86_64-ssl1.1.1.tar.gz +0 -0
  32. 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/publish.js CHANGED
@@ -8,13 +8,13 @@ import { setTimeout } from 'node:timers/promises';
8
8
  import { Gitlab } from '@gitbeaker/rest';
9
9
  import { releaseConf, __releaseDir } from './prepare.js';
10
10
  import { logger } from './logger.js';
11
- import { $ } from 'execa';
11
+ import { execa, $ } from 'execa';
12
12
  import 'yaml';
13
13
  import 'picocolors';
14
14
 
15
15
  async function isGitFlowRepo() {
16
16
  try {
17
- let { stdout } = await $("git config", ["--get-regexp", `^gitflow.`]);
17
+ let { stdout } = await execa("git config", ["--get-regexp", `^gitflow.`]);
18
18
  return stdout.toString().length > 0;
19
19
  } catch (error) {
20
20
  console.error("\u{1F680} ~ doGitFlowRelease ~ error:", error);
package/dist/release.js CHANGED
@@ -4,7 +4,7 @@ import pc from 'picocolors';
4
4
  import { pack } from './pack.js';
5
5
  import { getGitTags, selectLatestTag, publish, isGitFlowRepo } from './publish.js';
6
6
  import { checkEnvInfo, releaseConf } from './prepare.js';
7
- import { $ } from 'execa';
7
+ import { $, execa } from 'execa';
8
8
  import { logger } from './logger.js';
9
9
  import 'node:fs';
10
10
  import 'node:path';
@@ -96,7 +96,7 @@ async function doGitFlowRelease(version) {
96
96
  let { stdout: currentBranch } = await $(`git branch --show-current`);
97
97
  const releaseBranch = `release/${version}`;
98
98
  if (currentBranch !== "develop" && currentBranch !== releaseBranch) {
99
- const { stdout } = await $("git branch -a");
99
+ const { stdout } = await $`git branch -a`;
100
100
  const branches = stdout.split("\n").map((branch) => branch.trim().replace(/^\* /, ""));
101
101
  const preReleaseBranch = branches.includes(releaseBranch) ? releaseBranch : "develop";
102
102
  await execGitCheckout(preReleaseBranch);
@@ -120,7 +120,7 @@ async function doGitFlowRelease(version) {
120
120
  }
121
121
  }
122
122
  try {
123
- const npmVersionRes = await $(`npm version ${version} --no-git-tag-version`);
123
+ const npmVersionRes = await $`npm version ${version} --no-git-tag-version`;
124
124
  if (npmVersionRes.stderr) {
125
125
  logger.error("\u6DFB\u52A0\u7248\u672C\u4FE1\u606F\u5230package.json\u5931\u8D25");
126
126
  process.exit(1);
@@ -134,16 +134,16 @@ async function doGitFlowRelease(version) {
134
134
  }
135
135
  const hasUncommitted = await hasUncommittedChanges(true);
136
136
  if (hasUncommitted) {
137
- await $(`git add -A`);
138
- await $("git commit", ["-m", `Release version: ${version}`, "--no-verify"]);
137
+ await $`git add -A`;
138
+ await execa("git commit", ["-m", `Release version: ${version}`, "--no-verify"]);
139
139
  }
140
140
  await execWithPipe(`git flow release finish`, [version, "-m", `Release version: ${version}`]);
141
- await $(`git push --all`);
142
- await $(`git push --tags`);
141
+ await $`git push --all`;
142
+ await $`git push --tags`;
143
143
  return "master";
144
144
  }
145
145
  async function doCustomSpecifyBranchRelease() {
146
- const { stdout } = await $("git branch -r");
146
+ const { stdout } = await $`git branch -r`;
147
147
  const branches = stdout.split("\n").map((branch) => branch.trim()).filter((item) => !item.startsWith("origin/HEAD")).map((branch) => ({ value: branch.replace("origin/", "") }));
148
148
  const selectedBranch = await inquirer.select({
149
149
  message: "\u8BF7\u9009\u62E9\u76EE\u6807\u5206\u652F, \u5206\u652F\u672A\u627E\u5230\uFF0C\u8BF7\u5148\u5C06\u672C\u5730\u5206\u652F\u63A8\u5230\u8FDC\u7AEF\uFF0C\u518D\u6267\u884C\u6B64\u547D\u4EE4",
@@ -164,7 +164,7 @@ async function hasUncommittedChanges(boolReturned = false) {
164
164
  }
165
165
  async function execGitPullOrigin(remoteTargetBranch) {
166
166
  logger.tip(`${remoteTargetBranch} syncing...`);
167
- const syncReleaseBranchRes = $("git", ["pull", "origin", remoteTargetBranch]);
167
+ const syncReleaseBranchRes = execa("git", ["pull", "origin", remoteTargetBranch]);
168
168
  syncReleaseBranchRes.stdout.pipe(process.stdout);
169
169
  syncReleaseBranchRes.stderr.pipe(process.stderr);
170
170
  const res = await syncReleaseBranchRes;
@@ -174,7 +174,7 @@ async function execGitPullOrigin(remoteTargetBranch) {
174
174
  }
175
175
  }
176
176
  async function execWithPipe(...args) {
177
- const execRes = $(...args);
177
+ const execRes = execa(...args);
178
178
  execRes.stdout.pipe(process.stdout);
179
179
  execRes.stderr.pipe(process.stderr);
180
180
  const result = await execRes;
@@ -182,13 +182,13 @@ async function execWithPipe(...args) {
182
182
  }
183
183
  async function execGitCheckout(remoteTargetBranch) {
184
184
  await hasUncommittedChanges();
185
- const { stdout: prevCurrentBranch } = await $(`git branch --show-current`);
185
+ const { stdout: prevCurrentBranch } = await $`git branch --show-current`;
186
186
  if (prevCurrentBranch !== remoteTargetBranch) {
187
- const execRes = $(`git checkout ${remoteTargetBranch}`);
187
+ const execRes = execa(`git checkout ${remoteTargetBranch}`);
188
188
  execRes.stdout.pipe(process.stdout);
189
189
  execRes.stderr.pipe(process.stderr);
190
190
  const result = await execRes;
191
- const { stdout: currentBranch } = await $(`git branch --show-current`);
191
+ const { stdout: currentBranch } = await $`git branch --show-current`;
192
192
  if (currentBranch !== remoteTargetBranch) {
193
193
  logger.error(`\u76EE\u6807\u53D1\u5E03\u5206\u652F[${remoteTargetBranch}] checkout \u5931\u8D25`);
194
194
  return Promise.reject(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjwjq/release-helper",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "generate deployment package for frontend, include nginx...",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,39 +0,0 @@
1
- #!/bin/bash
2
- # current nginx source code version 1.22.1
3
-
4
- ./configure \
5
- --prefix=/etc/nginx \
6
- --conf-path=/etc/nginx/nginx.conf \
7
- --error-log-path=/var/log/nginx/error.log \
8
- --http-log-path=/var/log/nginx/access.log \
9
- --pid-path=/var/run/nginx.pid \
10
- --lock-path=/var/run/nginx/nginx.lock \
11
- --with-http_ssl_module \
12
- --with-http_v2_module \
13
- --with-http_gzip_static_module \
14
- --with-http_stub_status_module \
15
- --with-stream \
16
- --with-pcre
17
-
18
- make
19
-
20
- make install
21
-
22
- echo '------------------compile and install done----------------------------'
23
-
24
- arch=$(uname -m)
25
- ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
26
-
27
- if [[ -z "${arch}" ]]; then
28
- arch="x86_64"
29
- fi
30
-
31
- if [[ -z "${ssl_version}" ]]; then
32
- ssl_version="1.0.2"
33
- fi
34
-
35
- cd /etc || exit
36
-
37
- tar -zcvf nginx-"$arch"-ssl"$ssl_version".tar.gz nginx/ -C /root
38
-
39
- echo "-----------pack at: /root nginx-"$arch"-ssl"$ssl_version".tar.gz--------------"