@pisell/common 0.0.59 → 0.0.61

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.
@@ -6,7 +6,9 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
6
6
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
7
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
8
  import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
9
+ import { NodeHttpHandler } from '@smithy/node-http-handler';
9
10
  import fs from 'fs';
11
+ import { Agent } from 'https';
10
12
  import mime from 'mime-types';
11
13
  import path from 'path';
12
14
  import { getServerConfig } from "../utils/index.js";
@@ -47,7 +49,17 @@ var init = /*#__PURE__*/function () {
47
49
  credentials: {
48
50
  accessKeyId: awsConfig.accessKeyId,
49
51
  secretAccessKey: awsConfig.secretAccessKey
50
- }
52
+ },
53
+ requestHandler: new NodeHttpHandler({
54
+ httpsAgent: new Agent({
55
+ maxSockets: 500,
56
+ // keepAlive is a default from AWS SDK. We want to preserve this for
57
+ // performance reasons.
58
+ keepAlive: true,
59
+ keepAliveMsecs: 1000
60
+ }),
61
+ socketTimeout: 5000
62
+ })
51
63
  });
52
64
  console.log('aws 初始化成功');
53
65
  return _context.abrupt("return", serverConfig.aws);
@@ -26,11 +26,11 @@ var outPathMap = {
26
26
  }
27
27
  };
28
28
  var isSsrMap = {
29
- my_pisel_shop: false,
29
+ my_pisel_shop: true,
30
30
  admin: false,
31
31
  my_pisel_pc_v2: true,
32
32
  my_pisel_h5_v2: true,
33
- pisell2_pages: false
33
+ pisell2_pages: true
34
34
  };
35
35
  var checkPackages = ['@pisell/date-picker', '@pisell/lowcode-renderer', '@pisell/common', '@pisell/utils'];
36
36
 
@@ -122,7 +122,8 @@ var Release = /*#__PURE__*/function () {
122
122
  fileName: "".concat(this.version),
123
123
  isSSR: this.isSSR,
124
124
  env: this.env,
125
- branch: grayBranch
125
+ branch: grayBranch,
126
+ projectName: this.projectName
126
127
  });
127
128
  case 2:
128
129
  return _context3.abrupt("return", _context3.sent);
@@ -234,7 +234,7 @@ function _init() {
234
234
  case 65:
235
235
  branch = _context.sent;
236
236
  grayBranch = 'master';
237
- if (!originBranch.includes(branch)) {
237
+ if (!originBranch.includes(branch.trim())) {
238
238
  grayBranch = branch;
239
239
  }
240
240
  _context.next = 70;
@@ -198,7 +198,10 @@ var releaseProject = function releaseProject(conn, _ref6) {
198
198
  isSSR = _ref6.isSSR,
199
199
  env = _ref6.env,
200
200
  _ref6$branch = _ref6.branch,
201
- branch = _ref6$branch === void 0 ? 'master' : _ref6$branch;
201
+ branch = _ref6$branch === void 0 ? 'master' : _ref6$branch,
202
+ projectName = _ref6.projectName;
203
+ // 灰度项目的话重启目录不同 目前只有 my_pisel_shop和pisell2_pages走这个逻辑
204
+ var isGrayRestart = ['my_pisel_shop', 'pisell2_pages'].includes(projectName);
202
205
  return new Promise(function (resolve, reject) {
203
206
  conn.shell(function (err, stream) {
204
207
  if (err) {
@@ -206,7 +209,7 @@ var releaseProject = function releaseProject(conn, _ref6) {
206
209
  reject(err);
207
210
  return;
208
211
  }
209
- stream.end(" ".concat(env === 'prod' ? 'sudo -i' : '', "\n cd ").concat(path, "\n cp -R -f pre-master next-master\n rm -rf pre-master\n \\cp -R -f ").concat(fileName, "/* next-master\n cp -R -f ").concat(fileName, " pre-master\n rm -rf ").concat(branch, "\n cp -R next-master ").concat(branch, "\n rm -rf next-master\n ").concat(isSSR ? 'pm2 restart server.js' : '', "\n exit\n ").concat(env === 'prod' ? 'exit' : '', "\n ") // 打开到path
212
+ stream.end(" ".concat(env === 'prod' ? 'sudo -i' : '', "\n cd ").concat(path, "\n cp -R -f pre-master next-master\n rm -rf pre-master\n \\cp -R -f ").concat(fileName, "/* next-master\n cp -R -f ").concat(fileName, " pre-master\n rm -rf ").concat(branch, "\n cp -R next-master ").concat(branch, "\n rm -rf next-master\n ").concat(isGrayRestart && isSSR ? "cd ../front_service\n pm2 restart ".concat(projectName, ".js\n ") : '', "\n ").concat(!isGrayRestart && isSSR ? 'pm2 restart server.js' : '', "\n exit\n ").concat(env === 'prod' ? 'exit' : '', "\n ") // 打开到path
210
213
  // 复制pre-master到next-master
211
214
  // 删除pre-master
212
215
  // 复制1.0.0到next-master
@@ -34,7 +34,9 @@ __export(aws_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(aws_exports);
36
36
  var import_client_s3 = require("@aws-sdk/client-s3");
37
+ var import_node_http_handler = require("@smithy/node-http-handler");
37
38
  var import_fs = __toESM(require("fs"));
39
+ var import_https = require("https");
38
40
  var import_mime_types = __toESM(require("mime-types"));
39
41
  var import_path = __toESM(require("path"));
40
42
  var import_utils = require("../utils/index.js");
@@ -53,7 +55,17 @@ var init = async () => {
53
55
  credentials: {
54
56
  accessKeyId: awsConfig.accessKeyId,
55
57
  secretAccessKey: awsConfig.secretAccessKey
56
- }
58
+ },
59
+ requestHandler: new import_node_http_handler.NodeHttpHandler({
60
+ httpsAgent: new import_https.Agent({
61
+ maxSockets: 500,
62
+ // keepAlive is a default from AWS SDK. We want to preserve this for
63
+ // performance reasons.
64
+ keepAlive: true,
65
+ keepAliveMsecs: 1e3
66
+ }),
67
+ socketTimeout: 5e3
68
+ })
57
69
  });
58
70
  console.log("aws 初始化成功");
59
71
  return serverConfig.aws;
@@ -53,11 +53,11 @@ var outPathMap = {
53
53
  }
54
54
  };
55
55
  var isSsrMap = {
56
- my_pisel_shop: false,
56
+ my_pisel_shop: true,
57
57
  admin: false,
58
58
  my_pisel_pc_v2: true,
59
59
  my_pisel_h5_v2: true,
60
- pisell2_pages: false
60
+ pisell2_pages: true
61
61
  };
62
62
  var checkPackages = [
63
63
  "@pisell/date-picker",
@@ -76,7 +76,8 @@ var Release = class {
76
76
  fileName: `${this.version}`,
77
77
  isSSR: this.isSSR,
78
78
  env: this.env,
79
- branch: grayBranch
79
+ branch: grayBranch,
80
+ projectName: this.projectName
80
81
  });
81
82
  }
82
83
  /**
@@ -185,7 +185,7 @@ async function init() {
185
185
  console.log("开始发布");
186
186
  const branch = await (0, import_utils.getGitCurrentBranch)();
187
187
  let grayBranch = "master";
188
- if (!import_constants.originBranch.includes(branch)) {
188
+ if (!import_constants.originBranch.includes(branch.trim())) {
189
189
  grayBranch = branch;
190
190
  }
191
191
  await releaseInstance.release(grayBranch);
@@ -151,7 +151,10 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, env
151
151
  });
152
152
  });
153
153
  };
154
- var releaseProject = (conn, { path: path2, fileName, isSSR, env, branch = "master" }) => {
154
+ var releaseProject = (conn, { path: path2, fileName, isSSR, env, branch = "master", projectName }) => {
155
+ const isGrayRestart = ["my_pisel_shop", "pisell2_pages"].includes(
156
+ projectName
157
+ );
155
158
  return new Promise((resolve, reject) => {
156
159
  conn.shell((err, stream) => {
157
160
  if (err) {
@@ -169,7 +172,10 @@ var releaseProject = (conn, { path: path2, fileName, isSSR, env, branch = "maste
169
172
  rm -rf ${branch}
170
173
  cp -R next-master ${branch}
171
174
  rm -rf next-master
172
- ${isSSR ? "pm2 restart server.js" : ""}
175
+ ${isGrayRestart && isSSR ? `cd ../front_service
176
+ pm2 restart ${projectName}.js
177
+ ` : ""}
178
+ ${!isGrayRestart && isSSR ? "pm2 restart server.js" : ""}
173
179
  exit
174
180
  ${env === "prod" ? "exit" : ""}
175
181
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.59",
3
+ "version": "0.0.61",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -59,6 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@aws-sdk/client-s3": "^3.456.0",
62
+ "@smithy/node-http-handler": "^2.1.10",
62
63
  "antd5": "npm:antd@^5.5.0",
63
64
  "archiver": "^5.3.1",
64
65
  "array-move": "^3.0.1",