@pisell/common 0.0.52 → 0.0.55
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.
|
@@ -120,7 +120,8 @@ var Release = /*#__PURE__*/function () {
|
|
|
120
120
|
return releaseProject(this.conn, {
|
|
121
121
|
path: this.outPath,
|
|
122
122
|
fileName: "".concat(this.version),
|
|
123
|
-
isSSR: this.isSSR
|
|
123
|
+
isSSR: this.isSSR,
|
|
124
|
+
env: this.env
|
|
124
125
|
});
|
|
125
126
|
case 2:
|
|
126
127
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -359,7 +359,8 @@ var UploadCode = /*#__PURE__*/function () {
|
|
|
359
359
|
path: this.outPath,
|
|
360
360
|
fileName: "".concat(this.currentVersion),
|
|
361
361
|
fullFileName: "".concat(this.projectName, "-").concat(this.currentVersion, ".zip"),
|
|
362
|
-
changelog: this.changelog
|
|
362
|
+
changelog: this.changelog,
|
|
363
|
+
env: this.env
|
|
363
364
|
});
|
|
364
365
|
case 2:
|
|
365
366
|
return _context7.abrupt("return", _context7.sent);
|
package/es/script/utils/index.js
CHANGED
|
@@ -161,7 +161,8 @@ 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
|
|
164
|
+
changelog = _ref5.changelog,
|
|
165
|
+
env = _ref5.env;
|
|
165
166
|
if (!conn) return Promise.reject('未连接服务器');
|
|
166
167
|
// 文件全名
|
|
167
168
|
return new Promise(function (resolve, reject) {
|
|
@@ -171,7 +172,7 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
|
|
|
171
172
|
reject(err);
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
|
-
stream.end(" sudo -i\n cd /tmp\n mv ".concat(fullFileName, " ").concat(path, "\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 exit\n ") // 打开到path
|
|
175
|
+
stream.end(" ".concat(env === 'prod' ? 'sudo -i' : '', "\n cd /tmp\n mv ").concat(fullFileName, " ").concat(path, "\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 ").concat(env === 'prod' ? 'exit' : '', "\n ") // 打开到path
|
|
175
176
|
// 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
|
|
176
177
|
// 删除1.0.0.zip
|
|
177
178
|
// 写入changelog到changelog.md
|
|
@@ -194,7 +195,8 @@ var serverUnpack = function serverUnpack(conn, _ref5) {
|
|
|
194
195
|
var releaseProject = function releaseProject(conn, _ref6) {
|
|
195
196
|
var path = _ref6.path,
|
|
196
197
|
fileName = _ref6.fileName,
|
|
197
|
-
isSSR = _ref6.isSSR
|
|
198
|
+
isSSR = _ref6.isSSR,
|
|
199
|
+
env = _ref6.env;
|
|
198
200
|
return new Promise(function (resolve, reject) {
|
|
199
201
|
conn.shell(function (err, stream) {
|
|
200
202
|
if (err) {
|
|
@@ -202,7 +204,7 @@ var releaseProject = function releaseProject(conn, _ref6) {
|
|
|
202
204
|
reject(err);
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
|
-
stream.end(" 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 master\n cp -R next-master master\n rm -rf next-master\n ").concat(isSSR ? 'pm2 restart server.js' : '', "\n exit\n
|
|
207
|
+
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 master\n cp -R next-master master\n rm -rf next-master\n ").concat(isSSR ? 'pm2 restart server.js' : '', "\n exit\n ").concat(env === 'prod' ? 'exit' : '', "\n ") // 打开到path
|
|
206
208
|
// 复制pre-master到next-master
|
|
207
209
|
// 删除pre-master
|
|
208
210
|
// 复制1.0.0到next-master
|
|
@@ -189,7 +189,8 @@ var UploadCode = class {
|
|
|
189
189
|
path: this.outPath,
|
|
190
190
|
fileName: `${this.currentVersion}`,
|
|
191
191
|
fullFileName: `${this.projectName}-${this.currentVersion}.zip`,
|
|
192
|
-
changelog: this.changelog
|
|
192
|
+
changelog: this.changelog,
|
|
193
|
+
env: this.env
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
196
|
/**
|
|
@@ -115,7 +115,7 @@ var serverUpload = (conn, { localPath, remotePath }) => {
|
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
};
|
|
118
|
-
var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) => {
|
|
118
|
+
var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog, env }) => {
|
|
119
119
|
if (!conn)
|
|
120
120
|
return Promise.reject("未连接服务器");
|
|
121
121
|
return new Promise((resolve, reject) => {
|
|
@@ -126,7 +126,7 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) =>
|
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
stream.end(
|
|
129
|
-
` sudo -i
|
|
129
|
+
` ${env === "prod" ? "sudo -i" : ""}
|
|
130
130
|
cd /tmp
|
|
131
131
|
mv ${fullFileName} ${path2}
|
|
132
132
|
cd ${path2}
|
|
@@ -135,7 +135,7 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) =>
|
|
|
135
135
|
echo "${changelog}" > ./${fileName}/changelog.md
|
|
136
136
|
sh deleteOldVersion.sh
|
|
137
137
|
exit
|
|
138
|
-
exit
|
|
138
|
+
${env === "prod" ? "exit" : ""}
|
|
139
139
|
`
|
|
140
140
|
// 打开到path
|
|
141
141
|
// 解压 1.0.0.zip 文件到 1.0.0 移动dist中内容到 1.0.0内 删除dist
|
|
@@ -151,7 +151,7 @@ var serverUnpack = (conn, { path: path2, fileName, fullFileName, changelog }) =>
|
|
|
151
151
|
});
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
|
-
var releaseProject = (conn, { path: path2, fileName, isSSR }) => {
|
|
154
|
+
var releaseProject = (conn, { path: path2, fileName, isSSR, env }) => {
|
|
155
155
|
return new Promise((resolve, reject) => {
|
|
156
156
|
conn.shell((err, stream) => {
|
|
157
157
|
if (err) {
|
|
@@ -160,7 +160,7 @@ var releaseProject = (conn, { path: path2, fileName, isSSR }) => {
|
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
stream.end(
|
|
163
|
-
` sudo -i
|
|
163
|
+
` ${env === "prod" ? "sudo -i" : ""}
|
|
164
164
|
cd ${path2}
|
|
165
165
|
cp -R -f pre-master next-master
|
|
166
166
|
rm -rf pre-master
|
|
@@ -171,7 +171,7 @@ var releaseProject = (conn, { path: path2, fileName, isSSR }) => {
|
|
|
171
171
|
rm -rf next-master
|
|
172
172
|
${isSSR ? "pm2 restart server.js" : ""}
|
|
173
173
|
exit
|
|
174
|
-
|
|
174
|
+
${env === "prod" ? "exit" : ""}
|
|
175
175
|
`
|
|
176
176
|
// 打开到path
|
|
177
177
|
// 复制pre-master到next-master
|