jjb-cmd 2.2.3 → 2.2.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.
@@ -1,230 +1 @@
1
- const fs = require('fs');
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
+ function a4_0x4426(_0x7d9b6c,_0xcfa615){const _0x506e71=a4_0x506e();return a4_0x4426=function(_0x442686,_0x26649d){_0x442686=_0x442686-0x1c1;let _0xb42f4f=_0x506e71[_0x442686];return _0xb42f4f;},a4_0x4426(_0x7d9b6c,_0xcfa615);}const a4_0x2062bf=a4_0x4426;(function(_0x19293d,_0x55fdd2){const _0x5b2165=a4_0x4426,_0x5af13b=_0x19293d();while(!![]){try{const _0x5132c5=parseInt(_0x5b2165(0x1cd))/0x1*(parseInt(_0x5b2165(0x1e2))/0x2)+parseInt(_0x5b2165(0x20d))/0x3+-parseInt(_0x5b2165(0x1f5))/0x4+-parseInt(_0x5b2165(0x200))/0x5*(-parseInt(_0x5b2165(0x1d9))/0x6)+parseInt(_0x5b2165(0x1e3))/0x7+parseInt(_0x5b2165(0x207))/0x8*(-parseInt(_0x5b2165(0x1e9))/0x9)+-parseInt(_0x5b2165(0x1e6))/0xa;if(_0x5132c5===_0x55fdd2)break;else _0x5af13b['push'](_0x5af13b['shift']());}catch(_0x48260c){_0x5af13b['push'](_0x5af13b['shift']());}}}(a4_0x506e,0x6c3cc));const fs=require('fs'),os=require('os'),{GIT_HOST,GIT_TEMP_DIR,CLOUD_PROJECT}=require(a4_0x2062bf(0x1eb));function a4_0x506e(){const _0x316b32=['installResources','length','map','jjb-dva-runtime','projectId','178sZnccZ','【Error】:[jjb.config.json.installResources]类型是一个Array<string>。','name','exit','installTarget','f_create_package_json','includes','statSync','dependencies','existsSync','f_file_copy','readFileSync','30lsgXkD','projectType','f_scan_jjb_config_json_rules','【Error】:[jjb.config.json]文件解析失败,请确认是否配置正确。','f_rm_rf','\x5cpackage.json','/repository/archive.zip?private_token=','isArray','【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>。','5902EfCOUD','4535258KcFzxg','【Error】:[jjb.config.json]文件配置无效,需要installResources属性。','rmdirSync','4210750okYfMi','\x22,\x22main\x22:\x20\x22index.js\x22}','jjb-common-lib','603963FEHwdL','_zip','./config','path','f_scan_jjb_config_json','f_resolve_install_resources','tmpdir','【Error】:[jjb.config.json]文件配置无效,需要installTarget属性。','unlinkSync','【Error】:[jjb.config.json.projectType]类型是一个string。','vue-unisass-component','【Error】:[jjb.config.json.installTarget]类型是一个string。','3248792cbMVLF','push','toString','log','forEach','f_content_replace','/api/v4/projects/','string','replace','react-admin-component','\x5cjjb.config.json','442105DDgqGB','mkdirSync','.zip','micro-spa','{\x22name\x22:\x22','isDirectory','multi','8rHjyuK','filter','node_modules','src','parse','f_pull_git_repository','385329wZiZoY','writeFileSync','uniapp','\x22,\x22version\x22:\x22','readdirSync','【Error】:[jjb.config.json.installResources]无资源。','f_update_project_package_json','&ref=master'];a4_0x506e=function(){return _0x316b32;};return a4_0x506e();}exports[a4_0x2062bf(0x1dd)]=function(_0x1c6ba0){const _0x2e2ab5=a4_0x2062bf;if(fs['existsSync'](_0x1c6ba0)){const _0x2ad4b8=fs[_0x2e2ab5(0x1c4)](_0x1c6ba0);for(let _0x295542=0x0;_0x295542<_0x2ad4b8[_0x2e2ab5(0x1c9)];_0x295542++){const _0x1cefcb=_0x2ad4b8[_0x295542],_0x55dcef=_0x1c6ba0+'/'+_0x1cefcb;fs[_0x2e2ab5(0x1d4)](_0x55dcef)['isDirectory']()?(exports[_0x2e2ab5(0x1dd)](_0x55dcef),fs[_0x2e2ab5(0x1e5)](_0x55dcef)):fs[_0x2e2ab5(0x1f1)](_0x55dcef);}}},exports[a4_0x2062bf(0x20c)]=function(_0x334529=[]){const _0x2feeda=a4_0x2062bf;return _0x334529[_0x2feeda(0x1ca)](_0x4487e0=>{const _0x3cc38e=_0x2feeda,_0x32e4a5=CLOUD_PROJECT[_0x4487e0[_0x3cc38e(0x1cf)]]||undefined,_0x1ca91f=os[_0x3cc38e(0x1ef)]();return{'path':_0x1ca91f+'\x5c'+GIT_TEMP_DIR+'\x5c'+_0x4487e0[_0x3cc38e(0x1cf)]+_0x3cc38e(0x202),'compress':_0x1ca91f+'\x5c'+GIT_TEMP_DIR+'\x5c'+_0x4487e0[_0x3cc38e(0x1cf)]+_0x3cc38e(0x1ea),'repository':GIT_HOST+_0x3cc38e(0x1fb)+_0x32e4a5[_0x3cc38e(0x1cc)]+_0x3cc38e(0x1df)+_0x32e4a5['token']+_0x3cc38e(0x1c7)};});},exports[a4_0x2062bf(0x1ed)]=function(_0x1c7cd5){const _0xa5f512=a4_0x2062bf;return fs[_0xa5f512(0x1d6)](_0x1c7cd5+_0xa5f512(0x1ff));},exports[a4_0x2062bf(0x1db)]=function(_0x164381){const _0x522bd8=a4_0x2062bf;let _0x213823={};try{_0x213823=JSON[_0x522bd8(0x20b)](fs[_0x522bd8(0x1d8)](_0x164381+'\x5cjjb.config.json')[_0x522bd8(0x1f7)]());}catch(_0x5dabbf){console[_0x522bd8(0x1f8)](_0x522bd8(0x1dc)),process[_0x522bd8(0x1d0)](0x0);}!(_0x522bd8(0x1da)in _0x213823)&&(console[_0x522bd8(0x1f8)]('【Error】:[jjb.config.json]文件配置无效,需要projectType属性。'),process[_0x522bd8(0x1d0)](0x0));!(_0x522bd8(0x1d1)in _0x213823)&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1f0)),process['exit'](0x0));!(_0x522bd8(0x1c8)in _0x213823)&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1e4)),process[_0x522bd8(0x1d0)](0x0));typeof _0x213823[_0x522bd8(0x1da)]!==_0x522bd8(0x1fc)&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1f2)),process['exit'](0x0));![_0x522bd8(0x206),'spa',_0x522bd8(0x1c2),_0x522bd8(0x203)][_0x522bd8(0x1d3)](_0x213823[_0x522bd8(0x1da)])&&(console[_0x522bd8(0x1f8)]('【Error】:[jjb.config.json.projectType]配置无效,有效值<multi\x20|\x20spa\x20|\x20micro-spa\x20|\x20uniapp>。'),process[_0x522bd8(0x1d0)](0x0));typeof _0x213823[_0x522bd8(0x1d1)]!==_0x522bd8(0x1fc)&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1f4)),process['exit'](0x0));![_0x522bd8(0x209),_0x522bd8(0x20a)][_0x522bd8(0x1d3)](_0x213823[_0x522bd8(0x1d1)])&&(console[_0x522bd8(0x1f8)]('【Error】:[jjb.config.json.node_modules]配置无效,有效值<node_modules\x20|\x20src>。'),process[_0x522bd8(0x1d0)](0x0));!Array[_0x522bd8(0x1e0)](_0x213823[_0x522bd8(0x1c8)])&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1ce)),process[_0x522bd8(0x1d0)](0x0));_0x213823[_0x522bd8(0x1c8)]['length']===0x0&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1c5)),process['exit'](0x0));const _0x3912f7=exports[_0x522bd8(0x1ee)](_0x213823[_0x522bd8(0x1c8)]);return _0x3912f7[_0x522bd8(0x1ca)](_0x7efdac=>_0x7efdac[_0x522bd8(0x1cf)])[_0x522bd8(0x208)](_0x8d2d45=>!['jjb-common',_0x522bd8(0x1cb),_0x522bd8(0x1e8),'jjb-common-decorator',_0x522bd8(0x1fe),_0x522bd8(0x1f3)][_0x522bd8(0x1d3)](_0x8d2d45))['length']!==0x0&&(console[_0x522bd8(0x1f8)](_0x522bd8(0x1e1)),process[_0x522bd8(0x1d0)](0x0)),_0x213823[_0x522bd8(0x1c8)]=_0x3912f7,_0x213823;},exports[a4_0x2062bf(0x1d2)]=function(_0xa7ad1e,_0x41e16a,_0x4c1aea){const _0x2e898e=a4_0x2062bf;fs[_0x2e898e(0x1c1)](_0xa7ad1e+_0x2e898e(0x1de),_0x2e898e(0x204)+_0x41e16a+_0x2e898e(0x1c3)+_0x4c1aea+_0x2e898e(0x1e7));},exports[a4_0x2062bf(0x1ee)]=function(_0x112209=[]){const _0x59f5cd=a4_0x2062bf,_0x454da9=[];return Array[_0x59f5cd(0x1e0)](_0x112209)&&_0x112209[_0x59f5cd(0x1f9)](_0x138ccb=>{const _0x46ba6b=_0x59f5cd;if(Array[_0x46ba6b(0x1e0)](_0x138ccb)){const [_0x3111e8,_0x1ad0d5=[]]=_0x138ccb;_0x454da9[_0x46ba6b(0x1f6)]({'name':_0x3111e8,'importList':_0x1ad0d5});}else _0x454da9[_0x46ba6b(0x1f6)]({'name':_0x138ccb,'importList':[]});}),_0x454da9;},exports[a4_0x2062bf(0x1c6)]=function(_0x813ca5,_0x3f1dcf,_0x2b7899){const _0x5e0396=a4_0x2062bf,_0x21da6a=JSON[_0x5e0396(0x20b)](fs[_0x5e0396(0x1d8)](_0x813ca5)[_0x5e0396(0x1f7)]());_0x21da6a[_0x5e0396(0x1d5)][_0x3f1dcf]=_0x2b7899,fs[_0x5e0396(0x1c1)](_0x813ca5,JSON['stringify'](_0x21da6a,null,0x2));},exports[a4_0x2062bf(0x1d7)]=function(_0x59e7b4,_0x576fcf){const _0x47ac5d=a4_0x2062bf;fs[_0x47ac5d(0x1c4)](_0x59e7b4)['forEach'](_0x7b393=>{const _0x20352f=_0x47ac5d,_0x1e8bbf=_0x59e7b4+'\x5c'+_0x7b393,_0x51cd83=_0x576fcf+'\x5c'+_0x7b393;fs['statSync'](_0x1e8bbf)[_0x20352f(0x205)]()?(fs[_0x20352f(0x201)](_0x51cd83),exports[_0x20352f(0x1d7)](_0x1e8bbf,_0x51cd83)):fs[_0x20352f(0x1c1)](_0x51cd83,fs[_0x20352f(0x1d8)](_0x1e8bbf)[_0x20352f(0x1f7)]());});},exports[a4_0x2062bf(0x1fa)]=function(_0xc1040d=[],_0x5ae7f4){const _0x1cacc1=a4_0x2062bf;_0xc1040d[_0x1cacc1(0x1f9)](_0x2af2ce=>{const _0x513076=_0x1cacc1,_0xc595f7=_0x5ae7f4+_0x2af2ce[_0x513076(0x1ec)];if(fs[_0x513076(0x1d6)](_0xc595f7)){let _0x3f4809=fs['readFileSync'](_0xc595f7)[_0x513076(0x1f7)]();_0x2af2ce['replace'][_0x513076(0x1f9)](_0x1dee99=>{const _0x1add8e=_0x513076;_0x3f4809=_0x3f4809[_0x1add8e(0x1fd)](_0x1dee99[0x0],_0x1dee99[0x1]);}),fs[_0x513076(0x1c1)](_0xc595f7,_0x3f4809);}});};
@@ -1,27 +1 @@
1
- const child_process = require('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
+ const a5_0x5cd7fa=a5_0x1d00;function a5_0x1d00(_0x10c6b3,_0x5c267d){const _0x419525=a5_0x4195();return a5_0x1d00=function(_0x1d0098,_0x2bd891){_0x1d0098=_0x1d0098-0xc7;let _0x4ac38b=_0x419525[_0x1d0098];return _0x4ac38b;},a5_0x1d00(_0x10c6b3,_0x5c267d);}(function(_0x25e0da,_0x1ed543){const _0x2b403a=a5_0x1d00,_0x33d6f5=_0x25e0da();while(!![]){try{const _0x2ddc9a=-parseInt(_0x2b403a(0xd6))/0x1*(-parseInt(_0x2b403a(0xde))/0x2)+-parseInt(_0x2b403a(0xd2))/0x3*(-parseInt(_0x2b403a(0xdd))/0x4)+-parseInt(_0x2b403a(0xd5))/0x5+parseInt(_0x2b403a(0xd7))/0x6+parseInt(_0x2b403a(0xd8))/0x7*(-parseInt(_0x2b403a(0xd3))/0x8)+parseInt(_0x2b403a(0xe2))/0x9*(parseInt(_0x2b403a(0xc9))/0xa)+parseInt(_0x2b403a(0xdb))/0xb*(-parseInt(_0x2b403a(0xd4))/0xc);if(_0x2ddc9a===_0x1ed543)break;else _0x33d6f5['push'](_0x33d6f5['shift']());}catch(_0x3171f6){_0x33d6f5['push'](_0x33d6f5['shift']());}}}(a5_0x4195,0x491e8));const child_process=require(a5_0x5cd7fa(0xda)),path=require(a5_0x5cd7fa(0xc8)),fs=require('fs');module[a5_0x5cd7fa(0xce)]=_0x4abd17=>{const _0x34950c=a5_0x5cd7fa;![_0x34950c(0xd9),_0x34950c(0xdf)][_0x34950c(0xe0)](_0x4abd17)&&(console[_0x34950c(0xdc)](_0x34950c(0xca)),process[_0x34950c(0xc7)](0x0));const _0x2973e5=path[_0x34950c(0xe3)]('./');console[_0x34950c(0xdc)](_0x34950c(0xcc)),child_process['execSync'](_0x4abd17==='yarn'?_0x34950c(0xdf):_0x34950c(0xd1),{'cwd':_0x2973e5}),!fs[_0x34950c(0xcb)](_0x2973e5+'/.git')&&(console[_0x34950c(0xdc)](_0x34950c(0xcf)),child_process['execSync'](_0x34950c(0xcd),{'cwd':_0x2973e5})),console['log'](_0x34950c(0xd0)),child_process['execSync'](_0x34950c(0xe1),{'cwd':_0x2973e5}),console['log']('Finish!');};function a5_0x4195(){const _0x483c6c=['2OIJqiB','yarn','includes','npx\x20husky\x20install','4907034mgXCHL','resolve','exit','path','10DmnhtK','【Error】:no\x20registry\x20source,\x20available:[npm,\x20yarn]','existsSync','install\x20modules\x20please\x20wait....','git\x20init','exports','git\x20init\x20please\x20wait....','install\x20husky\x20please\x20wait....','npm\x20install','9522JXGCEo','42472sVzJEY','2292nGviTH','204330tipoBG','377851AlHhyK','1321836CgZxOf','49PTjtwe','npm','child_process','53064qSFZPP','log','196VOUbln'];a5_0x4195=function(){return _0x483c6c;};return a5_0x4195();}
@@ -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_0x1310(){const _0x1e05e3=['exports','958611AjuVoV','49jtcxIH','jenkins','596550vufWwH','job','jenkinsNamespace','1211420PTuDAH','resolve','branchName','3555363lSferE','647490yXvlef','【Error】:no\x20auth\x20login','1679535dpdmCL','24585304ESZcVd','jenkinsUserName','http://','jobName','jenkinsHost','exit','error:\x20','environment','jenkinsPassword','../../../.auth'];a6_0x1310=function(){return _0x1e05e3;};return a6_0x1310();}const a6_0x3279f5=a6_0x140d;function a6_0x140d(_0xaf475e,_0x544d18){const _0x131066=a6_0x1310();return a6_0x140d=function(_0x140d27,_0x2540e1){_0x140d27=_0x140d27-0x67;let _0x5bc0d9=_0x131066[_0x140d27];return _0x5bc0d9;},a6_0x140d(_0xaf475e,_0x544d18);}(function(_0x1858aa,_0xf056df){const _0x1efe92=a6_0x140d,_0x41c633=_0x1858aa();while(!![]){try{const _0x3e4cd4=parseInt(_0x1efe92(0x69))/0x1+parseInt(_0x1efe92(0x6c))/0x2+parseInt(_0x1efe92(0x72))/0x3+parseInt(_0x1efe92(0x6f))/0x4+parseInt(_0x1efe92(0x75))/0x5+-parseInt(_0x1efe92(0x73))/0x6*(-parseInt(_0x1efe92(0x6a))/0x7)+-parseInt(_0x1efe92(0x76))/0x8;if(_0x3e4cd4===_0xf056df)break;else _0x41c633['push'](_0x41c633['shift']());}catch(_0x34ce0d){_0x41c633['push'](_0x41c633['shift']());}}}(a6_0x1310,0xba483));const path=require('path'),fs=require('fs'),Jenkins=require(a6_0x3279f5(0x6b));module[a6_0x3279f5(0x68)]=arguments=>{const _0x4b0151=a6_0x3279f5,_0x272fe6=path['join'](__dirname,_0x4b0151(0x67));!fs['existsSync'](_0x272fe6)&&(console['log'](_0x4b0151(0x74)),process[_0x4b0151(0x7b)](0x0));const _0x3f8924=path[_0x4b0151(0x70)]('./'),_0xace70a=_0x3f8924+'\x5cjjb.config.js',_0x63ac48=require(_0xace70a),_0x5b0a65=_0x63ac48[_0x4b0151(0x7d)][arguments],_0x26ef9=_0x5b0a65['jenkins']||{},_0x2f5974=_0x26ef9[_0x4b0151(0x71)],_0x582e73=_0x26ef9[_0x4b0151(0x79)],_0x3ba5ac=_0x26ef9[_0x4b0151(0x7a)],_0x414c81=_0x26ef9[_0x4b0151(0x77)],_0x192519=_0x26ef9[_0x4b0151(0x7e)],_0x166f19=_0x26ef9[_0x4b0151(0x6e)],_0x3a2f2d=new Jenkins({'baseUrl':_0x4b0151(0x78)+_0x414c81+':'+_0x192519+'@'+_0x3ba5ac});try{const _0x4594be=_0x3a2f2d[_0x4b0151(0x6d)]['build']({'name':_0x582e73,'parameters':{'app_Version':_0x2f5974,'build_version':arguments,'k8s_namespace':_0x166f19,'branch':_0x2f5974,'merge':!![]},'token':_0x192519});console['log']('开始构建...',_0x4594be);}catch(_0x3c27c7){console['error'](_0x4b0151(0x7c),_0x3c27c7);}};
@@ -1,197 +1 @@
1
- const path = require('path');
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_0x4f183a=a7_0x553a;(function(_0x45024b,_0x27fe9e){const _0x1a0f77=a7_0x553a,_0x38d0cd=_0x45024b();while(!![]){try{const _0x5751d1=parseInt(_0x1a0f77(0x216))/0x1+-parseInt(_0x1a0f77(0x1fb))/0x2*(-parseInt(_0x1a0f77(0x234))/0x3)+parseInt(_0x1a0f77(0x20e))/0x4+parseInt(_0x1a0f77(0x207))/0x5*(parseInt(_0x1a0f77(0x205))/0x6)+-parseInt(_0x1a0f77(0x21f))/0x7+parseInt(_0x1a0f77(0x204))/0x8+-parseInt(_0x1a0f77(0x220))/0x9*(parseInt(_0x1a0f77(0x21a))/0xa);if(_0x5751d1===_0x27fe9e)break;else _0x38d0cd['push'](_0x38d0cd['shift']());}catch(_0x37b209){_0x38d0cd['push'](_0x38d0cd['shift']());}}}(a7_0x24fd,0x8b569));function a7_0x553a(_0x1df1b8,_0x3b5b23){const _0x24fd89=a7_0x24fd();return a7_0x553a=function(_0x553ac9,_0x52b419){_0x553ac9=_0x553ac9-0x1f3;let _0x57ce7a=_0x24fd89[_0x553ac9];return _0x57ce7a;},a7_0x553a(_0x1df1b8,_0x3b5b23);}const path=require(a7_0x4f183a(0x1f3)),fs=require('fs'),os=require('os'),axios=require(a7_0x4f183a(0x232)),readline=require(a7_0x4f183a(0x20b)),io=readline[a7_0x4f183a(0x236)]({'input':process[a7_0x4f183a(0x1f7)],'output':process[a7_0x4f183a(0x200)]}),child_process=require(a7_0x4f183a(0x218)),{getApiHost}=require(a7_0x4f183a(0x212));module[a7_0x4f183a(0x203)]=_0x828556=>{const _0x47657e=a7_0x4f183a,_0x10ecb5=path['join'](__dirname,_0x47657e(0x20a));!fs[_0x47657e(0x230)](_0x10ecb5)&&(console[_0x47657e(0x225)]('【Error】:no\x20auth\x20login'),process[_0x47657e(0x20d)](0x0));const [_0x38ae3a,_0x448aed]=fs[_0x47657e(0x210)](_0x10ecb5)[_0x47657e(0x229)]()[_0x47657e(0x21d)]('/');axios[_0x47657e(0x222)](getApiHost()+_0x47657e(0x20f),{'username':_0x38ae3a,'password':_0x448aed})[_0x47657e(0x21e)](_0x315d2f=>{const _0x533c17=_0x47657e;if(_0x315d2f[_0x533c17(0x22b)]['status']){const _0xbede52=path[_0x533c17(0x219)]('./');console[_0x533c17(0x225)](_0x533c17(0x237));fs[_0x533c17(0x230)](_0xbede52+_0x533c17(0x201))?child_process[_0x533c17(0x233)]('yarn\x20build:production',{'cwd':_0xbede52}):child_process[_0x533c17(0x233)](_0x533c17(0x226),{'cwd':_0xbede52});const _0x500bcf=_0xbede52+_0x533c17(0x208),_0x19c69d=_0xbede52+_0x533c17(0x1f6),_0x5e6804=_0xbede52+_0x533c17(0x228),_0x1615f1=_0xbede52+_0x533c17(0x211),_0x39fa90=[os['hostname'](),os[_0x533c17(0x22e)](),os[_0x533c17(0x1ff)](),new Date()[_0x533c17(0x229)]()],_0x1075c6=JSON[_0x533c17(0x22c)](fs['readFileSync'](path[_0x533c17(0x22d)](__dirname,_0x533c17(0x1f4)))[_0x533c17(0x229)]()),{version:_0x48d846}=_0x1075c6,_0x2176ff={'username':_0x38ae3a,'cmd_version':_0x48d846,'hostname':os[_0x533c17(0x231)](),'platform':os[_0x533c17(0x22e)]()};if(fs[_0x533c17(0x230)](_0x19c69d)){if(fs[_0x533c17(0x230)](_0x500bcf)){_0x2176ff['package_version']=_0x828556?_0x828556:0x0,_0x2176ff[_0x533c17(0x235)]=fs[_0x533c17(0x210)](_0x500bcf)[_0x533c17(0x229)](),_0x2176ff[_0x533c17(0x1f5)]={};const _0x13a987=fs['readFileSync'](_0x500bcf)['toString'](),_0x207c57=_0x13a987['match'](/(window\[).+?(\.componentKey|.+]={)/img);if(_0x207c57&&_0x207c57[_0x533c17(0x209)]){const _0xc4e394=_0x13a987[_0x533c17(0x206)](/componentKey.+([{,]info:\s{0,}{)/img);if(_0xc4e394&&_0xc4e394['length']){let _0x1c0181='{';const _0x3c73e5=_0x13a987['split'](_0xc4e394[0x0])[0x1];for(let _0x481da0=0x0;_0x481da0<_0x3c73e5['length'];_0x481da0++){_0x1c0181+=_0x3c73e5[_0x481da0];if(_0x3c73e5[_0x481da0]==='}')try{const _0x1a5ec0=new Function(_0x533c17(0x223)+_0x1c0181)();_0x2176ff[_0x533c17(0x1f5)]={..._0x1a5ec0,'defaultSetting':{}};}catch(_0x4884a4){}}}else console[_0x533c17(0x225)](_0x533c17(0x221)),process[_0x533c17(0x20d)](0x0);const _0x431e95=_0x13a987['match'](/componentKey.+([{,]settings:\s{0,}{)/img);if(_0x431e95&&_0x431e95[_0x533c17(0x209)]){let _0x358618='{';const _0x1d2dc1=_0x13a987[_0x533c17(0x21d)](_0x431e95[0x0])[0x1];for(let _0x3497dd=0x0;_0x3497dd<_0x1d2dc1[_0x533c17(0x209)];_0x3497dd++){_0x358618+=_0x1d2dc1[_0x3497dd];if(_0x1d2dc1[_0x3497dd]==='}')try{const _0x4525ce=new Function(_0x533c17(0x223)+_0x358618)();_0x2176ff[_0x533c17(0x1f5)][_0x533c17(0x202)]=_0x4525ce;}catch(_0x3a687d){}}_0x2176ff[_0x533c17(0x1f5)]=JSON[_0x533c17(0x22f)](_0x2176ff[_0x533c17(0x1f5)]);}else console['log']('【Error】:window暴露配置缺少info基础信息'),process[_0x533c17(0x20d)](0x0);}else console[_0x533c17(0x225)](_0x533c17(0x22a)),process[_0x533c17(0x20d)](0x0);fs['existsSync'](_0x5e6804)?_0x2176ff[_0x533c17(0x1fa)]=fs[_0x533c17(0x210)](_0x5e6804)['toString']():(console[_0x533c17(0x225)](_0x533c17(0x227)),process[_0x533c17(0x20d)](0x0));if(!fs['existsSync'](_0x1615f1))console[_0x533c17(0x225)](_0x533c17(0x21c)),process[_0x533c17(0x20d)](0x0);else{const _0x1d972d=fs[_0x533c17(0x210)](_0x1615f1),_0x15ed2e=Buffer[_0x533c17(0x1fe)](_0x1d972d)[_0x533c17(0x229)](_0x533c17(0x214));_0x2176ff['thumbnail_base64']=_0x15ed2e;}io[_0x533c17(0x238)](_0x533c17(0x1fc),function(_0x182aba){const _0x88221=_0x533c17;_0x2176ff[_0x88221(0x217)]=_0x182aba||_0x88221(0x215),axios[_0x88221(0x222)](getApiHost()+_0x88221(0x21b),_0x2176ff)[_0x88221(0x21e)](_0x3cb1e6=>{const _0xe753b6=_0x88221;console[_0xe753b6(0x225)](_0x3cb1e6[_0xe753b6(0x22b)][_0xe753b6(0x217)]),process[_0xe753b6(0x20d)](0x0);})['catch'](_0x31d14f=>{const _0x464f8e=_0x88221;console[_0x464f8e(0x225)](_0x31d14f),console[_0x464f8e(0x225)](_0x464f8e(0x20c)),process['exit'](0x0);});});}else console['log'](_0x533c17(0x1f9)),process[_0x533c17(0x20d)](0x0);}else console['log'](_0x533c17(0x224)),process[_0x533c17(0x20d)](0x0);}else console['log'](_0x533c17(0x213));})[_0x47657e(0x1f8)](_0x3e0732=>{const _0x5eb31e=_0x47657e;console[_0x5eb31e(0x225)](_0x3e0732),console[_0x5eb31e(0x225)](_0x5eb31e(0x1fd));});};function a7_0x24fd(){const _0x2ceab7=['return\x20','发布失败!根目录缺少‘package.json’文件,无法完成发布。','log','npm\x20run\x20build:production','【Error】:请必须包含README.md说明文件','\x5cREADME.md','toString','【Error】:请在window下暴露配置信息','data','parse','join','platform','stringify','existsSync','hostname','axios','execSync','208632ICkgpR','package_content','createInterface','Please\x20wait,\x20build\x20...','question','path','../../../package.json','component_config_content','\x5cpackage.json','stdin','catch','发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。','readme_content','32mynqEN','请输入此次提交信息,按Enter确认:','Auth\x20NetWork\x20Fail!','from','arch','stdout','/yarn.lock','defaultSetting','exports','3161688PosmMh','4627176vJCTjV','match','5bsDoAh','\x5cdist\x5cindex.js','length','../../../.auth','readline','网络异常。','exit','1765412DEbQgn','/api/auth','readFileSync','\x5cthumbnail.png','../cmd.install/config','Auth\x20Fail!','base64','no\x20message','874277ftTdhQ','message','child_process','resolve','1190ADvlte','/api/file/publish','【Error】:组件根目录必须包含thumbnail.png缩略图片','split','then','1400161kwvfWY','213579dUccvT','【Error】:window暴露配置缺少info基础信息','post'];a7_0x24fd=function(){return _0x2ceab7;};return a7_0x24fd();}
@@ -1,76 +1 @@
1
- const path = require('path');
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
+ function a8_0x236e(_0x4af66d,_0x7a9d39){const _0x159248=a8_0x1592();return a8_0x236e=function(_0x236ea7,_0x4ec0b6){_0x236ea7=_0x236ea7-0xa6;let _0x147d21=_0x159248[_0x236ea7];return _0x147d21;},a8_0x236e(_0x4af66d,_0x7a9d39);}const a8_0x16d965=a8_0x236e;(function(_0x88012f,_0x2c4f4a){const _0x5811f4=a8_0x236e,_0x425fd8=_0x88012f();while(!![]){try{const _0x21c2fe=parseInt(_0x5811f4(0xab))/0x1*(-parseInt(_0x5811f4(0xc3))/0x2)+parseInt(_0x5811f4(0xa6))/0x3*(parseInt(_0x5811f4(0xc8))/0x4)+parseInt(_0x5811f4(0xc2))/0x5*(parseInt(_0x5811f4(0xbc))/0x6)+parseInt(_0x5811f4(0xb6))/0x7*(-parseInt(_0x5811f4(0xc4))/0x8)+parseInt(_0x5811f4(0xb1))/0x9*(parseInt(_0x5811f4(0xb3))/0xa)+parseInt(_0x5811f4(0xac))/0xb+-parseInt(_0x5811f4(0xc7))/0xc*(parseInt(_0x5811f4(0xaf))/0xd);if(_0x21c2fe===_0x2c4f4a)break;else _0x425fd8['push'](_0x425fd8['shift']());}catch(_0x5c7c6c){_0x425fd8['push'](_0x425fd8['shift']());}}}(a8_0x1592,0x2965e));function a8_0x1592(){const _0x175615=['then','parse','log','stringify','1017795ioJqia','2WFzXuV','376312fEtqBm','【Error】:no\x20auth\x20login','hostname','235332kijzQQ','300znnThh','post','toString','join','path','发布失败!根目录缺少‘package.json’文件,无法完成发布。','\x5cpackage.json','13485rsjqhp','发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。','message','Auth\x20NetWork\x20Fail!','platform','100069LWVYSK','410784iSyTPq','/api/file/push','arch','221ApKCiu','Auth\x20Fail!','16623hqkzxY','data','390RUkrgp','exit','networkInterfaces','7QzBPHo','existsSync','readFileSync','catch','exports','split','6JZSwsD','../../../.auth'];a8_0x1592=function(){return _0x175615;};return a8_0x1592();}const path=require(a8_0x16d965(0xcc)),fs=require('fs'),os=require('os'),axios=require('axios'),{getApiHost}=require('../cmd.install/config');module[a8_0x16d965(0xba)]=_0x4a0f77=>{const _0x531885=a8_0x16d965,_0x44b209=path[_0x531885(0xcb)](__dirname,_0x531885(0xbd));!fs[_0x531885(0xb7)](_0x44b209)&&(console[_0x531885(0xc0)](_0x531885(0xc5)),process[_0x531885(0xb4)](0x0));const [_0x36fe96,_0x3d1ccb]=fs[_0x531885(0xb8)](_0x44b209)[_0x531885(0xca)]()[_0x531885(0xbb)]('/');axios[_0x531885(0xc9)](getApiHost()+'/api/auth',{'username':_0x36fe96,'password':_0x3d1ccb})[_0x531885(0xbe)](_0x360c55=>{const _0x57f63a=_0x531885;if(_0x360c55[_0x57f63a(0xb2)]['status']){const _0x531944=path['resolve']('./'),_0x1a281f=_0x531944+'\x5cdist\x5cindex.js',_0x5c081a=_0x531944+_0x57f63a(0xce),_0x3bf17f=[os[_0x57f63a(0xc6)](),os[_0x57f63a(0xaa)](),os[_0x57f63a(0xae)](),new Date()[_0x57f63a(0xca)](),JSON[_0x57f63a(0xc1)](os[_0x57f63a(0xb5)](),null,'\x09')];if(fs[_0x57f63a(0xb7)](_0x5c081a)){if(fs[_0x57f63a(0xb7)](_0x1a281f)){const _0x2a2c53=JSON[_0x57f63a(0xbf)](fs[_0x57f63a(0xb8)](_0x5c081a)[_0x57f63a(0xca)]()),{name:_0x2ab02c,version:_0x252f49}=_0x2a2c53;_0x3bf17f['push'](JSON[_0x57f63a(0xc1)](_0x2a2c53)),axios[_0x57f63a(0xc9)](getApiHost()+_0x57f63a(0xad),{'username':_0x36fe96,'log_text':_0x3bf17f[_0x57f63a(0xcb)]('\x0a'),'package_name':_0x2ab02c,'package_version':_0x4a0f77?_0x4a0f77:_0x252f49,'package_content':fs[_0x57f63a(0xb8)](_0x1a281f)[_0x57f63a(0xca)]()})[_0x57f63a(0xbe)](_0x47823e=>{const _0x42de6c=_0x57f63a;console[_0x42de6c(0xc0)](_0x47823e['data'][_0x42de6c(0xa8)]),process['exit'](0x0);})['catch'](_0x5d5f18=>{const _0x58342e=_0x57f63a;console[_0x58342e(0xc0)](_0x5d5f18),console[_0x58342e(0xc0)]('网络异常。'),process[_0x58342e(0xb4)](0x0);});}else console['log'](_0x57f63a(0xa7)),process[_0x57f63a(0xb4)](0x0);}else console['log'](_0x57f63a(0xcd)),process['exit'](0x0);}else console[_0x57f63a(0xc0)](_0x57f63a(0xb0));})[_0x531885(0xb9)](_0xe91a9f=>{const _0x2d2338=_0x531885;console[_0x2d2338(0xc0)](_0x2d2338(0xa9));});};