jjb-cmd 2.2.3 → 2.2.4
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/README.md +4 -0
- package/package.json +1 -1
- package/src/new/cmd.auth/index.js +1 -26
- package/src/new/cmd.init/index.js +1 -116
- package/src/new/cmd.install/config.js +1 -70
- package/src/new/cmd.install/index.js +1 -262
- package/src/new/cmd.install/tools.js +1 -230
- package/src/new/cmd.install.app/index.js +1 -27
- package/src/new/cmd.jenkins/index.js +1 -72
- package/src/new/cmd.publish/index.js +1 -197
- package/src/new/cmd.push/index.js +1 -76
- package/src/new/cmd.push/java.js +1 -148
- package/src/new/cmd.push-set/index.js +1 -205
- package/src/new/cmd.refresh/index.js +1 -65
- package/src/new/cmd.reglist/index.js +1 -23
- package/src/new/cmd.rm-rf/index.js +1 -58
- package/src/new/cmd.version/index.js +1 -35
- package/src/old/cli.init.js +1 -26
- package/src/old/cli.install/config.js +1 -206
- package/src/old/cli.install/index.js +1 -340
- package/src/old/cli.install/tools.js +1 -230
- package/src/old/cli.merge.js +1 -80
- package/src/old/cli.pull.js +1 -94
- package/src/old/cli.pull2.js +1 -377
- package/src/old/cli.rm-rf.js +1 -88
- package/src/old/progress-bar.js +1 -23
- package/src/old/util.js +1 -149
- package/build.js +0 -15
- package/obf.config.json +0 -3
- package/src/old/cli.dva.register.saas.txt +0 -40
- package/src/old/cli.dva.register.spa.txt +0 -22
- package/src/old/cli.dva.router.saas.txt +0 -210
- package/src/old/cli.dva.router.spa.txt +0 -119
@@ -1,230 +1 @@
|
|
1
|
-
const
|
2
|
-
const os = require('os');
|
3
|
-
const {
|
4
|
-
GIT_HOST,
|
5
|
-
GIT_TEMP_DIR,
|
6
|
-
CLOUD_PROJECT
|
7
|
-
} = require('./config');
|
8
|
-
|
9
|
-
/**
|
10
|
-
* @description 删除全部
|
11
|
-
* @param path {string} 路径
|
12
|
-
*/
|
13
|
-
exports.f_rm_rf = function (path) {
|
14
|
-
if (fs.existsSync(path)) {
|
15
|
-
const list = fs.readdirSync(path);
|
16
|
-
for (let i = 0; i < list.length; i++) {
|
17
|
-
const item = list[ i ];
|
18
|
-
const vPath = `${path}/${item}`;
|
19
|
-
if (fs.statSync(vPath).isDirectory()) {
|
20
|
-
exports.f_rm_rf(vPath);
|
21
|
-
fs.rmdirSync(vPath);
|
22
|
-
} else {
|
23
|
-
fs.unlinkSync(vPath);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
};
|
28
|
-
|
29
|
-
/**
|
30
|
-
* @typedef {object} GitResource
|
31
|
-
* @property {string} path
|
32
|
-
* @property {string} compress
|
33
|
-
* @property {string} repository
|
34
|
-
*/
|
35
|
-
|
36
|
-
/**
|
37
|
-
* @description 拉取git资源
|
38
|
-
* @param installResources {Resource[]} 资源名称
|
39
|
-
* @return {GitResource[]}
|
40
|
-
*/
|
41
|
-
exports.f_pull_git_repository = function (installResources = []) {
|
42
|
-
return installResources.map(item => {
|
43
|
-
const resource = CLOUD_PROJECT[ item.name ] || undefined;
|
44
|
-
const template = os.tmpdir();
|
45
|
-
return {
|
46
|
-
path: `${template}\\${GIT_TEMP_DIR}\\${item.name}.zip`,
|
47
|
-
compress: `${template}\\${GIT_TEMP_DIR}\\${item.name}_zip`,
|
48
|
-
repository: `${GIT_HOST}/api/v4/projects/${resource.projectId}/repository/archive.zip?private_token=${resource.token}&ref=master`
|
49
|
-
};
|
50
|
-
});
|
51
|
-
};
|
52
|
-
|
53
|
-
/**
|
54
|
-
* @description 扫描是否存在jjb.config.json
|
55
|
-
* @param root 路径
|
56
|
-
* @returns {boolean}
|
57
|
-
*/
|
58
|
-
exports.f_scan_jjb_config_json = function (root) {
|
59
|
-
return fs.existsSync(`${root}\\jjb.config.json`);
|
60
|
-
};
|
61
|
-
|
62
|
-
/**
|
63
|
-
* @typedef {object} JJB_CONFIG_JSON
|
64
|
-
* @property {string} projectType
|
65
|
-
* @property {string} installTarget
|
66
|
-
* @property {Resource[]} installResources
|
67
|
-
*/
|
68
|
-
|
69
|
-
/**
|
70
|
-
* @description 验证规则
|
71
|
-
* @param root {string} 路径
|
72
|
-
* @return {JJB_CONFIG_JSON}
|
73
|
-
*/
|
74
|
-
exports.f_scan_jjb_config_json_rules = function (root) {
|
75
|
-
let jjb_config_json = {};
|
76
|
-
try {
|
77
|
-
jjb_config_json = JSON.parse(fs.readFileSync(`${root}\\jjb.config.json`).toString());
|
78
|
-
} catch (e) {
|
79
|
-
console.log('【Error】:[jjb.config.json]文件解析失败,请确认是否配置正确。');
|
80
|
-
process.exit(0);
|
81
|
-
}
|
82
|
-
if (!('projectType' in jjb_config_json)) {
|
83
|
-
console.log('【Error】:[jjb.config.json]文件配置无效,需要projectType属性。');
|
84
|
-
process.exit(0);
|
85
|
-
}
|
86
|
-
if (!('installTarget' in jjb_config_json)) {
|
87
|
-
console.log('【Error】:[jjb.config.json]文件配置无效,需要installTarget属性。');
|
88
|
-
process.exit(0);
|
89
|
-
}
|
90
|
-
if (!('installResources' in jjb_config_json)) {
|
91
|
-
console.log('【Error】:[jjb.config.json]文件配置无效,需要installResources属性。');
|
92
|
-
process.exit(0);
|
93
|
-
}
|
94
|
-
if (typeof jjb_config_json.projectType !== 'string') {
|
95
|
-
console.log('【Error】:[jjb.config.json.projectType]类型是一个string。');
|
96
|
-
process.exit(0);
|
97
|
-
}
|
98
|
-
if (![
|
99
|
-
'multi',
|
100
|
-
'spa',
|
101
|
-
'uniapp',
|
102
|
-
'micro-spa'
|
103
|
-
].includes(jjb_config_json.projectType)) {
|
104
|
-
console.log('【Error】:[jjb.config.json.projectType]配置无效,有效值<multi | spa | micro-spa | uniapp>。');
|
105
|
-
process.exit(0);
|
106
|
-
}
|
107
|
-
if (typeof jjb_config_json.installTarget !== 'string') {
|
108
|
-
console.log('【Error】:[jjb.config.json.installTarget]类型是一个string。');
|
109
|
-
process.exit(0);
|
110
|
-
}
|
111
|
-
if (![
|
112
|
-
'node_modules',
|
113
|
-
'src'
|
114
|
-
].includes(jjb_config_json.installTarget)) {
|
115
|
-
console.log('【Error】:[jjb.config.json.node_modules]配置无效,有效值<node_modules | src>。');
|
116
|
-
process.exit(0);
|
117
|
-
}
|
118
|
-
if (!Array.isArray(jjb_config_json.installResources)) {
|
119
|
-
console.log('【Error】:[jjb.config.json.installResources]类型是一个Array<string>。');
|
120
|
-
process.exit(0);
|
121
|
-
}
|
122
|
-
if (jjb_config_json.installResources.length === 0) {
|
123
|
-
console.log('【Error】:[jjb.config.json.installResources]无资源。');
|
124
|
-
process.exit(0);
|
125
|
-
}
|
126
|
-
const resources = exports.f_resolve_install_resources(jjb_config_json.installResources);
|
127
|
-
if (resources.map(item => item.name).filter(v => ![
|
128
|
-
'jjb-common',
|
129
|
-
'jjb-dva-runtime',
|
130
|
-
'jjb-common-lib',
|
131
|
-
'jjb-common-decorator',
|
132
|
-
'react-admin-component',
|
133
|
-
'vue-unisass-component'
|
134
|
-
].includes(v)).length !== 0) {
|
135
|
-
console.log('【Error】:[jjb.config.json.installResources]配置无效,有效值<common | react-admin-component | vue-unisass-component | jjb-common-decorator | jjb-dva-runtime | jjb-common-lib>。');
|
136
|
-
process.exit(0);
|
137
|
-
}
|
138
|
-
jjb_config_json.installResources = resources;
|
139
|
-
return jjb_config_json;
|
140
|
-
};
|
141
|
-
|
142
|
-
/**
|
143
|
-
* @description 创建package.json
|
144
|
-
* @param path {string} 路径
|
145
|
-
* @param name {string} 包名
|
146
|
-
* @param version {string} 版本
|
147
|
-
*/
|
148
|
-
exports.f_create_package_json = function (path, name, version) {
|
149
|
-
fs.writeFileSync(`${path}\\package.json`, `{"name":"${name}","version":"${version}","main": "index.js"}`);
|
150
|
-
};
|
151
|
-
|
152
|
-
/**
|
153
|
-
* @typedef {object} Resource
|
154
|
-
* @property {string} name
|
155
|
-
* @property {string[]} importList
|
156
|
-
*/
|
157
|
-
|
158
|
-
/**
|
159
|
-
* @description 分析resources
|
160
|
-
* @param installResources
|
161
|
-
* @return {Resource[]}
|
162
|
-
*/
|
163
|
-
exports.f_resolve_install_resources = function (installResources = []) {
|
164
|
-
const resources = [];
|
165
|
-
if (Array.isArray(installResources)) {
|
166
|
-
installResources.forEach(resource => {
|
167
|
-
if (Array.isArray(resource)) {
|
168
|
-
const [ name, importList = [] ] = resource;
|
169
|
-
resources.push({
|
170
|
-
name,
|
171
|
-
importList
|
172
|
-
});
|
173
|
-
} else {
|
174
|
-
resources.push({
|
175
|
-
name: resource,
|
176
|
-
importList: []
|
177
|
-
});
|
178
|
-
}
|
179
|
-
});
|
180
|
-
}
|
181
|
-
return resources;
|
182
|
-
};
|
183
|
-
|
184
|
-
/**
|
185
|
-
* @description 更新项目package.json文件
|
186
|
-
* @param path {string} 路径
|
187
|
-
* @param name {string} 包名
|
188
|
-
* @param version {string} 版本
|
189
|
-
*/
|
190
|
-
exports.f_update_project_package_json = function (path, name, version) {
|
191
|
-
const packageJSONFile = JSON.parse(fs.readFileSync(path).toString());
|
192
|
-
packageJSONFile.dependencies[ name ] = version;
|
193
|
-
fs.writeFileSync(path, JSON.stringify(packageJSONFile, null, 2));
|
194
|
-
};
|
195
|
-
|
196
|
-
/**
|
197
|
-
* @description 复制文件
|
198
|
-
* @param originSrc
|
199
|
-
* @param targetSrc
|
200
|
-
*/
|
201
|
-
exports.f_file_copy = function (originSrc, targetSrc) {
|
202
|
-
fs.readdirSync(originSrc).forEach(dir => {
|
203
|
-
const oPath = `${originSrc}\\${dir}`;
|
204
|
-
const tPath = `${targetSrc}\\${dir}`;
|
205
|
-
if (fs.statSync(oPath).isDirectory()) {
|
206
|
-
fs.mkdirSync(tPath);
|
207
|
-
exports.f_file_copy(oPath, tPath);
|
208
|
-
} else {
|
209
|
-
fs.writeFileSync(tPath, fs.readFileSync(oPath).toString());
|
210
|
-
}
|
211
|
-
});
|
212
|
-
};
|
213
|
-
|
214
|
-
/**
|
215
|
-
* @description 替换文件操作
|
216
|
-
* @param source {[]} 替换源
|
217
|
-
* @param root {string} 路径
|
218
|
-
*/
|
219
|
-
exports.f_content_replace = function (source = [], root) {
|
220
|
-
source.forEach(item => {
|
221
|
-
const path = root + item.path;
|
222
|
-
if (fs.existsSync(path)) {
|
223
|
-
let content = fs.readFileSync(path).toString();
|
224
|
-
item.replace.forEach(rep => {
|
225
|
-
content = content.replace(rep[ 0 ], rep[ 1 ]);
|
226
|
-
});
|
227
|
-
fs.writeFileSync(path, content);
|
228
|
-
}
|
229
|
-
});
|
230
|
-
};
|
1
|
+
const a4_0x1d48a1=a4_0x5678;(function(_0x1245ad,_0x2b96fc){const _0xb52eb7=a4_0x5678,_0x376d64=_0x1245ad();while(!![]){try{const _0x3103f3=-parseInt(_0xb52eb7(0x109))/0x1*(-parseInt(_0xb52eb7(0x104))/0x2)+parseInt(_0xb52eb7(0xe6))/0x3*(-parseInt(_0xb52eb7(0xf9))/0x4)+parseInt(_0xb52eb7(0xe9))/0x5*(-parseInt(_0xb52eb7(0x10b))/0x6)+-parseInt(_0xb52eb7(0xd8))/0x7+-parseInt(_0xb52eb7(0x100))/0x8*(parseInt(_0xb52eb7(0x103))/0x9)+-parseInt(_0xb52eb7(0xe0))/0xa+parseInt(_0xb52eb7(0xfb))/0xb*(parseInt(_0xb52eb7(0xef))/0xc);if(_0x3103f3===_0x2b96fc)break;else _0x376d64['push'](_0x376d64['shift']());}catch(_0xead4cb){_0x376d64['push'](_0x376d64['shift']());}}}(a4_0x8fe7,0x6cd4b));function a4_0x8fe7(){const _0x50f0b9=['replace','77365oaqISD','【Error】:[jjb.config.json.installResources]类型是一个Array<string>。','installResources','node_modules','existsSync','forEach','15676308BUGJyT','/repository/archive.zip?private_token=','jjb-dva-runtime','jjb-common','rmdirSync','【Error】:[jjb.config.json]文件配置无效,需要projectType属性。','f_scan_jjb_config_json','f_update_project_package_json','【Error】:[jjb.config.json]文件配置无效,需要installTarget属性。','&ref=master','212MyNOtf','readFileSync','11PXXZzo','log','readdirSync','jjb-common-decorator','f_pull_git_repository','5957936rBCuQq','length','writeFileSync','9JfPoum','74OiMgQU','parse','react-admin-component','mkdirSync','isArray','22377EeBFRW','unlinkSync','150RSSrgQ','f_file_copy','uniapp','{\x22name\x22:\x22','toString','f_create_package_json','【Error】:[jjb.config.json]文件配置无效,需要installResources属性。','\x22,\x22version\x22:\x22','【Error】:[jjb.config.json.node_modules]配置无效,有效值<node_modules\x20|\x20src>。','projectId','vue-unisass-component','src','isDirectory','name','.zip','/api/v4/projects/','204316ICwhfq','map','filter','includes','projectType','f_rm_rf','string','multi','411360jzgZWr','statSync','installTarget','exit','f_resolve_install_resources','\x5cjjb.config.json','27546jwLNMZ','【Error】:[jjb.config.json.installResources]配置无效,有效值<common\x20|\x20react-admin-component\x20|\x20vue-unisass-component\x20|\x20jjb-common-decorator\x20|\x20jjb-dva-runtime\x20|\x20jjb-common-lib>。'];a4_0x8fe7=function(){return _0x50f0b9;};return a4_0x8fe7();}const fs=require('fs'),os=require('os'),{GIT_HOST,GIT_TEMP_DIR,CLOUD_PROJECT}=require('./config');function a4_0x5678(_0x231b5a,_0x324732){const _0x8fe73b=a4_0x8fe7();return a4_0x5678=function(_0x5678e1,_0x196d3e){_0x5678e1=_0x5678e1-0xd7;let _0x404e08=_0x8fe73b[_0x5678e1];return _0x404e08;},a4_0x5678(_0x231b5a,_0x324732);}exports[a4_0x1d48a1(0xdd)]=function(_0x5c4e25){const _0x390752=a4_0x1d48a1;if(fs[_0x390752(0xed)](_0x5c4e25)){const _0x2e993=fs['readdirSync'](_0x5c4e25);for(let _0xd8dbf8=0x0;_0xd8dbf8<_0x2e993[_0x390752(0x101)];_0xd8dbf8++){const _0x4a44ab=_0x2e993[_0xd8dbf8],_0x1a6ab8=_0x5c4e25+'/'+_0x4a44ab;fs[_0x390752(0xe1)](_0x1a6ab8)[_0x390752(0x117)]()?(exports[_0x390752(0xdd)](_0x1a6ab8),fs[_0x390752(0xf3)](_0x1a6ab8)):fs[_0x390752(0x10a)](_0x1a6ab8);}}},exports[a4_0x1d48a1(0xff)]=function(_0x23b7ae=[]){const _0x57b93b=a4_0x1d48a1;return _0x23b7ae[_0x57b93b(0xd9)](_0x4fe5cb=>{const _0x3ca147=_0x57b93b,_0x26a675=CLOUD_PROJECT[_0x4fe5cb[_0x3ca147(0x118)]]||undefined,_0x25be64=os['tmpdir']();return{'path':_0x25be64+'\x5c'+GIT_TEMP_DIR+'\x5c'+_0x4fe5cb[_0x3ca147(0x118)]+_0x3ca147(0x119),'compress':_0x25be64+'\x5c'+GIT_TEMP_DIR+'\x5c'+_0x4fe5cb[_0x3ca147(0x118)]+'_zip','repository':GIT_HOST+_0x3ca147(0xd7)+_0x26a675[_0x3ca147(0x114)]+_0x3ca147(0xf0)+_0x26a675['token']+_0x3ca147(0xf8)};});},exports[a4_0x1d48a1(0xf5)]=function(_0x3aaf9d){const _0x3aa886=a4_0x1d48a1;return fs['existsSync'](_0x3aaf9d+_0x3aa886(0xe5));},exports['f_scan_jjb_config_json_rules']=function(_0x303096){const _0x5b0c93=a4_0x1d48a1;let _0x2be6f0={};try{_0x2be6f0=JSON[_0x5b0c93(0x105)](fs[_0x5b0c93(0xfa)](_0x303096+_0x5b0c93(0xe5))['toString']());}catch(_0x5cd62d){console['log']('【Error】:[jjb.config.json]文件解析失败,请确认是否配置正确。'),process['exit'](0x0);}!(_0x5b0c93(0xdc)in _0x2be6f0)&&(console['log'](_0x5b0c93(0xf4)),process[_0x5b0c93(0xe3)](0x0));!(_0x5b0c93(0xe2)in _0x2be6f0)&&(console[_0x5b0c93(0xfc)](_0x5b0c93(0xf7)),process[_0x5b0c93(0xe3)](0x0));!(_0x5b0c93(0xeb)in _0x2be6f0)&&(console[_0x5b0c93(0xfc)](_0x5b0c93(0x111)),process[_0x5b0c93(0xe3)](0x0));typeof _0x2be6f0[_0x5b0c93(0xdc)]!==_0x5b0c93(0xde)&&(console[_0x5b0c93(0xfc)]('【Error】:[jjb.config.json.projectType]类型是一个string。'),process[_0x5b0c93(0xe3)](0x0));![_0x5b0c93(0xdf),'spa',_0x5b0c93(0x10d),'micro-spa'][_0x5b0c93(0xdb)](_0x2be6f0[_0x5b0c93(0xdc)])&&(console[_0x5b0c93(0xfc)]('【Error】:[jjb.config.json.projectType]配置无效,有效值<multi\x20|\x20spa\x20|\x20micro-spa\x20|\x20uniapp>。'),process[_0x5b0c93(0xe3)](0x0));typeof _0x2be6f0[_0x5b0c93(0xe2)]!==_0x5b0c93(0xde)&&(console[_0x5b0c93(0xfc)]('【Error】:[jjb.config.json.installTarget]类型是一个string。'),process[_0x5b0c93(0xe3)](0x0));![_0x5b0c93(0xec),_0x5b0c93(0x116)][_0x5b0c93(0xdb)](_0x2be6f0[_0x5b0c93(0xe2)])&&(console[_0x5b0c93(0xfc)](_0x5b0c93(0x113)),process[_0x5b0c93(0xe3)](0x0));!Array[_0x5b0c93(0x108)](_0x2be6f0[_0x5b0c93(0xeb)])&&(console[_0x5b0c93(0xfc)](_0x5b0c93(0xea)),process[_0x5b0c93(0xe3)](0x0));_0x2be6f0[_0x5b0c93(0xeb)]['length']===0x0&&(console[_0x5b0c93(0xfc)]('【Error】:[jjb.config.json.installResources]无资源。'),process[_0x5b0c93(0xe3)](0x0));const _0x1c7ae9=exports[_0x5b0c93(0xe4)](_0x2be6f0[_0x5b0c93(0xeb)]);return _0x1c7ae9['map'](_0xa67fb1=>_0xa67fb1['name'])[_0x5b0c93(0xda)](_0x23e595=>![_0x5b0c93(0xf2),_0x5b0c93(0xf1),'jjb-common-lib',_0x5b0c93(0xfe),_0x5b0c93(0x106),_0x5b0c93(0x115)][_0x5b0c93(0xdb)](_0x23e595))['length']!==0x0&&(console['log'](_0x5b0c93(0xe7)),process['exit'](0x0)),_0x2be6f0[_0x5b0c93(0xeb)]=_0x1c7ae9,_0x2be6f0;},exports[a4_0x1d48a1(0x110)]=function(_0x5cedb3,_0x141298,_0x40d4cd){const _0x55de5e=a4_0x1d48a1;fs['writeFileSync'](_0x5cedb3+'\x5cpackage.json',_0x55de5e(0x10e)+_0x141298+_0x55de5e(0x112)+_0x40d4cd+'\x22,\x22main\x22:\x20\x22index.js\x22}');},exports[a4_0x1d48a1(0xe4)]=function(_0xa7b812=[]){const _0x1a5796=[];return Array['isArray'](_0xa7b812)&&_0xa7b812['forEach'](_0x15791c=>{const _0x3dbaf7=a4_0x5678;if(Array[_0x3dbaf7(0x108)](_0x15791c)){const [_0x2df142,_0x1b33bc=[]]=_0x15791c;_0x1a5796['push']({'name':_0x2df142,'importList':_0x1b33bc});}else _0x1a5796['push']({'name':_0x15791c,'importList':[]});}),_0x1a5796;},exports[a4_0x1d48a1(0xf6)]=function(_0x26a81f,_0x4377bf,_0x26ae3a){const _0x17ed87=a4_0x1d48a1,_0x5e39e7=JSON[_0x17ed87(0x105)](fs[_0x17ed87(0xfa)](_0x26a81f)[_0x17ed87(0x10f)]());_0x5e39e7['dependencies'][_0x4377bf]=_0x26ae3a,fs[_0x17ed87(0x102)](_0x26a81f,JSON['stringify'](_0x5e39e7,null,0x2));},exports[a4_0x1d48a1(0x10c)]=function(_0xf22d40,_0x4175de){const _0x40c2a4=a4_0x1d48a1;fs[_0x40c2a4(0xfd)](_0xf22d40)['forEach'](_0x49d857=>{const _0x1c72c7=_0x40c2a4,_0x4ac613=_0xf22d40+'\x5c'+_0x49d857,_0x32d6a3=_0x4175de+'\x5c'+_0x49d857;fs[_0x1c72c7(0xe1)](_0x4ac613)[_0x1c72c7(0x117)]()?(fs[_0x1c72c7(0x107)](_0x32d6a3),exports[_0x1c72c7(0x10c)](_0x4ac613,_0x32d6a3)):fs[_0x1c72c7(0x102)](_0x32d6a3,fs[_0x1c72c7(0xfa)](_0x4ac613)[_0x1c72c7(0x10f)]());});},exports['f_content_replace']=function(_0x468b58=[],_0x83f4a5){const _0x2e9ebb=a4_0x1d48a1;_0x468b58[_0x2e9ebb(0xee)](_0x3255d9=>{const _0x1f6838=_0x2e9ebb,_0x284228=_0x83f4a5+_0x3255d9['path'];if(fs[_0x1f6838(0xed)](_0x284228)){let _0x5f5833=fs['readFileSync'](_0x284228)['toString']();_0x3255d9[_0x1f6838(0xe8)][_0x1f6838(0xee)](_0xdb16f6=>{const _0x243d64=_0x1f6838;_0x5f5833=_0x5f5833[_0x243d64(0xe8)](_0xdb16f6[0x0],_0xdb16f6[0x1]);}),fs[_0x1f6838(0x102)](_0x284228,_0x5f5833);}});};
|
@@ -1,27 +1 @@
|
|
1
|
-
const child_process =
|
2
|
-
const path = require('path');
|
3
|
-
const fs = require('fs');
|
4
|
-
|
5
|
-
module.exports = registry_source => {
|
6
|
-
|
7
|
-
if (!['npm', 'yarn'].includes(registry_source)) {
|
8
|
-
console.log(`【Error】:no registry source, available:[npm, yarn]`);
|
9
|
-
process.exit(0);
|
10
|
-
}
|
11
|
-
|
12
|
-
/**
|
13
|
-
* 当前根路径
|
14
|
-
* @type {Promise<void> | Promise<string>}
|
15
|
-
*/
|
16
|
-
const root_path = path.resolve('./');
|
17
|
-
|
18
|
-
console.log("install modules please wait....");
|
19
|
-
child_process.execSync(registry_source === 'yarn' ? 'yarn' : 'npm install', { cwd: root_path });
|
20
|
-
if (!fs.existsSync(`${root_path}/.git`)) {
|
21
|
-
console.log("git init please wait....");
|
22
|
-
child_process.execSync(`git init`, { cwd: root_path });
|
23
|
-
}
|
24
|
-
console.log("install husky please wait....");
|
25
|
-
child_process.execSync(`npx husky install`, { cwd: root_path });
|
26
|
-
console.log("Finish!");
|
27
|
-
};
|
1
|
+
function a5_0x37c7(_0x228026,_0x4feb31){const _0x4d46fa=a5_0x4d46();return a5_0x37c7=function(_0x37c7cd,_0x5bb3eb){_0x37c7cd=_0x37c7cd-0x1c0;let _0x30d205=_0x4d46fa[_0x37c7cd];return _0x30d205;},a5_0x37c7(_0x228026,_0x4feb31);}const a5_0x2a1157=a5_0x37c7;(function(_0x2a2f52,_0x4f86fa){const _0x538e30=a5_0x37c7,_0x194054=_0x2a2f52();while(!![]){try{const _0x5bde06=parseInt(_0x538e30(0x1d5))/0x1*(parseInt(_0x538e30(0x1ca))/0x2)+-parseInt(_0x538e30(0x1c7))/0x3*(parseInt(_0x538e30(0x1c8))/0x4)+-parseInt(_0x538e30(0x1d6))/0x5+parseInt(_0x538e30(0x1d7))/0x6*(-parseInt(_0x538e30(0x1d8))/0x7)+-parseInt(_0x538e30(0x1ce))/0x8+-parseInt(_0x538e30(0x1cb))/0x9+-parseInt(_0x538e30(0x1cf))/0xa*(-parseInt(_0x538e30(0x1d1))/0xb);if(_0x5bde06===_0x4f86fa)break;else _0x194054['push'](_0x194054['shift']());}catch(_0x472826){_0x194054['push'](_0x194054['shift']());}}}(a5_0x4d46,0x7f8c8));function a5_0x4d46(){const _0x2b8e26=['606722eClDFE','4470745XvZAuE','6urRsMv','5188771ECZldd','execSync','resolve','/.git','yarn','child_process','git\x20init\x20please\x20wait....','log','install\x20modules\x20please\x20wait....','3SneWKE','492504ArBxhp','existsSync','2TmfLpg','9328293VyIrJl','npm\x20install','exports','6813072JqqTZm','99230ndbaZS','includes','3949dkYelN','git\x20init','Finish!','npm'];a5_0x4d46=function(){return _0x2b8e26;};return a5_0x4d46();}const child_process=require(a5_0x2a1157(0x1c3)),path=require('path'),fs=require('fs');module[a5_0x2a1157(0x1cd)]=_0x4fab98=>{const _0x5d2580=a5_0x2a1157;![_0x5d2580(0x1d4),_0x5d2580(0x1c2)][_0x5d2580(0x1d0)](_0x4fab98)&&(console[_0x5d2580(0x1c5)]('【Error】:no\x20registry\x20source,\x20available:[npm,\x20yarn]'),process['exit'](0x0));const _0xf90cea=path[_0x5d2580(0x1c0)]('./');console[_0x5d2580(0x1c5)](_0x5d2580(0x1c6)),child_process['execSync'](_0x4fab98===_0x5d2580(0x1c2)?_0x5d2580(0x1c2):_0x5d2580(0x1cc),{'cwd':_0xf90cea}),!fs[_0x5d2580(0x1c9)](_0xf90cea+_0x5d2580(0x1c1))&&(console[_0x5d2580(0x1c5)](_0x5d2580(0x1c4)),child_process[_0x5d2580(0x1d9)](_0x5d2580(0x1d2),{'cwd':_0xf90cea})),console[_0x5d2580(0x1c5)]('install\x20husky\x20please\x20wait....'),child_process[_0x5d2580(0x1d9)]('npx\x20husky\x20install',{'cwd':_0xf90cea}),console['log'](_0x5d2580(0x1d3));};
|
@@ -1,72 +1 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
const fs = require('fs');
|
3
|
-
const Jenkins = require('jenkins');
|
4
|
-
|
5
|
-
module.exports = arguments => {
|
6
|
-
|
7
|
-
const authPath = path.join(__dirname, '../../../.auth');
|
8
|
-
if (!fs.existsSync(authPath)) {
|
9
|
-
console.log(`【Error】:no auth login`);
|
10
|
-
process.exit(0);
|
11
|
-
}
|
12
|
-
|
13
|
-
/**
|
14
|
-
* 当前根路径
|
15
|
-
* @type {Promise<void> | Promise<string>}
|
16
|
-
*/
|
17
|
-
const root_path = path.resolve('./');
|
18
|
-
|
19
|
-
/**
|
20
|
-
* jjb配置文件路径
|
21
|
-
* @type {string}
|
22
|
-
*/
|
23
|
-
const config_json_path = `${root_path}\\jjb.config.js`;
|
24
|
-
/**
|
25
|
-
* 获取配置对象
|
26
|
-
*/
|
27
|
-
const jjbConfig = require(config_json_path);
|
28
|
-
/**
|
29
|
-
* 获取当前处理环境配置信息
|
30
|
-
*/
|
31
|
-
const envData = jjbConfig.environment[arguments];
|
32
|
-
|
33
|
-
const jenkinsData = envData.jenkins || {};
|
34
|
-
|
35
|
-
//分支名
|
36
|
-
const branchName = jenkinsData.branchName;
|
37
|
-
//项目名
|
38
|
-
const jobName = jenkinsData.jobName;
|
39
|
-
//主机
|
40
|
-
const jenkinsHost = jenkinsData.jenkinsHost;
|
41
|
-
//登录用户
|
42
|
-
const jenkinsUserName = jenkinsData.jenkinsUserName;
|
43
|
-
//登录密码
|
44
|
-
const jenkinsPassword = jenkinsData.jenkinsPassword;
|
45
|
-
//namespace
|
46
|
-
const jenkinsNamespace = jenkinsData.jenkinsNamespace;
|
47
|
-
|
48
|
-
//发起请求
|
49
|
-
const jenkins = new Jenkins({
|
50
|
-
// https://用户名:密码/token@jenkins地址
|
51
|
-
baseUrl: `http://${jenkinsUserName}:${jenkinsPassword}@${jenkinsHost}`,
|
52
|
-
});
|
53
|
-
|
54
|
-
try {
|
55
|
-
const result = jenkins.job.build({
|
56
|
-
name: jobName,
|
57
|
-
// jenkins中需要的参数,若无则为空
|
58
|
-
parameters: {
|
59
|
-
app_Version: branchName,
|
60
|
-
build_version: arguments,
|
61
|
-
k8s_namespace: jenkinsNamespace,
|
62
|
-
branch: branchName,
|
63
|
-
merge: true
|
64
|
-
},
|
65
|
-
token: jenkinsPassword
|
66
|
-
})
|
67
|
-
console.log('开始构建...', result)
|
68
|
-
} catch (error) {
|
69
|
-
console.error('error: ', error);
|
70
|
-
}
|
71
|
-
|
72
|
-
}
|
1
|
+
function a6_0x5ac0(_0x1ac784,_0x23209e){const _0x307f3f=a6_0x307f();return a6_0x5ac0=function(_0x5ac0e8,_0x533b7d){_0x5ac0e8=_0x5ac0e8-0x10b;let _0x2b2ff0=_0x307f3f[_0x5ac0e8];return _0x2b2ff0;},a6_0x5ac0(_0x1ac784,_0x23209e);}const a6_0x4ee168=a6_0x5ac0;function a6_0x307f(){const _0x3946c1=['log','../../../.auth','\x5cjjb.config.js','jenkinsHost','environment','711893HFuBhp','2265WBpnPm','job','error','4DBoIKk','开始构建...','exit','1852xogumY','path','9447390VncSPa','1950141rPwvjy','jenkinsNamespace','exports','9444120WumcRA','build','5601992SMICgS','jenkinsUserName','10169558RUjuzU','jenkins'];a6_0x307f=function(){return _0x3946c1;};return a6_0x307f();}(function(_0x1e41e0,_0x21463c){const _0x86e147=a6_0x5ac0,_0x218b23=_0x1e41e0();while(!![]){try{const _0x544e01=parseInt(_0x86e147(0x11f))/0x1+-parseInt(_0x86e147(0x10b))/0x2*(-parseInt(_0x86e147(0x111))/0x3)+parseInt(_0x86e147(0x10e))/0x4*(parseInt(_0x86e147(0x120))/0x5)+-parseInt(_0x86e147(0x114))/0x6+-parseInt(_0x86e147(0x118))/0x7+parseInt(_0x86e147(0x116))/0x8+parseInt(_0x86e147(0x110))/0x9;if(_0x544e01===_0x21463c)break;else _0x218b23['push'](_0x218b23['shift']());}catch(_0x57d41a){_0x218b23['push'](_0x218b23['shift']());}}}(a6_0x307f,0xe6ae7));const path=require(a6_0x4ee168(0x10f)),fs=require('fs'),Jenkins=require(a6_0x4ee168(0x119));module[a6_0x4ee168(0x113)]=arguments=>{const _0x712daf=a6_0x4ee168,_0x3760b6=path['join'](__dirname,_0x712daf(0x11b));!fs['existsSync'](_0x3760b6)&&(console['log']('【Error】:no\x20auth\x20login'),process[_0x712daf(0x10d)](0x0));const _0x2ef1b5=path['resolve']('./'),_0x263941=_0x2ef1b5+_0x712daf(0x11c),_0x34cc=require(_0x263941),_0x4ed8b1=_0x34cc[_0x712daf(0x11e)][arguments],_0x4960e2=_0x4ed8b1['jenkins']||{},_0x1a7e27=_0x4960e2['branchName'],_0x5f602d=_0x4960e2['jobName'],_0xd1d334=_0x4960e2[_0x712daf(0x11d)],_0x459f5f=_0x4960e2[_0x712daf(0x117)],_0x53c1a9=_0x4960e2['jenkinsPassword'],_0x1c2c91=_0x4960e2[_0x712daf(0x112)],_0x3041d1=new Jenkins({'baseUrl':'http://'+_0x459f5f+':'+_0x53c1a9+'@'+_0xd1d334});try{const _0x4239c8=_0x3041d1[_0x712daf(0x121)][_0x712daf(0x115)]({'name':_0x5f602d,'parameters':{'app_Version':_0x1a7e27,'build_version':arguments,'k8s_namespace':_0x1c2c91,'branch':_0x1a7e27,'merge':!![]},'token':_0x53c1a9});console[_0x712daf(0x11a)](_0x712daf(0x10c),_0x4239c8);}catch(_0x40f098){console[_0x712daf(0x122)]('error:\x20',_0x40f098);}};
|
@@ -1,197 +1 @@
|
|
1
|
-
const
|
2
|
-
const fs = require('fs');
|
3
|
-
const os = require('os');
|
4
|
-
const axios = require('axios');
|
5
|
-
const readline = require('readline');
|
6
|
-
const io = readline.createInterface({
|
7
|
-
input: process.stdin,
|
8
|
-
output: process.stdout
|
9
|
-
});
|
10
|
-
const child_process = require('child_process');
|
11
|
-
const { getApiHost } = require('../cmd.install/config');
|
12
|
-
|
13
|
-
module.exports = version => {
|
14
|
-
|
15
|
-
const authPath = path.join(__dirname, '../../../.auth');
|
16
|
-
if (!fs.existsSync(authPath)) {
|
17
|
-
console.log(`【Error】:no auth login`);
|
18
|
-
process.exit(0);
|
19
|
-
}
|
20
|
-
|
21
|
-
const [ username, password ] = fs.readFileSync(authPath).toString().split('/');
|
22
|
-
axios.post(`${getApiHost()}/api/auth`, {
|
23
|
-
username,
|
24
|
-
password
|
25
|
-
}).then(res => {
|
26
|
-
if (res.data.status) {
|
27
|
-
|
28
|
-
/**
|
29
|
-
* 下发数据根路径
|
30
|
-
* @type {string}
|
31
|
-
*/
|
32
|
-
const root_path = path.resolve('./');
|
33
|
-
|
34
|
-
console.log('Please wait, build ...');
|
35
|
-
if (fs.existsSync(root_path + '/yarn.lock')) {
|
36
|
-
child_process.execSync('yarn build:production', { cwd: root_path });
|
37
|
-
} else {
|
38
|
-
child_process.execSync('npm run build:production', { cwd: root_path });
|
39
|
-
}
|
40
|
-
|
41
|
-
const dist_folder_path = `${root_path}\\dist\\index.js`;
|
42
|
-
const package_json_path = `${root_path}\\package.json`;
|
43
|
-
const readme_path = `${root_path}\\README.md`;
|
44
|
-
const thumbnail_png_path = `${root_path}\\thumbnail.png`;
|
45
|
-
const log_text = [
|
46
|
-
os.hostname(),
|
47
|
-
os.platform(),
|
48
|
-
os.arch(),
|
49
|
-
new Date().toString()
|
50
|
-
];
|
51
|
-
|
52
|
-
const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../package.json')).toString());
|
53
|
-
const {
|
54
|
-
version: cmd_version
|
55
|
-
} = package_json_file;
|
56
|
-
|
57
|
-
const pushData = {
|
58
|
-
username,
|
59
|
-
cmd_version,
|
60
|
-
hostname: os.hostname(),
|
61
|
-
platform: os.platform()
|
62
|
-
};
|
63
|
-
|
64
|
-
if (fs.existsSync(package_json_path)) {
|
65
|
-
if (fs.existsSync(dist_folder_path)) {
|
66
|
-
pushData.package_version = version
|
67
|
-
? version
|
68
|
-
: 0;
|
69
|
-
pushData.package_content = fs.readFileSync(dist_folder_path).toString();
|
70
|
-
pushData.component_config_content = {};
|
71
|
-
|
72
|
-
const dist_content = fs.readFileSync(dist_folder_path).toString();
|
73
|
-
|
74
|
-
|
75
|
-
const matches = dist_content.match(/(window\[).+?(\.componentKey|.+]={)/img);
|
76
|
-
if (matches && matches.length){
|
77
|
-
|
78
|
-
const infoMatches = dist_content.match(/componentKey.+([{,]info:\s{0,}{)/img);
|
79
|
-
if (infoMatches && infoMatches.length) {
|
80
|
-
let infoStr = '{';
|
81
|
-
const infoStr1 = dist_content.split(infoMatches[0])[1];
|
82
|
-
for (let i = 0; i < infoStr1.length; i++){
|
83
|
-
infoStr += infoStr1[i];
|
84
|
-
if (infoStr1[i] === '}') {
|
85
|
-
try {
|
86
|
-
const currJson = new Function('return '+infoStr)();
|
87
|
-
pushData.component_config_content = {
|
88
|
-
...currJson,
|
89
|
-
defaultSetting: {}
|
90
|
-
};
|
91
|
-
} catch (e) {
|
92
|
-
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
} else {
|
97
|
-
console.log('【Error】:window暴露配置缺少info基础信息');
|
98
|
-
process.exit(0);
|
99
|
-
}
|
100
|
-
|
101
|
-
const settingsMatches = dist_content.match(/componentKey.+([{,]settings:\s{0,}{)/img);
|
102
|
-
if (settingsMatches && settingsMatches.length) {
|
103
|
-
let settingsStr = '{';
|
104
|
-
const settingsStr1 = dist_content.split(settingsMatches[0])[1];
|
105
|
-
for (let i = 0; i < settingsStr1.length; i++){
|
106
|
-
settingsStr += settingsStr1[i];
|
107
|
-
if (settingsStr1[i] === '}') {
|
108
|
-
try {
|
109
|
-
const currJson = new Function('return '+settingsStr)();
|
110
|
-
pushData.component_config_content.defaultSetting = currJson;
|
111
|
-
} catch (e) {
|
112
|
-
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
pushData.component_config_content = JSON.stringify(pushData.component_config_content);
|
118
|
-
} else {
|
119
|
-
console.log('【Error】:window暴露配置缺少info基础信息');
|
120
|
-
process.exit(0);
|
121
|
-
}
|
122
|
-
|
123
|
-
// let currStr = matches[0].split('=')[1];
|
124
|
-
// const str= dist_content.split(matches[0])[1];
|
125
|
-
// for (let i = 0; i< str.length; i++){
|
126
|
-
// currStr += str[i]
|
127
|
-
// if (str[i] === '}'){
|
128
|
-
// try {
|
129
|
-
// const currJson = new Function('return '+currStr)();
|
130
|
-
// if (!currJson.info) {
|
131
|
-
// console.log('【Error】:window暴露配置缺少info基础信息');
|
132
|
-
// process.exit(0);
|
133
|
-
// }
|
134
|
-
// if (!currJson.settings) {
|
135
|
-
// console.log('【Error】:window暴露配置缺少settings基础信息');
|
136
|
-
// process.exit(0);
|
137
|
-
// }
|
138
|
-
// pushData.component_config_content = JSON.stringify({
|
139
|
-
// ...currJson.info,
|
140
|
-
// defaultSetting: currJson.settings
|
141
|
-
// });
|
142
|
-
// break;
|
143
|
-
// }
|
144
|
-
// catch (e) {
|
145
|
-
// console.log(e)
|
146
|
-
// }
|
147
|
-
// }
|
148
|
-
//
|
149
|
-
// }
|
150
|
-
} else {
|
151
|
-
console.log('【Error】:请在window下暴露配置信息');
|
152
|
-
process.exit(0);
|
153
|
-
}
|
154
|
-
|
155
|
-
if (fs.existsSync(readme_path)) {
|
156
|
-
pushData.readme_content = fs.readFileSync(readme_path).toString();
|
157
|
-
} else {
|
158
|
-
console.log('【Error】:请必须包含README.md说明文件');
|
159
|
-
process.exit(0);
|
160
|
-
}
|
161
|
-
|
162
|
-
if (!fs.existsSync(thumbnail_png_path)) {
|
163
|
-
console.log('【Error】:组件根目录必须包含thumbnail.png缩略图片');
|
164
|
-
process.exit(0);
|
165
|
-
} else {
|
166
|
-
const thumbnailData = fs.readFileSync(thumbnail_png_path);
|
167
|
-
const thumbnail_base64 = Buffer.from(thumbnailData).toString('base64');
|
168
|
-
pushData.thumbnail_base64 = thumbnail_base64;
|
169
|
-
}
|
170
|
-
|
171
|
-
io.question('请输入此次提交信息,按Enter确认:', function (message) {
|
172
|
-
pushData.message = message || 'no message';
|
173
|
-
axios.post(`${getApiHost()}/api/file/publish`, pushData).then(res => {
|
174
|
-
console.log(res.data.message);
|
175
|
-
process.exit(0);
|
176
|
-
}).catch(e => {
|
177
|
-
console.log(e);
|
178
|
-
console.log('网络异常。');
|
179
|
-
process.exit(0);
|
180
|
-
});
|
181
|
-
});
|
182
|
-
} else {
|
183
|
-
console.log('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。');
|
184
|
-
process.exit(0);
|
185
|
-
}
|
186
|
-
} else {
|
187
|
-
console.log('发布失败!根目录缺少‘package.json’文件,无法完成发布。');
|
188
|
-
process.exit(0);
|
189
|
-
}
|
190
|
-
} else {
|
191
|
-
console.log('Auth Fail!');
|
192
|
-
}
|
193
|
-
}).catch(e => {
|
194
|
-
console.log(e);
|
195
|
-
console.log('Auth NetWork Fail!');
|
196
|
-
});
|
197
|
-
};
|
1
|
+
const a7_0x387b4c=a7_0x3141;(function(_0x34ccd0,_0x2fdff5){const _0x113d2f=a7_0x3141,_0x40c6c7=_0x34ccd0();while(!![]){try{const _0x224ac9=parseInt(_0x113d2f(0x89))/0x1+-parseInt(_0x113d2f(0x96))/0x2*(parseInt(_0x113d2f(0xc1))/0x3)+parseInt(_0x113d2f(0xa1))/0x4+-parseInt(_0x113d2f(0xb5))/0x5*(-parseInt(_0x113d2f(0xb2))/0x6)+parseInt(_0x113d2f(0x86))/0x7+parseInt(_0x113d2f(0x88))/0x8*(parseInt(_0x113d2f(0xb9))/0x9)+parseInt(_0x113d2f(0xbb))/0xa*(-parseInt(_0x113d2f(0xc2))/0xb);if(_0x224ac9===_0x2fdff5)break;else _0x40c6c7['push'](_0x40c6c7['shift']());}catch(_0x4e19e0){_0x40c6c7['push'](_0x40c6c7['shift']());}}}(a7_0x4ace,0xed3e2));const path=require(a7_0x387b4c(0xa4)),fs=require('fs'),os=require('os'),axios=require(a7_0x387b4c(0x97)),readline=require(a7_0x387b4c(0xbd)),io=readline[a7_0x387b4c(0xa2)]({'input':process[a7_0x387b4c(0xbc)],'output':process['stdout']}),child_process=require('child_process'),{getApiHost}=require(a7_0x387b4c(0x87));function a7_0x3141(_0x1986cf,_0x2bf2be){const _0x4ace93=a7_0x4ace();return a7_0x3141=function(_0x314172,_0xdad07d){_0x314172=_0x314172-0x86;let _0x583088=_0x4ace93[_0x314172];return _0x583088;},a7_0x3141(_0x1986cf,_0x2bf2be);}function a7_0x4ace(){const _0x43b192=['533964IAPMSf','base64','toString','105tpPelS','no\x20message','join','data','2948697FxJaix','parse','50DZKEZB','stdin','readline','exit','package_content','stringify','15459njIsFw','9514835KGcKOk','发布失败!根目录缺少‘package.json’文件,无法完成发布。','【Error】:请必须包含README.md说明文件','6386758pcXqrT','../cmd.install/config','16EeEzSL','1834260iHSxgA','../../../.auth','existsSync','log','【Error】:no\x20auth\x20login','/api/file/publish','hostname','platform','defaultSetting','split','return\x20','exports','post','358YUVNpn','axios','arch','readFileSync','yarn\x20build:production','\x5cREADME.md','\x5cdist\x5cindex.js','package_version','from','component_config_content','message','3793056inFCES','createInterface','【Error】:window暴露配置缺少info基础信息','path','thumbnail_base64','网络异常。','execSync','catch','【Error】:组件根目录必须包含thumbnail.png缩略图片','length','match','请输入此次提交信息,按Enter确认:','status','question','../../../package.json','/yarn.lock','Auth\x20Fail!'];a7_0x4ace=function(){return _0x43b192;};return a7_0x4ace();}module[a7_0x387b4c(0x94)]=_0x4e084b=>{const _0x3212f5=a7_0x387b4c,_0x34049d=path[_0x3212f5(0xb7)](__dirname,_0x3212f5(0x8a));!fs[_0x3212f5(0x8b)](_0x34049d)&&(console[_0x3212f5(0x8c)](_0x3212f5(0x8d)),process['exit'](0x0));const [_0x4583a4,_0x19058a]=fs['readFileSync'](_0x34049d)[_0x3212f5(0xb4)]()[_0x3212f5(0x92)]('/');axios[_0x3212f5(0x95)](getApiHost()+'/api/auth',{'username':_0x4583a4,'password':_0x19058a})['then'](_0x52990d=>{const _0x404df8=_0x3212f5;if(_0x52990d[_0x404df8(0xb8)][_0x404df8(0xad)]){const _0x2ac2e3=path['resolve']('./');console[_0x404df8(0x8c)]('Please\x20wait,\x20build\x20...');fs['existsSync'](_0x2ac2e3+_0x404df8(0xb0))?child_process[_0x404df8(0xa7)](_0x404df8(0x9a),{'cwd':_0x2ac2e3}):child_process[_0x404df8(0xa7)]('npm\x20run\x20build:production',{'cwd':_0x2ac2e3});const _0x1ceadb=_0x2ac2e3+_0x404df8(0x9c),_0x2ec90c=_0x2ac2e3+'\x5cpackage.json',_0x7255bd=_0x2ac2e3+_0x404df8(0x9b),_0x1e5745=_0x2ac2e3+'\x5cthumbnail.png',_0x55876a=[os[_0x404df8(0x8f)](),os[_0x404df8(0x90)](),os[_0x404df8(0x98)](),new Date()[_0x404df8(0xb4)]()],_0x49f7b7=JSON[_0x404df8(0xba)](fs[_0x404df8(0x99)](path[_0x404df8(0xb7)](__dirname,_0x404df8(0xaf)))[_0x404df8(0xb4)]()),{version:_0x20c40a}=_0x49f7b7,_0x22abac={'username':_0x4583a4,'cmd_version':_0x20c40a,'hostname':os[_0x404df8(0x8f)](),'platform':os[_0x404df8(0x90)]()};if(fs[_0x404df8(0x8b)](_0x2ec90c)){if(fs[_0x404df8(0x8b)](_0x1ceadb)){_0x22abac[_0x404df8(0x9d)]=_0x4e084b?_0x4e084b:0x0,_0x22abac[_0x404df8(0xbf)]=fs[_0x404df8(0x99)](_0x1ceadb)['toString'](),_0x22abac[_0x404df8(0x9f)]={};const _0x191c51=fs[_0x404df8(0x99)](_0x1ceadb)[_0x404df8(0xb4)](),_0x54d025=_0x191c51[_0x404df8(0xab)](/(window\[).+?(\.componentKey|.+]={)/img);if(_0x54d025&&_0x54d025[_0x404df8(0xaa)]){const _0x1b7706=_0x191c51['match'](/componentKey.+([{,]info:\s{0,}{)/img);if(_0x1b7706&&_0x1b7706[_0x404df8(0xaa)]){let _0x270d48='{';const _0x2dee32=_0x191c51[_0x404df8(0x92)](_0x1b7706[0x0])[0x1];for(let _0x299b56=0x0;_0x299b56<_0x2dee32[_0x404df8(0xaa)];_0x299b56++){_0x270d48+=_0x2dee32[_0x299b56];if(_0x2dee32[_0x299b56]==='}')try{const _0x52cc07=new Function(_0x404df8(0x93)+_0x270d48)();_0x22abac['component_config_content']={..._0x52cc07,'defaultSetting':{}};}catch(_0x388aca){}}}else console['log'](_0x404df8(0xa3)),process[_0x404df8(0xbe)](0x0);const _0x40c5a8=_0x191c51['match'](/componentKey.+([{,]settings:\s{0,}{)/img);if(_0x40c5a8&&_0x40c5a8[_0x404df8(0xaa)]){let _0x59f5d7='{';const _0x2239f3=_0x191c51[_0x404df8(0x92)](_0x40c5a8[0x0])[0x1];for(let _0x26efb8=0x0;_0x26efb8<_0x2239f3[_0x404df8(0xaa)];_0x26efb8++){_0x59f5d7+=_0x2239f3[_0x26efb8];if(_0x2239f3[_0x26efb8]==='}')try{const _0x533b40=new Function('return\x20'+_0x59f5d7)();_0x22abac[_0x404df8(0x9f)][_0x404df8(0x91)]=_0x533b40;}catch(_0x1ab275){}}_0x22abac[_0x404df8(0x9f)]=JSON[_0x404df8(0xc0)](_0x22abac[_0x404df8(0x9f)]);}else console[_0x404df8(0x8c)](_0x404df8(0xa3)),process[_0x404df8(0xbe)](0x0);}else console[_0x404df8(0x8c)]('【Error】:请在window下暴露配置信息'),process[_0x404df8(0xbe)](0x0);fs[_0x404df8(0x8b)](_0x7255bd)?_0x22abac['readme_content']=fs[_0x404df8(0x99)](_0x7255bd)['toString']():(console['log'](_0x404df8(0xc4)),process[_0x404df8(0xbe)](0x0));if(!fs[_0x404df8(0x8b)](_0x1e5745))console[_0x404df8(0x8c)](_0x404df8(0xa9)),process[_0x404df8(0xbe)](0x0);else{const _0x3f223e=fs[_0x404df8(0x99)](_0x1e5745),_0x2a6f76=Buffer[_0x404df8(0x9e)](_0x3f223e)[_0x404df8(0xb4)](_0x404df8(0xb3));_0x22abac[_0x404df8(0xa5)]=_0x2a6f76;}io[_0x404df8(0xae)](_0x404df8(0xac),function(_0x2d936c){const _0x408d59=_0x404df8;_0x22abac[_0x408d59(0xa0)]=_0x2d936c||_0x408d59(0xb6),axios[_0x408d59(0x95)](getApiHost()+_0x408d59(0x8e),_0x22abac)['then'](_0x2a4aba=>{const _0x112338=_0x408d59;console[_0x112338(0x8c)](_0x2a4aba['data'][_0x112338(0xa0)]),process[_0x112338(0xbe)](0x0);})[_0x408d59(0xa8)](_0x3f6fe9=>{const _0x54b299=_0x408d59;console[_0x54b299(0x8c)](_0x3f6fe9),console[_0x54b299(0x8c)](_0x54b299(0xa6)),process[_0x54b299(0xbe)](0x0);});});}else console['log']('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。'),process[_0x404df8(0xbe)](0x0);}else console['log'](_0x404df8(0xc3)),process['exit'](0x0);}else console['log'](_0x404df8(0xb1));})[_0x3212f5(0xa8)](_0x4a9f52=>{const _0x158b92=_0x3212f5;console[_0x158b92(0x8c)](_0x4a9f52),console['log']('Auth\x20NetWork\x20Fail!');});};
|
@@ -1,76 +1 @@
|
|
1
|
-
const
|
2
|
-
const fs = require('fs');
|
3
|
-
const os = require('os');
|
4
|
-
const axios = require('axios');
|
5
|
-
const { getApiHost } = require('../cmd.install/config');
|
6
|
-
|
7
|
-
module.exports = version => {
|
8
|
-
|
9
|
-
const authPath = path.join(__dirname, '../../../.auth');
|
10
|
-
if (!fs.existsSync(authPath)) {
|
11
|
-
console.log(`【Error】:no auth login`);
|
12
|
-
process.exit(0);
|
13
|
-
}
|
14
|
-
|
15
|
-
const [username , password] = fs.readFileSync(authPath).toString().split('/');
|
16
|
-
axios.post(`${getApiHost()}/api/auth`, {
|
17
|
-
username,
|
18
|
-
password
|
19
|
-
}).then(res => {
|
20
|
-
if (res.data.status) {
|
21
|
-
/**
|
22
|
-
* 下发数据根路径
|
23
|
-
* @type {string}
|
24
|
-
*/
|
25
|
-
const root_path = path.resolve('./');
|
26
|
-
const dist_folder_path = `${root_path}\\dist\\index.js`;
|
27
|
-
const package_json_path = `${root_path}\\package.json`;
|
28
|
-
|
29
|
-
const log_text = [
|
30
|
-
os.hostname(),
|
31
|
-
os.platform(),
|
32
|
-
os.arch(),
|
33
|
-
new Date().toString(),
|
34
|
-
JSON.stringify(os.networkInterfaces(), null, '\t')
|
35
|
-
];
|
36
|
-
|
37
|
-
if (fs.existsSync(package_json_path)) {
|
38
|
-
if (fs.existsSync(dist_folder_path)) {
|
39
|
-
const package_json_file = JSON.parse(fs.readFileSync(package_json_path).toString());
|
40
|
-
const {
|
41
|
-
name: package_name,
|
42
|
-
version: package_version
|
43
|
-
} = package_json_file;
|
44
|
-
log_text.push(JSON.stringify(package_json_file));
|
45
|
-
|
46
|
-
axios.post(`${getApiHost()}/api/file/push`, {
|
47
|
-
username,
|
48
|
-
log_text: log_text.join('\n'),
|
49
|
-
package_name,
|
50
|
-
package_version: version
|
51
|
-
? version
|
52
|
-
: package_version,
|
53
|
-
package_content: fs.readFileSync(dist_folder_path).toString()
|
54
|
-
}).then(res => {
|
55
|
-
console.log(res.data.message);
|
56
|
-
process.exit(0);
|
57
|
-
}).catch(e => {
|
58
|
-
console.log(e);
|
59
|
-
console.log('网络异常。');
|
60
|
-
process.exit(0);
|
61
|
-
});
|
62
|
-
} else {
|
63
|
-
console.log('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。');
|
64
|
-
process.exit(0);
|
65
|
-
}
|
66
|
-
} else {
|
67
|
-
console.log('发布失败!根目录缺少‘package.json’文件,无法完成发布。');
|
68
|
-
process.exit(0);
|
69
|
-
}
|
70
|
-
} else {
|
71
|
-
console.log('Auth Fail!');
|
72
|
-
}
|
73
|
-
}).catch(e => {
|
74
|
-
console.log('Auth NetWork Fail!');
|
75
|
-
});
|
76
|
-
};
|
1
|
+
const a8_0x4ab834=a8_0xbd26;function a8_0xbd26(_0x51dc86,_0x13fc3d){const _0x342fd4=a8_0x342f();return a8_0xbd26=function(_0xbd2699,_0x2b4e7e){_0xbd2699=_0xbd2699-0x18f;let _0x269f69=_0x342fd4[_0xbd2699];return _0x269f69;},a8_0xbd26(_0x51dc86,_0x13fc3d);}(function(_0x13d92e,_0x5f4ada){const _0x32ee1c=a8_0xbd26,_0x209f6a=_0x13d92e();while(!![]){try{const _0x42f6bd=-parseInt(_0x32ee1c(0x1af))/0x1+parseInt(_0x32ee1c(0x198))/0x2*(-parseInt(_0x32ee1c(0x1ac))/0x3)+parseInt(_0x32ee1c(0x190))/0x4+parseInt(_0x32ee1c(0x1a6))/0x5*(parseInt(_0x32ee1c(0x1b1))/0x6)+-parseInt(_0x32ee1c(0x197))/0x7*(parseInt(_0x32ee1c(0x1aa))/0x8)+parseInt(_0x32ee1c(0x1a8))/0x9+-parseInt(_0x32ee1c(0x1b0))/0xa*(-parseInt(_0x32ee1c(0x199))/0xb);if(_0x42f6bd===_0x5f4ada)break;else _0x209f6a['push'](_0x209f6a['shift']());}catch(_0x374416){_0x209f6a['push'](_0x209f6a['shift']());}}}(a8_0x342f,0x3329f));const path=require(a8_0x4ab834(0x192)),fs=require('fs'),os=require('os'),axios=require(a8_0x4ab834(0x1b4)),{getApiHost}=require(a8_0x4ab834(0x19b));function a8_0x342f(){const _0x64c5e1=['340744cIiYTG','发布失败!根目录缺少‘package.json’文件,无法完成发布。','753eLyHet','resolve','push','143378FmTbJP','20NlvjdR','18jsamzL','\x5cpackage.json','post','axios','/api/file/push','171724uifQCx','parse','path','toString','readFileSync','data','stringify','21SbMDaE','1318xaaiWi','890945KYlvvs','/api/auth','../cmd.install/config','\x5cdist\x5cindex.js','platform','message','existsSync','hostname','split','then','log','Auth\x20Fail!','exit','112470Ohvrut','exports','3363570mcxIfK','catch'];a8_0x342f=function(){return _0x64c5e1;};return a8_0x342f();}module[a8_0x4ab834(0x1a7)]=_0x181f25=>{const _0x334442=a8_0x4ab834,_0xe2efad=path['join'](__dirname,'../../../.auth');!fs[_0x334442(0x19f)](_0xe2efad)&&(console['log']('【Error】:no\x20auth\x20login'),process[_0x334442(0x1a5)](0x0));const [_0x2e66ea,_0x54da44]=fs[_0x334442(0x194)](_0xe2efad)[_0x334442(0x193)]()[_0x334442(0x1a1)]('/');axios[_0x334442(0x1b3)](getApiHost()+_0x334442(0x19a),{'username':_0x2e66ea,'password':_0x54da44})[_0x334442(0x1a2)](_0x3cfc04=>{const _0x84d431=_0x334442;if(_0x3cfc04['data']['status']){const _0x63f5bc=path[_0x84d431(0x1ad)]('./'),_0x51b0c1=_0x63f5bc+_0x84d431(0x19c),_0x42d5d9=_0x63f5bc+_0x84d431(0x1b2),_0x29721d=[os[_0x84d431(0x1a0)](),os[_0x84d431(0x19d)](),os['arch'](),new Date()[_0x84d431(0x193)](),JSON[_0x84d431(0x196)](os['networkInterfaces'](),null,'\x09')];if(fs[_0x84d431(0x19f)](_0x42d5d9)){if(fs[_0x84d431(0x19f)](_0x51b0c1)){const _0x1bb253=JSON[_0x84d431(0x191)](fs[_0x84d431(0x194)](_0x42d5d9)['toString']()),{name:_0x576d5f,version:_0x41aeb2}=_0x1bb253;_0x29721d[_0x84d431(0x1ae)](JSON[_0x84d431(0x196)](_0x1bb253)),axios['post'](getApiHost()+_0x84d431(0x18f),{'username':_0x2e66ea,'log_text':_0x29721d['join']('\x0a'),'package_name':_0x576d5f,'package_version':_0x181f25?_0x181f25:_0x41aeb2,'package_content':fs['readFileSync'](_0x51b0c1)[_0x84d431(0x193)]()})['then'](_0x1aab44=>{const _0x25890a=_0x84d431;console[_0x25890a(0x1a3)](_0x1aab44[_0x25890a(0x195)][_0x25890a(0x19e)]),process[_0x25890a(0x1a5)](0x0);})[_0x84d431(0x1a9)](_0x1f2f39=>{const _0x246a53=_0x84d431;console[_0x246a53(0x1a3)](_0x1f2f39),console['log']('网络异常。'),process[_0x246a53(0x1a5)](0x0);});}else console[_0x84d431(0x1a3)]('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。'),process[_0x84d431(0x1a5)](0x0);}else console[_0x84d431(0x1a3)](_0x84d431(0x1ab)),process['exit'](0x0);}else console[_0x84d431(0x1a3)](_0x84d431(0x1a4));})[_0x334442(0x1a9)](_0x529c50=>{console['log']('Auth\x20NetWork\x20Fail!');});};
|