@whyour/qinglong 0.7.3 → 0.7.5
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.
package/docker/Dockerfile
CHANGED
|
@@ -33,6 +33,7 @@ COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_module
|
|
|
33
33
|
|
|
34
34
|
RUN set -x && \
|
|
35
35
|
ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
|
|
36
|
+
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
|
36
37
|
apt update && \
|
|
37
38
|
apt upgrade -y && \
|
|
38
39
|
apt install --no-install-recommends -y git \
|
package/package.json
CHANGED
package/shell/check.sh
CHANGED
|
@@ -20,6 +20,7 @@ const lastVersionFile = `https://qn.whyour.cn/version.yaml`;
|
|
|
20
20
|
const rootPath = process.env.QL_DIR;
|
|
21
21
|
const envFound = dotenv_1.default.config({ path: path_1.default.join(rootPath, '.env') });
|
|
22
22
|
let dataPath = path_1.default.join(rootPath, 'data/');
|
|
23
|
+
const shellPath = path_1.default.join(rootPath, 'shell/');
|
|
23
24
|
const tmpPath = path_1.default.join(rootPath, '.tmp/');
|
|
24
25
|
if (process.env.QL_DATA_DIR) {
|
|
25
26
|
dataPath = process.env.QL_DATA_DIR;
|
|
@@ -45,6 +46,7 @@ const loginFaild = '请先登录!';
|
|
|
45
46
|
const configString = 'config sample crontab shareCode diy';
|
|
46
47
|
const versionFile = path_1.default.join(rootPath, 'version.yaml');
|
|
47
48
|
const dataTgzFile = path_1.default.join(tmpPath, 'data.tgz');
|
|
49
|
+
const shareShellFile = path_1.default.join(shellPath, 'share.sh');
|
|
48
50
|
if (envFound.error) {
|
|
49
51
|
throw new Error("⚠️ Couldn't find .env file ⚠️");
|
|
50
52
|
}
|
|
@@ -63,6 +65,7 @@ exports.default = {
|
|
|
63
65
|
tmpPath,
|
|
64
66
|
dataPath,
|
|
65
67
|
dataTgzFile,
|
|
68
|
+
shareShellFile,
|
|
66
69
|
configString,
|
|
67
70
|
loginFaild,
|
|
68
71
|
authError,
|
|
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const typedi_1 = require("typedi");
|
|
30
30
|
const winston_1 = __importDefault(require("winston"));
|
|
31
|
+
const config_1 = __importDefault(require("../config"));
|
|
31
32
|
const dependence_1 = require("../data/dependence");
|
|
32
33
|
const cross_spawn_1 = require("cross-spawn");
|
|
33
34
|
const sock_1 = __importDefault(require("./sock"));
|
|
@@ -169,14 +170,14 @@ let DependenceService = class DependenceService {
|
|
|
169
170
|
const isPythonDependence = dependency.type === dependence_1.DependenceTypes.python3;
|
|
170
171
|
const depInfo = (await (0, util_1.promiseExecSuccess)(isNodeDependence
|
|
171
172
|
? `${getCommandPrefix} | grep "${depName}" | head -1`
|
|
172
|
-
: `${getCommandPrefix} ${depName}`)).replace(/\s{2,}/, ' ');
|
|
173
|
+
: `${getCommandPrefix} ${depName}`)).replace(/\s{2,}/, ' ').replace(/\s+$/, '');
|
|
173
174
|
if (depInfo &&
|
|
174
175
|
((isNodeDependence && ((_a = depInfo.split(' ')) === null || _a === void 0 ? void 0 : _a[0]) === depName) ||
|
|
175
176
|
(isLinuxDependence && depInfo.toLocaleLowerCase().includes('installed')) ||
|
|
176
177
|
isPythonDependence) &&
|
|
177
178
|
(!depVersion || depInfo.includes(depVersion))) {
|
|
178
179
|
const endTime = (0, dayjs_1.default)();
|
|
179
|
-
const _message = `检测到已经安装 ${depName}\n\n${depInfo}\n跳过安装\n\n依赖${actionText}成功,结束时间 ${endTime.format('YYYY-MM-DD HH:mm:ss')},耗时 ${endTime.diff(startTime, 'second')} 秒`;
|
|
180
|
+
const _message = `检测到已经安装 ${depName}\n\n${depInfo}\n\n跳过安装\n\n依赖${actionText}成功,结束时间 ${endTime.format('YYYY-MM-DD HH:mm:ss')},耗时 ${endTime.diff(startTime, 'second')} 秒`;
|
|
180
181
|
this.sockService.sendMessage({
|
|
181
182
|
type: socketMessageType,
|
|
182
183
|
message: _message,
|
|
@@ -187,7 +188,7 @@ let DependenceService = class DependenceService {
|
|
|
187
188
|
return resolve(null);
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
|
-
const cp = (0, cross_spawn_1.spawn)(
|
|
191
|
+
const cp = (0, cross_spawn_1.spawn)(`source ${config_1.default.shareShellFile} && ${depRunCommand} ${dependency.name.trim()}`, {
|
|
191
192
|
shell: '/bin/bash',
|
|
192
193
|
});
|
|
193
194
|
cp.stdout.on('data', async (data) => {
|