@pisell/common 0.0.20 → 0.0.21

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.
@@ -8,6 +8,22 @@ var outPathMap = {
8
8
  prod: '../data/release/project/pisell_v2',
9
9
  release: '../data/release/project/pisell_v2',
10
10
  pre: '../data/release/project/pisell_v2'
11
+ },
12
+ my_pisel_pc_v2: {
13
+ prod: '../data/release/project/my_pisel_pc_v2',
14
+ release: '../data/release/project/my_pisel_pc_v2',
15
+ pre: '../data/release/project/my_pisel_pc_v2'
16
+ },
17
+ my_pisel_h5_v2: {
18
+ prod: '../data/release/project/my_pisel_h5_v2',
19
+ release: '../data/release/project/my_pisel_h5_v2',
20
+ pre: '../data/release/project/my_pisel_h5_v2'
11
21
  }
12
22
  };
13
- export { outPathMap };
23
+ var isSsrMap = {
24
+ my_pisel_shop: false,
25
+ admin: false,
26
+ my_pisel_pc_v2: true,
27
+ my_pisel_h5_v2: true
28
+ };
29
+ export { outPathMap, isSsrMap };
@@ -11,7 +11,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
11
11
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
12
  import archiver from 'archiver';
13
13
  import path from 'path';
14
- import { outPathMap } from "../constants/index.js";
14
+ import { isSsrMap, outPathMap } from "../constants/index.js";
15
15
  import { connectServer as _connectServer, getGitCurrentBranch, getServerConfig, isWorkingTreeClean, serverUnpack as _serverUnpack, serverUpload as _serverUpload } from "../utils/index.js";
16
16
 
17
17
  /**
@@ -37,6 +37,8 @@ var UploadCode = /*#__PURE__*/function () {
37
37
  this.projectAbsolutePath = '';
38
38
  this.conn = null;
39
39
  this.serverConfig = null;
40
+ // 是否是ssr项目
41
+ this.isSSR = isSsrMap[this.projectName];
40
42
  this.outPath = outPathMap[this.projectName][this.env];
41
43
  }
42
44
 
@@ -342,7 +344,8 @@ var UploadCode = /*#__PURE__*/function () {
342
344
  path: this.outPath,
343
345
  fileName: "".concat(this.currentVersion),
344
346
  fullFileName: "".concat(this.currentVersion, ".zip"),
345
- changelog: this.changelog
347
+ changelog: this.changelog,
348
+ isSSR: this.isSSR
346
349
  });
347
350
  case 2:
348
351
  return _context7.abrupt("return", _context7.sent);
@@ -155,7 +155,8 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
155
155
  var path = _ref5.path,
156
156
  fileName = _ref5.fileName,
157
157
  fullFileName = _ref5.fullFileName,
158
- changelog = _ref5.changelog;
158
+ changelog = _ref5.changelog,
159
+ isSSR = _ref5.isSSR;
159
160
  if (!conn) return Promise.reject('未连接服务器');
160
161
  // 文件全名
161
162
  return new Promise(function (resolve, reject) {
@@ -165,7 +166,7 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
165
166
  reject(err);
166
167
  return;
167
168
  }
168
- stream.end("\n cd ".concat(path, "\n unzip ").concat(fullFileName, " -d ").concat(fileName, " && mv ").concat(fileName, "/dist/* ").concat(fileName, "/ && rmdir ").concat(fileName, "/dist\n rm -rf ").concat(fullFileName, "\n echo \"").concat(changelog, "\" > ./").concat(fileName, "/changelog.md\n sh deleteOldVersion.sh\n exit\n ") // 打开到path
169
+ stream.end("\n cd ".concat(path, "\n unzip ").concat(fullFileName, " -d ").concat(fileName, " && mv ").concat(fileName, "/dist/* ").concat(fileName, "/ && rmdir ").concat(fileName, "/dist\n rm -rf ").concat(fullFileName, "\n echo \"").concat(changelog, "\" > ./").concat(fileName, "/changelog.md\n sh deleteOldVersion.sh\n ").concat(isSSR ? 'pm2 restart server.js' : '', "\n exit\n ") // 打开到path
169
170
  // 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
170
171
  // 删除1.0.0.zip
171
172
  // 写入changelog到changelog.md
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/script/constants/index.js
20
20
  var constants_exports = {};
21
21
  __export(constants_exports, {
22
+ isSsrMap: () => isSsrMap,
22
23
  outPathMap: () => outPathMap
23
24
  });
24
25
  module.exports = __toCommonJS(constants_exports);
@@ -32,9 +33,26 @@ var outPathMap = {
32
33
  prod: "../data/release/project/pisell_v2",
33
34
  release: "../data/release/project/pisell_v2",
34
35
  pre: "../data/release/project/pisell_v2"
36
+ },
37
+ my_pisel_pc_v2: {
38
+ prod: "../data/release/project/my_pisel_pc_v2",
39
+ release: "../data/release/project/my_pisel_pc_v2",
40
+ pre: "../data/release/project/my_pisel_pc_v2"
41
+ },
42
+ my_pisel_h5_v2: {
43
+ prod: "../data/release/project/my_pisel_h5_v2",
44
+ release: "../data/release/project/my_pisel_h5_v2",
45
+ pre: "../data/release/project/my_pisel_h5_v2"
35
46
  }
36
47
  };
48
+ var isSsrMap = {
49
+ my_pisel_shop: false,
50
+ admin: false,
51
+ my_pisel_pc_v2: true,
52
+ my_pisel_h5_v2: true
53
+ };
37
54
  // Annotate the CommonJS export names for ESM import in node:
38
55
  0 && (module.exports = {
56
+ isSsrMap,
39
57
  outPathMap
40
58
  });
@@ -49,6 +49,7 @@ var UploadCode = class {
49
49
  this.projectAbsolutePath = "";
50
50
  this.conn = null;
51
51
  this.serverConfig = null;
52
+ this.isSSR = import_constants.isSsrMap[this.projectName];
52
53
  this.outPath = import_constants.outPathMap[this.projectName][this.env];
53
54
  }
54
55
  /**
@@ -183,7 +184,8 @@ var UploadCode = class {
183
184
  path: this.outPath,
184
185
  fileName: `${this.currentVersion}`,
185
186
  fullFileName: `${this.currentVersion}.zip`,
186
- changelog: this.changelog
187
+ changelog: this.changelog,
188
+ isSSR: this.isSSR
187
189
  });
188
190
  }
189
191
  /**
@@ -112,7 +112,7 @@ var serverUpload = (conn, { localPath, remotePath }) => {
112
112
  });
113
113
  });
114
114
  };
115
- var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) => {
115
+ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, isSSR }) => {
116
116
  if (!conn)
117
117
  return Promise.reject("未连接服务器");
118
118
  return new Promise((resolve, reject) => {
@@ -129,6 +129,7 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) =>
129
129
  rm -rf ${fullFileName}
130
130
  echo "${changelog}" > ./${fileName}/changelog.md
131
131
  sh deleteOldVersion.sh
132
+ ${isSSR ? "pm2 restart server.js" : ""}
132
133
  exit
133
134
  `
134
135
  // 打开到path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [