@pisell/common 0.0.37 → 0.0.39

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.
@@ -87,7 +87,7 @@ var uploadFile = /*#__PURE__*/function () {
87
87
  Key: "static/".concat(directory, "/").concat(fileKey),
88
88
  // 指定目录路径
89
89
  Body: fileStream,
90
- contentType: contentType,
90
+ ContentType: contentType,
91
91
  ACL: 'public-read' // 设置ACL权限为公共读取
92
92
  };
93
93
  command = new PutObjectCommand(uploadParams);
@@ -7,7 +7,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
7
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
8
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
9
  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); }
10
- import { outPathMap } from "../constants/index.js";
10
+ import { isSsrMap, outPathMap } from "../constants/index.js";
11
11
  import { connectServer as _connectServer, getServerConfig, releaseProject } from "../utils/index.js";
12
12
 
13
13
  /**
@@ -27,6 +27,8 @@ var Release = /*#__PURE__*/function () {
27
27
  this.version = version;
28
28
  this.conn = conn;
29
29
  this.outPath = outPathMap[this.projectName][this.env];
30
+ // 是否是ssr项目
31
+ this.isSSR = isSsrMap[this.projectName];
30
32
  }
31
33
 
32
34
  /**
@@ -115,7 +117,8 @@ var Release = /*#__PURE__*/function () {
115
117
  _context3.next = 2;
116
118
  return releaseProject(this.conn, {
117
119
  path: this.outPath,
118
- fileName: "".concat(this.version)
120
+ fileName: "".concat(this.version),
121
+ isSSR: this.isSSR
119
122
  });
120
123
  case 2:
121
124
  return _context3.abrupt("return", _context3.sent);
@@ -360,8 +360,7 @@ var UploadCode = /*#__PURE__*/function () {
360
360
  path: this.outPath,
361
361
  fileName: "".concat(this.currentVersion),
362
362
  fullFileName: "".concat(this.currentVersion, ".zip"),
363
- changelog: this.changelog,
364
- isSSR: this.isSSR
363
+ changelog: this.changelog
365
364
  });
366
365
  case 2:
367
366
  return _context7.abrupt("return", _context7.sent);
@@ -161,8 +161,7 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
161
161
  var path = _ref5.path,
162
162
  fileName = _ref5.fileName,
163
163
  fullFileName = _ref5.fullFileName,
164
- changelog = _ref5.changelog,
165
- isSSR = _ref5.isSSR;
164
+ changelog = _ref5.changelog;
166
165
  if (!conn) return Promise.reject('未连接服务器');
167
166
  // 文件全名
168
167
  return new Promise(function (resolve, reject) {
@@ -172,7 +171,7 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
172
171
  reject(err);
173
172
  return;
174
173
  }
175
- 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
174
+ 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
176
175
  // 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
177
176
  // 删除1.0.0.zip
178
177
  // 写入changelog到changelog.md
@@ -194,7 +193,8 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
194
193
  */
195
194
  var releaseProject = function releaseProject(conn, _ref6) {
196
195
  var path = _ref6.path,
197
- fileName = _ref6.fileName;
196
+ fileName = _ref6.fileName,
197
+ isSSR = _ref6.isSSR;
198
198
  return new Promise(function (resolve, reject) {
199
199
  conn.shell(function (err, stream) {
200
200
  if (err) {
@@ -202,7 +202,7 @@ var releaseProject = function releaseProject(conn, _ref6) {
202
202
  reject(err);
203
203
  return;
204
204
  }
205
- stream.end("\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 master\n cp -R next-master master\n rm -rf next-master\n exit\n ") // 打开到path
205
+ stream.end("\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 master\n cp -R next-master master\n rm -rf next-master\n ").concat(isSSR ? 'pm2 restart server.js' : '', "\n exit\n ") // 打开到path
206
206
  // 复制pre-master到next-master
207
207
  // 删除pre-master
208
208
  // 复制1.0.0到next-master
@@ -74,7 +74,7 @@ var uploadFile = async (directory, fileKey, filePath) => {
74
74
  Key: `static/${directory}/${fileKey}`,
75
75
  // 指定目录路径
76
76
  Body: fileStream,
77
- contentType,
77
+ ContentType: contentType,
78
78
  ACL: "public-read"
79
79
  // 设置ACL权限为公共读取
80
80
  };
@@ -32,6 +32,7 @@ var Release = class {
32
32
  this.version = version;
33
33
  this.conn = conn;
34
34
  this.outPath = import_constants.outPathMap[this.projectName][this.env];
35
+ this.isSSR = import_constants.isSsrMap[this.projectName];
35
36
  }
36
37
  /**
37
38
  * @Title: 设置连接服务器配置
@@ -72,7 +73,8 @@ var Release = class {
72
73
  async release() {
73
74
  return await (0, import_utils.releaseProject)(this.conn, {
74
75
  path: this.outPath,
75
- fileName: `${this.version}`
76
+ fileName: `${this.version}`,
77
+ isSSR: this.isSSR
76
78
  });
77
79
  }
78
80
  /**
@@ -187,8 +187,7 @@ var UploadCode = class {
187
187
  path: this.outPath,
188
188
  fileName: `${this.currentVersion}`,
189
189
  fullFileName: `${this.currentVersion}.zip`,
190
- changelog: this.changelog,
191
- isSSR: this.isSSR
190
+ changelog: this.changelog
192
191
  });
193
192
  }
194
193
  /**
@@ -114,7 +114,7 @@ var serverUpload = (conn, { localPath, remotePath }) => {
114
114
  });
115
115
  });
116
116
  };
117
- var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, isSSR }) => {
117
+ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) => {
118
118
  if (!conn)
119
119
  return Promise.reject("未连接服务器");
120
120
  return new Promise((resolve, reject) => {
@@ -131,7 +131,6 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, isSS
131
131
  rm -rf ${fullFileName}
132
132
  echo "${changelog}" > ./${fileName}/changelog.md
133
133
  sh deleteOldVersion.sh
134
- ${isSSR ? "pm2 restart server.js" : ""}
135
134
  exit
136
135
  `
137
136
  // 打开到path
@@ -148,7 +147,7 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, isSS
148
147
  });
149
148
  });
150
149
  };
151
- var releaseProject = (conn, { path: path2, fileName }) => {
150
+ var releaseProject = (conn, { path: path2, fileName, isSSR }) => {
152
151
  return new Promise((resolve, reject) => {
153
152
  conn.shell((err, stream) => {
154
153
  if (err) {
@@ -166,6 +165,7 @@ var releaseProject = (conn, { path: path2, fileName }) => {
166
165
  rm -rf master
167
166
  cp -R next-master master
168
167
  rm -rf next-master
168
+ ${isSSR ? "pm2 restart server.js" : ""}
169
169
  exit
170
170
  `
171
171
  // 打开到path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [