jjb-cmd 2.2.1 → 2.2.3

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 +1,148 @@
1
- const a9_0x446180=a9_0x1bc8;function a9_0x1bc8(_0x44d30d,_0x1229ff){const _0x35d11f=a9_0x35d1();return a9_0x1bc8=function(_0x1bc8b4,_0x7a8344){_0x1bc8b4=_0x1bc8b4-0xb4;let _0xf8c54d=_0x35d11f[_0x1bc8b4];return _0xf8c54d;},a9_0x1bc8(_0x44d30d,_0x1229ff);}(function(_0x5b5df5,_0x1496f2){const _0x18f8d6=a9_0x1bc8,_0x257bb5=_0x5b5df5();while(!![]){try{const _0x127ff1=-parseInt(_0x18f8d6(0xc8))/0x1*(-parseInt(_0x18f8d6(0xd2))/0x2)+-parseInt(_0x18f8d6(0xe4))/0x3*(-parseInt(_0x18f8d6(0xb7))/0x4)+-parseInt(_0x18f8d6(0xc3))/0x5*(-parseInt(_0x18f8d6(0xc5))/0x6)+parseInt(_0x18f8d6(0xdf))/0x7*(-parseInt(_0x18f8d6(0xf1))/0x8)+-parseInt(_0x18f8d6(0xd9))/0x9*(parseInt(_0x18f8d6(0xe7))/0xa)+-parseInt(_0x18f8d6(0xc9))/0xb+parseInt(_0x18f8d6(0xbb))/0xc;if(_0x127ff1===_0x1496f2)break;else _0x257bb5['push'](_0x257bb5['shift']());}catch(_0x30fbe7){_0x257bb5['push'](_0x257bb5['shift']());}}}(a9_0x35d1,0x2b2f2));function a9_0x35d1(){const _0x30e4fb=['--force','55sBABaV','data','120462OpSYLu','yarn\x20install\x20Done!','javaGitName','1PtEWYO','1139897MpVbDO','\x20--no-verify','appIdentifier','【Error】:no\x20setting\x20javaGitName','../../old/util','mkdirSync','yarn\x20build:','execSync','axios','343950kNcRFt','catch','split','.html','git\x20add\x20.','/api/auth','【warning】:no\x20commit,git\x20push,please\x20wait...','325323uVgsai','readFileSync','../../../.auth','Git\x20Commit\x20Done,git\x20push,please\x20wait...','log','tmpdir','63JfjBZw','writeFileSync','Project\x20build\x20Done,copy\x20project,please\x20wait...','git\x20push\x20--force','\x22no\x20message\x22','127884IBirvE','git\x20commit\x20-m\x20','【Error】:参数传递错误','80IGLTUV','【warning】:Git\x20Pull\x20Done,yarn\x20install\x20project,please\x20wait...','existsSync','path','../cmd.install/config','resolve','git\x20checkout\x20','git\x20clone\x20','/index.html','javaGit','10952YHiOqp','child_process','status','master','join','【Error】:no\x20setting\x20git','Dist\x20output\x20copy\x20Done,git\x20add,please\x20wait...','git\x20pull','16kETpKZ','exit','【Error】:no\x20auth\x20login','utf-8','224064MicMek','Git\x20Add\x20Done,git\x20commit,please\x20wait...','Git\x20Pull\x20Done,yarn\x20build:','yarn','\x5cjjb.config.js','javaGitBranch','/start/src/main/resources/templates'];a9_0x35d1=function(){return _0x30e4fb;};return a9_0x35d1();}const fs=require('fs'),os=require('os'),path=require(a9_0x446180(0xea)),child_process=require(a9_0x446180(0xf2)),{CopyFolder,DeleteDirAllFile}=require(a9_0x446180(0xcd)),{GIT_TEMP_JAVA,GIT_JAVA_ENV_JSON,getApiHost}=require(a9_0x446180(0xeb)),axios=require(a9_0x446180(0xd1));module['exports']=arguments=>{const _0x2499fd=a9_0x446180,_0x5be045=path[_0x2499fd(0xf5)](__dirname,_0x2499fd(0xdb));!fs[_0x2499fd(0xe9)](_0x5be045)&&(console['log'](_0x2499fd(0xb9)),process[_0x2499fd(0xb8)](0x0));const _0xb17b33=arguments[0x1],_0x29335b=arguments[0x2]||_0x2499fd(0xe3),_0x2f5e3f=path[_0x2499fd(0xec)]('./'),_0x64557c=_0x2f5e3f+_0x2499fd(0xbf),_0x52d040=_0x2f5e3f+'\x5cdist',_0xc79c59=os[_0x2499fd(0xde)](),[_0x167ef7,_0x353a31]=fs[_0x2499fd(0xda)](_0x5be045)['toString']()[_0x2499fd(0xd4)]('/');axios['post'](getApiHost()+_0x2499fd(0xd7),{'username':_0x167ef7,'password':_0x353a31})['then'](_0x127f17=>{const _0x481168=_0x2499fd;if(_0x127f17[_0x481168(0xc4)][_0x481168(0xf3)]){if(fs[_0x481168(0xe9)](_0x64557c)){const _0xf53d93=require(_0x64557c);if(_0xf53d93[_0x481168(0xf0)]){const _0x5cf64f=_0xc79c59+'/'+GIT_TEMP_JAVA;!fs[_0x481168(0xe9)](_0x5cf64f)&&fs[_0x481168(0xce)](_0x5cf64f);const _0x3b2e10=_0x5cf64f+'/'+_0xf53d93[_0x481168(0xc7)];!fs[_0x481168(0xe9)](_0x3b2e10)?child_process[_0x481168(0xd0)](_0x481168(0xee)+_0xf53d93[_0x481168(0xf0)],{'cwd':_0x5cf64f}):arguments[0x3]&&_0x481168(0xc2)===arguments[0x3]&&DeleteDirAllFile(_0x3b2e10,()=>child_process[_0x481168(0xd0)](_0x481168(0xee)+_0xf53d93[_0x481168(0xf0)],{'cwd':_0x5cf64f})),_0x5c4060(_0x5cf64f,_0xf53d93);}else console[_0x481168(0xdd)](_0x481168(0xb4));}}else console[_0x481168(0xdd)]('Auth\x20Fail!');})[_0x2499fd(0xd3)](_0x27d43e=>{const _0x422853=_0x2499fd;console[_0x422853(0xdd)](_0x27d43e),console[_0x422853(0xdd)]('Auth\x20NetWork\x20Fail!');});arguments['length']<0x2&&(console['log'](_0x2499fd(0xe6)),process[_0x2499fd(0xb8)](0x0));function _0x5c4060(_0x500881,_0x9d1f68){const _0x3ad034=_0x2499fd,_0x31a8be=_0x9d1f68['environment'][_0xb17b33],_0x1ef7c2=_0x500881+'/'+_0x9d1f68[_0x3ad034(0xc7)];!fs[_0x3ad034(0xe9)](_0x1ef7c2)&&(console[_0x3ad034(0xdd)](_0x3ad034(0xcc)),process[_0x3ad034(0xb8)](0x0));child_process[_0x3ad034(0xd0)](_0x3ad034(0xb6),{'cwd':_0x1ef7c2});!fs[_0x3ad034(0xe9)](_0x2f5e3f+'/node_modules')?(console['log'](_0x3ad034(0xe8)),child_process[_0x3ad034(0xd0)](_0x3ad034(0xbe),{'cwd':_0x2f5e3f}),console['log'](_0x3ad034(0xc6))):console[_0x3ad034(0xdd)](_0x3ad034(0xbd)+_0xb17b33+',please\x20wait...');child_process[_0x3ad034(0xd0)](_0x3ad034(0xcf)+_0xb17b33,{'cwd':_0x2f5e3f,'maxBuffer':0x3b9aca00}),console[_0x3ad034(0xdd)](_0x3ad034(0xe1));if(fs[_0x3ad034(0xe9)](_0x52d040)){const _0x2d1fbc=_0x9d1f68['appIdentifier'],_0x59d6ce=fs[_0x3ad034(0xda)](_0x52d040+_0x3ad034(0xef));fs[_0x3ad034(0xe0)](_0x52d040+'/'+_0x2d1fbc+_0x3ad034(0xd5),_0x59d6ce,_0x3ad034(0xba));const _0x229f2d=_0x1ef7c2+_0x3ad034(0xc1);!fs['existsSync'](_0x229f2d)&&fs['mkdirSync'](_0x229f2d);child_process[_0x3ad034(0xd0)](_0x3ad034(0xed)+(_0x31a8be[_0x3ad034(0xc0)]?_0x31a8be['javaGitBranch']:'master'),{'cwd':_0x1ef7c2});const _0x37bd8a=_0x229f2d+'/'+_0x9d1f68['appIdentifier'];DeleteDirAllFile(_0x37bd8a,()=>{const _0x492dd2=_0x3ad034;fs['mkdirSync'](_0x37bd8a),fs[_0x492dd2(0xe0)](_0x37bd8a+'.html',_0x59d6ce,_0x492dd2(0xba)),CopyFolder(_0x52d040+'\x5c'+_0x9d1f68[_0x492dd2(0xcb)],_0x37bd8a,()=>{const _0xfebbfa=_0x492dd2;console['log'](_0xfebbfa(0xb5),_0xfebbfa(0xed)+(_0x9d1f68[_0xfebbfa(0xc0)]?_0x9d1f68['javaGitBranch']:_0xfebbfa(0xf4))),setTimeout(()=>{const _0x40dc5e=_0xfebbfa;child_process[_0x40dc5e(0xd0)](_0x40dc5e(0xd6),{'cwd':_0x1ef7c2}),console['log'](_0x40dc5e(0xbc));try{child_process[_0x40dc5e(0xd0)](_0x40dc5e(0xe5)+_0x29335b+_0x40dc5e(0xca),{'cwd':_0x1ef7c2}),console['log'](_0x40dc5e(0xdc));}catch(_0x587f7b){console[_0x40dc5e(0xdd)](_0x40dc5e(0xd8));}child_process[_0x40dc5e(0xd0)](_0x40dc5e(0xe2),{'cwd':_0x1ef7c2}),console['log']('Git\x20Push\x20Done!');},0x3e8);});});}else console[_0x3ad034(0xdd)]('【Error】:打包失败,没有dist目录!');}};
1
+ const fs = require('fs');
2
+ const os = require('os');
3
+ const path = require('path');
4
+ const child_process = require('child_process');
5
+ const { CopyFolder, DeleteDirAllFile } = require('../../old/util');
6
+ const { GIT_TEMP_JAVA, GIT_JAVA_ENV_JSON, getApiHost } = require("../cmd.install/config");
7
+ const axios = require("axios");
8
+
9
+ module.exports = arguments => {
10
+
11
+ const authPath = path.join(__dirname, '../../../.auth');
12
+ if (!fs.existsSync(authPath)) {
13
+ console.log(`【Error】:no auth login`);
14
+ process.exit(0);
15
+ }
16
+
17
+ /**
18
+ * 环境
19
+ */
20
+ const environment = arguments[1];
21
+
22
+ /**
23
+ * 描述
24
+ */
25
+ const describe = arguments[2] || '"no message"';
26
+
27
+ /**
28
+ * 当前根路径
29
+ * @type {Promise<void> | Promise<string>}
30
+ */
31
+ const root_path = path.resolve('./');
32
+
33
+ /**
34
+ * jjb配置文件路径
35
+ * @type {string}
36
+ */
37
+ const config_json_path = `${root_path}\\jjb.config.js`;
38
+
39
+ /**
40
+ * 打包输出目录
41
+ * @type {string}
42
+ */
43
+ const build_output_dir = `${root_path}\\dist`;
44
+
45
+ /**
46
+ * 临时目录
47
+ */
48
+ const tmpdir = os.tmpdir();
49
+
50
+ const [username , password] = fs.readFileSync(authPath).toString().split('/');
51
+ axios.post(`${getApiHost()}/api/auth`, {
52
+ username,
53
+ password
54
+ }).then(res => {
55
+ if (res.data.status) {
56
+ if (fs.existsSync(config_json_path)) {
57
+ const jjbConfig = require(config_json_path);
58
+ // const config_json_file = JSON.parse(fs.readFileSync(config_json_path).toString());
59
+ if (jjbConfig.javaGit) {
60
+ const tempGit = tmpdir + '/' + GIT_TEMP_JAVA;
61
+ if (!fs.existsSync(tempGit)) {
62
+ fs.mkdirSync(tempGit);
63
+ }
64
+ const projectDir = `${tempGit}/${jjbConfig.javaGitName}`;
65
+ if (!fs.existsSync(projectDir)) {
66
+ child_process.execSync(`git clone ${jjbConfig.javaGit}`, {cwd: tempGit});
67
+ } else {
68
+ if (arguments[3] && "force" === arguments[3]) {
69
+ DeleteDirAllFile(projectDir, () => child_process.execSync(`git clone ${jjbConfig.javaGit}`, {cwd: tempGit}));
70
+ }
71
+ }
72
+ project_sync(tempGit, jjbConfig);
73
+ } else {
74
+ console.log('【Error】:no setting git');
75
+ }
76
+ }
77
+ } else {
78
+ console.log('Auth Fail!');
79
+ }
80
+ }).catch(e => {
81
+ console.log(e)
82
+ console.log('Auth NetWork Fail!');
83
+ });
84
+
85
+ if (arguments.length < 2) {
86
+ console.log('【Error】:参数传递错误');
87
+ process.exit(0);
88
+ }
89
+
90
+ /**
91
+ * 项目git同步
92
+ */
93
+ function project_sync (tempGit, jjbConfig) {
94
+ const envData = jjbConfig.environment[environment];
95
+ const projectDir = `${tempGit}/${jjbConfig.javaGitName}`;
96
+ if (!fs.existsSync(projectDir)) {
97
+ console.log('【Error】:no setting javaGitName');
98
+ process.exit(0);
99
+ }
100
+ child_process.execSync(`git pull`, { cwd: projectDir });
101
+ if (!fs.existsSync(root_path + '/node_modules')) {
102
+ console.log('【warning】:Git Pull Done,yarn install project,please wait...');
103
+ child_process.execSync(`yarn`, { cwd: root_path });
104
+ console.log('yarn install Done!');
105
+ } else {
106
+ console.log(`Git Pull Done,yarn build:${environment},please wait...`);
107
+ }
108
+ child_process.execSync(`yarn build:${environment}`, { cwd: root_path, maxBuffer: 1000000000 });
109
+ console.log('Project build Done,copy project,please wait...');
110
+ if (fs.existsSync(build_output_dir)) {
111
+ const appIdentifier = jjbConfig.appIdentifier;
112
+ const indexContent = fs.readFileSync(build_output_dir + '/index.html');
113
+ fs.writeFileSync(build_output_dir + '/' + appIdentifier + '.html', indexContent, 'utf-8');
114
+ if (arguments[4] && arguments[4] === 'index') {
115
+ fs.writeFileSync(build_output_dir + '/index.html', indexContent, 'utf-8');
116
+ }
117
+ // const tempJavaPath = `${projectDir}/src/main/resources/templates/${GIT_JAVA_ENV_JSON[environment]}`;
118
+ const tempJavaPath = `${projectDir}/start/src/main/resources/templates`;
119
+ if (!fs.existsSync(tempJavaPath)) {
120
+ fs.mkdirSync(tempJavaPath);
121
+ }
122
+ child_process.execSync(`git checkout ${envData.javaGitBranch ? envData.javaGitBranch : 'master'}`, { cwd: projectDir });
123
+ const projectJavaPath = tempJavaPath + '/' + jjbConfig.appIdentifier;
124
+ DeleteDirAllFile(projectJavaPath, () => {
125
+ fs.mkdirSync(projectJavaPath);
126
+ fs.writeFileSync(projectJavaPath+'.html', indexContent, 'utf-8');
127
+ CopyFolder(build_output_dir + '\\' +jjbConfig.appIdentifier, projectJavaPath, () => {
128
+ console.log('Dist output copy Done,git add,please wait...', `git checkout ${jjbConfig.javaGitBranch ? jjbConfig.javaGitBranch : 'master'}`);
129
+ setTimeout(() => {
130
+ child_process.execSync(`git add .`, { cwd: projectDir });
131
+ console.log('Git Add Done,git commit,please wait...');
132
+ try {
133
+ child_process.execSync(`git commit -m ${describe} --no-verify`, { cwd: projectDir });
134
+ console.log('Git Commit Done,git push,please wait...');
135
+ } catch (e) {
136
+ console.log('【warning】:no commit,git push,please wait...');
137
+ }
138
+ child_process.execSync(`git push --force`, { cwd: projectDir });
139
+ console.log('Git Push Done!');
140
+ }, 1000);
141
+ });
142
+ });
143
+ } else {
144
+ console.log('【Error】:打包失败,没有dist目录!');
145
+ }
146
+ }
147
+
148
+ };
@@ -1 +1,205 @@
1
- const a10_0x40a73d=a10_0x83ba;(function(_0x25c892,_0x178355){const _0x52afd1=a10_0x83ba,_0x5caf78=_0x25c892();while(!![]){try{const _0x510ee1=parseInt(_0x52afd1(0x90))/0x1*(parseInt(_0x52afd1(0xa8))/0x2)+-parseInt(_0x52afd1(0xca))/0x3*(parseInt(_0x52afd1(0xbc))/0x4)+parseInt(_0x52afd1(0xb8))/0x5+parseInt(_0x52afd1(0x9c))/0x6*(-parseInt(_0x52afd1(0xc0))/0x7)+-parseInt(_0x52afd1(0xc6))/0x8+-parseInt(_0x52afd1(0x96))/0x9*(parseInt(_0x52afd1(0xbd))/0xa)+-parseInt(_0x52afd1(0xab))/0xb*(-parseInt(_0x52afd1(0x98))/0xc);if(_0x510ee1===_0x178355)break;else _0x5caf78['push'](_0x5caf78['shift']());}catch(_0x337c6c){_0x5caf78['push'](_0x5caf78['shift']());}}}(a10_0x36ba,0x9e221));function a10_0x83ba(_0xa8cb85,_0x2f66f4){const _0x36ba5d=a10_0x36ba();return a10_0x83ba=function(_0x83ba16,_0x3db0d2){_0x83ba16=_0x83ba16-0x86;let _0x4db009=_0x36ba5d[_0x83ba16];return _0x4db009;},a10_0x83ba(_0xa8cb85,_0x2f66f4);}const path=require(a10_0x40a73d(0xb7)),fs=require('fs'),os=require('os'),axios=require('axios'),readline=require(a10_0x40a73d(0xb0)),io=readline[a10_0x40a73d(0xb6)]({'input':process[a10_0x40a73d(0xae)],'output':process[a10_0x40a73d(0x8d)]}),child_process=require(a10_0x40a73d(0x99));function a10_0x36ba(){const _0x4552c0=['stringify','stdout','message','发布失败!根目录缺少‘package.json’文件,无法完成发布。','423989IEKBfA','【Error】:window暴露配置缺少info基础信息','hostname','resolve','/api/file/publish','toString','23193EeCDUm','join','773868QEqNzY','child_process','发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。','indexOf','2838MTAJHk','请输入此次提交信息,按Enter确认:','parse','data','../../../package.json','../../../.auth','【Error】:host\x20non-existent','【Error】:version\x20non-existent','execSync','【Error】:no\x20auth\x20login','/api/auth','【Error】:请必须包含README.md说明文件','4GAVDsa','yarn\x20build:production','catch','451wOShte','/yarn.lock','length','stdin','http','readline','log','\x5cREADME.md','post','platform','defaultSetting','createInterface','path','1082185gQzkQO','then','from','split','64HphvuH','4890rXhscp','no\x20message','component_config_content','10591orNSwc','readFileSync','base64','package_version','status','match','5942696gPJlgh','readme_content','return\x20','question','64146Sjowbb','exports','arch','exit','\x5cdist\x5cindex.js','npm\x20run\x20build:production','existsSync','package_content'];a10_0x36ba=function(){return _0x4552c0;};return a10_0x36ba();}module[a10_0x40a73d(0xcb)]=_0x4bd85c=>{const _0x5531dc=a10_0x40a73d,[_0x3d5258,_0xbaa3b0]=_0x4bd85c,_0x1deffc=path[_0x5531dc(0x97)](__dirname,_0x5531dc(0xa1));!fs[_0x5531dc(0x8a)](_0x1deffc)&&(console[_0x5531dc(0xb1)](_0x5531dc(0xa5)),process[_0x5531dc(0x87)](0x0));(!_0x3d5258||_0x3d5258[_0x5531dc(0x9b)](_0x5531dc(0xaf))===-0x1)&&(console['log'](_0x5531dc(0xa2)),process[_0x5531dc(0x87)](0x0));!_0xbaa3b0&&(console[_0x5531dc(0xb1)](_0x5531dc(0xa3)),process[_0x5531dc(0x87)](0x0));const [_0xe27a5b,_0x399725]=fs[_0x5531dc(0xc1)](_0x1deffc)[_0x5531dc(0x95)]()[_0x5531dc(0xbb)]('/');axios[_0x5531dc(0xb3)](_0x3d5258+_0x5531dc(0xa6),{'username':_0xe27a5b,'password':_0x399725})[_0x5531dc(0xb9)](_0x277f01=>{const _0x5ef8b3=_0x5531dc;if(_0x277f01['data'][_0x5ef8b3(0xc4)]){const _0x27c463=path[_0x5ef8b3(0x93)]('./');console[_0x5ef8b3(0xb1)]('Please\x20wait,\x20build\x20...');fs['existsSync'](_0x27c463+_0x5ef8b3(0xac))?child_process[_0x5ef8b3(0xa4)](_0x5ef8b3(0xa9),{'cwd':_0x27c463}):child_process['execSync'](_0x5ef8b3(0x89),{'cwd':_0x27c463});const _0x464760=_0x27c463+_0x5ef8b3(0x88),_0x3a2694=_0x27c463+'\x5cpackage.json',_0x1541eb=_0x27c463+_0x5ef8b3(0xb2),_0x156153=_0x27c463+'\x5cthumbnail.png',_0x2b77b2=[os['hostname'](),os[_0x5ef8b3(0xb4)](),os[_0x5ef8b3(0x86)](),new Date()['toString']()],_0x1a213a=JSON[_0x5ef8b3(0x9e)](fs[_0x5ef8b3(0xc1)](path[_0x5ef8b3(0x97)](__dirname,_0x5ef8b3(0xa0)))['toString']()),{version:_0x53288a}=_0x1a213a,_0x5b4705={'username':_0xe27a5b,'cmd_version':_0x53288a,'hostname':os[_0x5ef8b3(0x92)](),'platform':os['platform']()};if(fs[_0x5ef8b3(0x8a)](_0x3a2694)){if(fs[_0x5ef8b3(0x8a)](_0x464760)){_0x5b4705[_0x5ef8b3(0xc3)]=_0xbaa3b0?_0xbaa3b0:0x0,_0x5b4705[_0x5ef8b3(0x8b)]=fs[_0x5ef8b3(0xc1)](_0x464760)[_0x5ef8b3(0x95)]();const _0xef94ae=fs[_0x5ef8b3(0xc1)](_0x464760)[_0x5ef8b3(0x95)](),_0x3036d6=_0xef94ae[_0x5ef8b3(0xc5)](/(window\[).+?(\.componentKey|.+]={)/img);if(_0x3036d6&&_0x3036d6[_0x5ef8b3(0xad)]){const _0x46422c=_0xef94ae[_0x5ef8b3(0xc5)](/componentKey.+(info:\s{0,}{)/img);if(_0x46422c&&_0x46422c[_0x5ef8b3(0xad)]){let _0x471a4c='{';const _0x3d6008=_0xef94ae['split'](_0x46422c[0x0])[0x1];for(let _0x3037f6=0x0;_0x3037f6<_0x3d6008[_0x5ef8b3(0xad)];_0x3037f6++){_0x471a4c+=_0x3d6008[_0x3037f6];if(_0x3d6008[_0x3037f6]==='}')try{const _0x21ac59=new Function(_0x5ef8b3(0xc8)+_0x471a4c)();_0x5b4705[_0x5ef8b3(0xbf)]={..._0x21ac59,'defaultSetting':{}};}catch(_0x3e69c1){}}}else console[_0x5ef8b3(0xb1)](_0x5ef8b3(0x91)),process[_0x5ef8b3(0x87)](0x0);const _0x39df9c=_0xef94ae[_0x5ef8b3(0xc5)](/componentKey.+(settings:\s{0,}{)/img);if(_0x39df9c&&_0x39df9c['length']){let _0x433909='{';const _0x149cf4=_0xef94ae['split'](_0x39df9c[0x0])[0x1];for(let _0x2785c3=0x0;_0x2785c3<_0x149cf4[_0x5ef8b3(0xad)];_0x2785c3++){_0x433909+=_0x149cf4[_0x2785c3];if(_0x149cf4[_0x2785c3]==='}')try{const _0x5e8fe8=new Function(_0x5ef8b3(0xc8)+_0x433909)();_0x5b4705[_0x5ef8b3(0xbf)][_0x5ef8b3(0xb5)]=_0x5e8fe8;}catch(_0x36ee2a){}}_0x5b4705['component_config_content']=JSON[_0x5ef8b3(0x8c)](_0x5b4705[_0x5ef8b3(0xbf)]);}else console[_0x5ef8b3(0xb1)](_0x5ef8b3(0x91)),process[_0x5ef8b3(0x87)](0x0);}else console[_0x5ef8b3(0xb1)]('【Error】:请在window下暴露配置信息'),process[_0x5ef8b3(0x87)](0x0);fs[_0x5ef8b3(0x8a)](_0x1541eb)?_0x5b4705[_0x5ef8b3(0xc7)]=fs['readFileSync'](_0x1541eb)[_0x5ef8b3(0x95)]():(console[_0x5ef8b3(0xb1)](_0x5ef8b3(0xa7)),process[_0x5ef8b3(0x87)](0x0));if(!fs[_0x5ef8b3(0x8a)](_0x156153))console[_0x5ef8b3(0xb1)]('【Error】:组件根目录必须包含thumbnail.png缩略图片'),process[_0x5ef8b3(0x87)](0x0);else{const _0x2ffe32=fs[_0x5ef8b3(0xc1)](_0x156153),_0x781398=Buffer[_0x5ef8b3(0xba)](_0x2ffe32)['toString'](_0x5ef8b3(0xc2));_0x5b4705['thumbnail_base64']=_0x781398;}io[_0x5ef8b3(0xc9)](_0x5ef8b3(0x9d),function(_0x2964b5){const _0x3472a5=_0x5ef8b3;_0x5b4705['message']=_0x2964b5||_0x3472a5(0xbe),axios[_0x3472a5(0xb3)](_0x3d5258+_0x3472a5(0x94),_0x5b4705)[_0x3472a5(0xb9)](_0x5595f0=>{const _0x32ef57=_0x3472a5;console[_0x32ef57(0xb1)](_0x5595f0[_0x32ef57(0x9f)][_0x32ef57(0x8e)]),process[_0x32ef57(0x87)](0x0);})[_0x3472a5(0xaa)](_0x2b1b4f=>{const _0x20426f=_0x3472a5;console[_0x20426f(0xb1)](_0x2b1b4f),console[_0x20426f(0xb1)]('网络异常。'),process['exit'](0x0);});});}else console[_0x5ef8b3(0xb1)](_0x5ef8b3(0x9a)),process[_0x5ef8b3(0x87)](0x0);}else console[_0x5ef8b3(0xb1)](_0x5ef8b3(0x8f)),process['exit'](0x0);}else console[_0x5ef8b3(0xb1)]('Auth\x20Fail!');})[_0x5531dc(0xaa)](_0x567e0d=>{const _0x450cea=_0x5531dc;console['log'](_0x567e0d),console[_0x450cea(0xb1)]('Auth\x20NetWork\x20Fail!');});};
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
+
12
+ module.exports = args => {
13
+
14
+ const [apiHost, version] = args;
15
+
16
+ const authPath = path.join(__dirname, '../../../.auth');
17
+ if (!fs.existsSync(authPath)) {
18
+ console.log(`【Error】:no auth login`);
19
+ process.exit(0);
20
+ }
21
+
22
+ if (!apiHost || apiHost.indexOf('http') === -1) {
23
+ console.log(`【Error】:host non-existent`);
24
+ process.exit(0);
25
+ }
26
+
27
+ if (!version) {
28
+ console.log(`【Error】:version non-existent`);
29
+ process.exit(0);
30
+ }
31
+
32
+ const [ username, password ] = fs.readFileSync(authPath).toString().split('/');
33
+ axios.post(`${apiHost}/api/auth`, {
34
+ username,
35
+ password
36
+ }).then(res => {
37
+ if (res.data.status) {
38
+
39
+ /**
40
+ * 下发数据根路径
41
+ * @type {string}
42
+ */
43
+ const root_path = path.resolve('./');
44
+
45
+ console.log('Please wait, build ...');
46
+ if (fs.existsSync(root_path + '/yarn.lock')) {
47
+ child_process.execSync('yarn build:production', { cwd: root_path });
48
+ } else {
49
+ child_process.execSync('npm run build:production', { cwd: root_path });
50
+ }
51
+
52
+ const dist_folder_path = `${root_path}\\dist\\index.js`;
53
+ const package_json_path = `${root_path}\\package.json`;
54
+ const readme_path = `${root_path}\\README.md`;
55
+ const thumbnail_png_path = `${root_path}\\thumbnail.png`;
56
+ const log_text = [
57
+ os.hostname(),
58
+ os.platform(),
59
+ os.arch(),
60
+ new Date().toString()
61
+ ];
62
+
63
+ const package_json_file = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../package.json')).toString());
64
+ const {
65
+ version: cmd_version
66
+ } = package_json_file;
67
+
68
+ const pushData = {
69
+ username,
70
+ cmd_version,
71
+ hostname: os.hostname(),
72
+ platform: os.platform()
73
+ };
74
+
75
+ if (fs.existsSync(package_json_path)) {
76
+ if (fs.existsSync(dist_folder_path)) {
77
+ pushData.package_version = version
78
+ ? version
79
+ : 0;
80
+ pushData.package_content = fs.readFileSync(dist_folder_path).toString();
81
+
82
+ const dist_content = fs.readFileSync(dist_folder_path).toString();
83
+ const matches = dist_content.match(/(window\[).+?(\.componentKey|.+]={)/img);
84
+ if (matches && matches.length){
85
+
86
+ const infoMatches = dist_content.match(/componentKey.+(info:\s{0,}{)/img);
87
+ if (infoMatches && infoMatches.length) {
88
+ let infoStr = '{';
89
+ const infoStr1 = dist_content.split(infoMatches[0])[1];
90
+ for (let i = 0; i < infoStr1.length; i++){
91
+ infoStr += infoStr1[i];
92
+ if (infoStr1[i] === '}') {
93
+ try {
94
+ const currJson = new Function('return '+infoStr)();
95
+ pushData.component_config_content = {
96
+ ...currJson,
97
+ defaultSetting: {}
98
+ };
99
+ } catch (e) {
100
+
101
+ }
102
+ }
103
+ }
104
+ } else {
105
+ console.log('【Error】:window暴露配置缺少info基础信息');
106
+ process.exit(0);
107
+ }
108
+
109
+ const settingsMatches = dist_content.match(/componentKey.+(settings:\s{0,}{)/img);
110
+ if (settingsMatches && settingsMatches.length) {
111
+ let settingsStr = '{';
112
+ const settingsStr1 = dist_content.split(settingsMatches[0])[1];
113
+ for (let i = 0; i < settingsStr1.length; i++){
114
+ settingsStr += settingsStr1[i];
115
+ if (settingsStr1[i] === '}') {
116
+ try {
117
+ const currJson = new Function('return '+settingsStr)();
118
+ pushData.component_config_content.defaultSetting = currJson;
119
+ } catch (e) {
120
+
121
+ }
122
+ }
123
+ }
124
+
125
+ pushData.component_config_content = JSON.stringify(pushData.component_config_content);
126
+ } else {
127
+ console.log('【Error】:window暴露配置缺少info基础信息');
128
+ process.exit(0);
129
+ }
130
+
131
+ // let currStr = matches[0].split('=')[1];
132
+ // const str= dist_content.split(matches[0])[1];
133
+ // for (let i = 0; i< str.length; i++){
134
+ // currStr += str[i]
135
+ // if (str[i] === '}'){
136
+ // try {
137
+ // const currJson = new Function('return '+currStr)();
138
+ // if (!currJson.info) {
139
+ // console.log('【Error】:window暴露配置缺少info基础信息');
140
+ // process.exit(0);
141
+ // }
142
+ // if (!currJson.settings) {
143
+ // console.log('【Error】:window暴露配置缺少settings基础信息');
144
+ // process.exit(0);
145
+ // }
146
+ // pushData.component_config_content = JSON.stringify({
147
+ // ...currJson.info,
148
+ // defaultSetting: currJson.settings
149
+ // });
150
+ // break;
151
+ // }
152
+ // catch (e) {
153
+ //
154
+ // }
155
+ // }
156
+ //
157
+ // }
158
+ } else {
159
+ console.log('【Error】:请在window下暴露配置信息');
160
+ process.exit(0);
161
+ }
162
+
163
+ if (fs.existsSync(readme_path)) {
164
+ pushData.readme_content = fs.readFileSync(readme_path).toString();
165
+ } else {
166
+ console.log('【Error】:请必须包含README.md说明文件');
167
+ process.exit(0);
168
+ }
169
+
170
+ if (!fs.existsSync(thumbnail_png_path)) {
171
+ console.log('【Error】:组件根目录必须包含thumbnail.png缩略图片');
172
+ process.exit(0);
173
+ } else {
174
+ const thumbnailData = fs.readFileSync(thumbnail_png_path);
175
+ const thumbnail_base64 = Buffer.from(thumbnailData).toString('base64');
176
+ pushData.thumbnail_base64 = thumbnail_base64;
177
+ }
178
+
179
+ io.question('请输入此次提交信息,按Enter确认:', function (message) {
180
+ pushData.message = message || 'no message';
181
+ axios.post(`${apiHost}/api/file/publish`, pushData).then(res => {
182
+ console.log(res.data.message);
183
+ process.exit(0);
184
+ }).catch(e => {
185
+ console.log(e);
186
+ console.log('网络异常。');
187
+ process.exit(0);
188
+ });
189
+ });
190
+ } else {
191
+ console.log('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。');
192
+ process.exit(0);
193
+ }
194
+ } else {
195
+ console.log('发布失败!根目录缺少‘package.json’文件,无法完成发布。');
196
+ process.exit(0);
197
+ }
198
+ } else {
199
+ console.log('Auth Fail!');
200
+ }
201
+ }).catch(e => {
202
+ console.log(e);
203
+ console.log('Auth NetWork Fail!');
204
+ });
205
+ };
@@ -1 +1,65 @@
1
- function a11_0x1174(){const _0x3094e9=['.eslintrc.js','48oDsGnB','files','proxy.js','keys','babel','8354264uYNjRK','113589EYoFJh','【Error】:no\x20','prettier','1496918xYUQme','get','resolve','6246045RDMfTF','join','log','../cmd.install/config','build.js','521952LIVRoJ','includes','exports','config.js','getTime','632246bjQfMn','\x20file,\x20available:[','length','writeFileSync','utils.js','jjb.script','https','path','2112112ldNGfB','exit','server.js','\x20file\x20Success!','All\x20Finish!','http\x20error\x20','.eslintignore','data','remoteDir','localDir'];a11_0x1174=function(){return _0x3094e9;};return a11_0x1174();}const a11_0x5c5c19=a11_0x1867;function a11_0x1867(_0x475969,_0x449afd){const _0x11743e=a11_0x1174();return a11_0x1867=function(_0x186764,_0xec28b){_0x186764=_0x186764-0x193;let _0x1b7e28=_0x11743e[_0x186764];return _0x1b7e28;},a11_0x1867(_0x475969,_0x449afd);}(function(_0x48f666,_0x3891a9){const _0x36b4af=a11_0x1867,_0x770358=_0x48f666();while(!![]){try{const _0x268bce=parseInt(_0x36b4af(0x197))/0x1+-parseInt(_0x36b4af(0x1b3))/0x2+parseInt(_0x36b4af(0x1bb))/0x3+parseInt(_0x36b4af(0x19f))/0x4+parseInt(_0x36b4af(0x1b6))/0x5+-parseInt(_0x36b4af(0x1aa))/0x6*(parseInt(_0x36b4af(0x1b0))/0x7)+-parseInt(_0x36b4af(0x1af))/0x8;if(_0x268bce===_0x3891a9)break;else _0x770358['push'](_0x770358['shift']());}catch(_0x1c988a){_0x770358['push'](_0x770358['shift']());}}}(a11_0x1174,0xa15ad));const https=require(a11_0x5c5c19(0x19d)),fs=require('fs'),path=require(a11_0x5c5c19(0x19e)),{CONFIG_FILE_HOST}=require(a11_0x5c5c19(0x1b9)),REGISTRY={'eslint':{'remoteDir':'eslint','files':[a11_0x5c5c19(0x1a9),a11_0x5c5c19(0x1a5)]},'prettier':{'remoteDir':a11_0x5c5c19(0x1b2),'files':['.prettierrc.js','.prettierignore']},'jjb_script':{'remoteDir':a11_0x5c5c19(0x19c),'localDir':a11_0x5c5c19(0x19c),'files':[a11_0x5c5c19(0x1ba),a11_0x5c5c19(0x195),a11_0x5c5c19(0x1ac),a11_0x5c5c19(0x1a1),a11_0x5c5c19(0x19b)]},'babel':{'remoteDir':a11_0x5c5c19(0x1ae),'files':['.babelrc']},'microAppPackage':{'remoteDir':'micro.app.package.json','files':['package.json']}},root_path=path[a11_0x5c5c19(0x1b5)]('./');function recursion(_0x1c0cd2,_0x44c7a8,_0x14a9fb){const _0x2bfa6d=a11_0x5c5c19,_0xee269c=_0x1c0cd2[_0x2bfa6d(0x1ab)][_0x44c7a8];https[_0x2bfa6d(0x1b4)](CONFIG_FILE_HOST+'/'+(_0x1c0cd2[_0x2bfa6d(0x1a7)]?_0x1c0cd2[_0x2bfa6d(0x1a7)]+'/':'')+_0xee269c+'?v='+new Date()[_0x2bfa6d(0x196)](),_0xcf7d31=>{const _0x5a9547=_0x2bfa6d;let _0x43e7d4='';_0xcf7d31['on'](_0x5a9547(0x1a6),_0x49bd34=>{_0x43e7d4+=_0x49bd34;}),_0xcf7d31['on']('end',()=>{const _0x25dd81=_0x5a9547;_0x43e7d4&&(fs[_0x25dd81(0x19a)](root_path+'/'+(_0x1c0cd2[_0x25dd81(0x1a8)]?_0x1c0cd2['localDir']+'/':'')+_0xee269c,_0x43e7d4),console['log'](_0xee269c+_0x25dd81(0x1a2)),_0x44c7a8<_0x1c0cd2[_0x25dd81(0x1ab)][_0x25dd81(0x199)]-0x1?(_0x44c7a8++,recursion(_0x1c0cd2,_0x44c7a8,_0x14a9fb)):(console[_0x25dd81(0x1b8)](_0x25dd81(0x1a3)),_0x14a9fb&&_0x14a9fb()));})['on']('error',_0x30c381=>{const _0x4e662=_0x5a9547;console[_0x4e662(0x1b8)](_0x4e662(0x1a4),_0x30c381);});});}module[a11_0x5c5c19(0x194)]=_0x1e9742=>{const _0x2ef25b=a11_0x5c5c19;!Object[_0x2ef25b(0x1ad)](REGISTRY)[_0x2ef25b(0x193)](_0x1e9742)&&(console[_0x2ef25b(0x1b8)](_0x2ef25b(0x1b1)+_0x1e9742+_0x2ef25b(0x198)+Object[_0x2ef25b(0x1ad)](REGISTRY)[_0x2ef25b(0x1b7)]('/')+']'),process[_0x2ef25b(0x1a0)](0x0)),recursion(REGISTRY[_0x1e9742],0x0);};
1
+ const https = require('https');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { CONFIG_FILE_HOST } = require("../cmd.install/config");
5
+
6
+ const REGISTRY = {
7
+ eslint: {
8
+ remoteDir: 'eslint',
9
+ files: ['.eslintrc.js', '.eslintignore']
10
+ },
11
+ prettier: {
12
+ remoteDir: 'prettier',
13
+ files: ['.prettierrc.js', '.prettierignore']
14
+ },
15
+ jjb_script: {
16
+ remoteDir: 'jjb.script',
17
+ localDir: 'jjb.script',
18
+ files: ['build.js', 'config.js', 'proxy.js', 'server.js', 'utils.js']
19
+ },
20
+ babel: {
21
+ remoteDir: 'babel',
22
+ files: ['.babelrc']
23
+ },
24
+ microAppPackage: {
25
+ remoteDir: 'micro.app.package.json',
26
+ files: ['package.json']
27
+ }
28
+ };
29
+
30
+ const root_path = path.resolve('./');
31
+
32
+ function recursion (regObj, index, cb) {
33
+ const file = regObj.files[index];
34
+ https.get(`${CONFIG_FILE_HOST}/${regObj.remoteDir ? `${regObj.remoteDir}/` : ''}${file}?v=${new Date().getTime()}`, resp => {
35
+ let data = '';
36
+ resp.on('data', chunk => {
37
+ data += chunk;
38
+ });
39
+ resp.on('end', () => {
40
+ if (data) {
41
+ fs.writeFileSync(`${root_path}/${regObj.localDir ? `${regObj.localDir}/` : ''}${file}`, data);
42
+ console.log(file + ' file Success!');
43
+ if (index < regObj.files.length - 1) {
44
+ index++;
45
+ recursion(regObj, index, cb);
46
+ } else {
47
+ console.log('All Finish!')
48
+ cb && cb();
49
+ }
50
+ }
51
+ }).on('error', err => {
52
+ console.log('http error ', err);
53
+ });
54
+ });
55
+ }
56
+
57
+ module.exports = stdin => {
58
+
59
+ if (!Object.keys(REGISTRY).includes(stdin)) {
60
+ console.log(`【Error】:no ${stdin} file, available:[${Object.keys(REGISTRY).join('/')}]`);
61
+ process.exit(0);
62
+ }
63
+
64
+ recursion(REGISTRY[stdin], 0);
65
+ };
@@ -1 +1,23 @@
1
- const a12_0x489ca1=a12_0x3bee;function a12_0x3bee(_0x7c113c,_0x5c2336){const _0x3a4bba=a12_0x3a4b();return a12_0x3bee=function(_0x3beee7,_0x36be04){_0x3beee7=_0x3beee7-0x67;let _0x597363=_0x3a4bba[_0x3beee7];return _0x597363;},a12_0x3bee(_0x7c113c,_0x5c2336);}function a12_0x3a4b(){const _0x4af969=['152obaWjC','6069980vBFYLT','message','2405052LQtStZ','log','status','../cmd.install/config','post','3827474ePRgmU','1578801YJEjoy','/api/file/config','data','网络异常。','1693oumKUC','components','then','4ZIVeQg','host','622TjkDqt','130ZsTJqs','exit','exports','axios','11hgnMqS','702DxtkIN','server','1525oUPWlj','176652oGTITY','9fVLZzC','catch'];a12_0x3a4b=function(){return _0x4af969;};return a12_0x3a4b();}(function(_0x50d362,_0x492fc0){const _0x33c8a5=a12_0x3bee,_0x50f2c5=_0x50d362();while(!![]){try{const _0x31b5bc=-parseInt(_0x33c8a5(0x69))/0x1*(parseInt(_0x33c8a5(0x6e))/0x2)+-parseInt(_0x33c8a5(0x83))/0x3*(parseInt(_0x33c8a5(0x6c))/0x4)+parseInt(_0x33c8a5(0x76))/0x5*(-parseInt(_0x33c8a5(0x74))/0x6)+parseInt(_0x33c8a5(0x77))/0x7*(-parseInt(_0x33c8a5(0x7a))/0x8)+-parseInt(_0x33c8a5(0x78))/0x9*(parseInt(_0x33c8a5(0x7b))/0xa)+-parseInt(_0x33c8a5(0x73))/0xb*(parseInt(_0x33c8a5(0x7d))/0xc)+-parseInt(_0x33c8a5(0x6f))/0xd*(-parseInt(_0x33c8a5(0x82))/0xe);if(_0x31b5bc===_0x492fc0)break;else _0x50f2c5['push'](_0x50f2c5['shift']());}catch(_0xa54353){_0x50f2c5['push'](_0x50f2c5['shift']());}}}(a12_0x3a4b,0x57884));const axios=require(a12_0x489ca1(0x72)),{getApiHost}=require(a12_0x489ca1(0x80));module[a12_0x489ca1(0x71)]=_0x1d02aa=>{const _0x178b12=a12_0x489ca1;axios[_0x178b12(0x81)](getApiHost()+_0x178b12(0x84))[_0x178b12(0x6b)](_0x215fad=>{const _0x5afefe=_0x178b12;if(_0x215fad[_0x5afefe(0x67)][_0x5afefe(0x7f)]){const _0x3740be=_0x215fad[_0x5afefe(0x67)][_0x5afefe(0x67)];_0x1d02aa===_0x5afefe(0x75)&&(console['log'](_0x3740be[_0x5afefe(0x6d)]),console['log'](_0x3740be['port'])),_0x1d02aa==='components'&&console['log'](_0x3740be[_0x5afefe(0x6a)]);}else console[_0x5afefe(0x7e)](_0x215fad['data'][_0x5afefe(0x7c)]);process['exit'](0x0);})[_0x178b12(0x79)](()=>{const _0x5e8e6a=_0x178b12;console[_0x5e8e6a(0x7e)](_0x5e8e6a(0x68)),process[_0x5e8e6a(0x70)](0x0);});};
1
+ const axios = require('axios');
2
+ const { getApiHost } = require('../cmd.install/config');
3
+
4
+ module.exports = type => {
5
+ axios.post(`${getApiHost()}/api/file/config`).then(res => {
6
+ if (res.data.status) {
7
+ const data = res.data.data;
8
+ if (type === 'server') {
9
+ console.log(data.host);
10
+ console.log(data.port);
11
+ }
12
+ if (type === 'components') {
13
+ console.log(data.components);
14
+ }
15
+ } else {
16
+ console.log(res.data.message);
17
+ }
18
+ process.exit(0);
19
+ }).catch(() => {
20
+ console.log('网络异常。');
21
+ process.exit(0);
22
+ });
23
+ };
@@ -1 +1,58 @@
1
- const a13_0x1ec5b3=a13_0x5f40;function a13_0x3277(){const _0x3e3fbb=['existsSync','trim','readdirSync','81BFhYae','116845UAZYxE','6aUaRqG','log','188738rVmlqb','isDirectory','正在计算项目数,请稍等...','无效操作。','length','3365768ESxMEc','880089HIdeeH','exit','965914Tmmkxp','resolve','stdout','unlinkSync','stdin','6710802GEvVfN','160jVOpkH','statSync','取消删除。','readline','删除文件:','exports','question','rmdirSync','是否确认删除?删除后不可恢复![y/n]:','557632LhVXLC','1OAROTb','删除异常:','clear'];a13_0x3277=function(){return _0x3e3fbb;};return a13_0x3277();}(function(_0x1648bb,_0x302dad){const _0x107724=a13_0x5f40,_0x470c75=_0x1648bb();while(!![]){try{const _0x80a871=parseInt(_0x107724(0x1d4))/0x1*(parseInt(_0x107724(0x1c4))/0x2)+-parseInt(_0x107724(0x1c2))/0x3+-parseInt(_0x107724(0x1c1))/0x4+-parseInt(_0x107724(0x1db))/0x5*(parseInt(_0x107724(0x1dc))/0x6)+parseInt(_0x107724(0x1c9))/0x7+-parseInt(_0x107724(0x1d3))/0x8*(-parseInt(_0x107724(0x1da))/0x9)+-parseInt(_0x107724(0x1ca))/0xa*(parseInt(_0x107724(0x1de))/0xb);if(_0x80a871===_0x302dad)break;else _0x470c75['push'](_0x470c75['shift']());}catch(_0x27ce87){_0x470c75['push'](_0x470c75['shift']());}}}(a13_0x3277,0x9b575));const fs=require('fs'),path=require('path'),readline=require(a13_0x1ec5b3(0x1cd)),io=readline['createInterface']({'input':process[a13_0x1ec5b3(0x1c8)],'output':process[a13_0x1ec5b3(0x1c6)]});let f_total=0x0;function a13_0x5f40(_0x41d497,_0x40993d){const _0x32778c=a13_0x3277();return a13_0x5f40=function(_0x5f403e,_0x5b6c6d){_0x5f403e=_0x5f403e-0x1bd;let _0x5d724d=_0x32778c[_0x5f403e];return _0x5d724d;},a13_0x5f40(_0x41d497,_0x40993d);}module[a13_0x1ec5b3(0x1cf)]=function(){const _0x5f339d=a13_0x1ec5b3,_0x598756=path[_0x5f339d(0x1c5)]('./');io[_0x5f339d(0x1d0)](_0x5f339d(0x1d2),function(_0x58b300){const _0x272f49=_0x5f339d;if(_0x58b300[_0x272f49(0x1d8)]()==='y')console['log'](_0x272f49(0x1be)),setTimeout(()=>{setTimeout(()=>{const _0xcc7899=a13_0x5f40;console[_0xcc7899(0x1d6)](),exec(_0x598756),setTimeout(()=>{const _0x5df30c=_0xcc7899;console[_0x5df30c(0x1dd)]('删除完成。'),console[_0x5df30c(0x1d6)](),process[_0x5df30c(0x1c3)](0x0);},0x1f4);},0x1f4);},0x1f4);else _0x58b300[_0x272f49(0x1d8)]()==='n'?(console[_0x272f49(0x1dd)](_0x272f49(0x1cc)),process['exit'](0x0)):(console[_0x272f49(0x1dd)](_0x272f49(0x1bf)),process['exit'](0x0));});};function exec(_0x3e94cd){const _0x3c66c3=a13_0x1ec5b3;if(fs[_0x3c66c3(0x1d7)](_0x3e94cd)){const _0x389151=fs[_0x3c66c3(0x1d9)](_0x3e94cd);for(let _0x5d7bd3=0x0;_0x5d7bd3<_0x389151[_0x3c66c3(0x1c0)];_0x5d7bd3++){const _0x2be58b=_0x389151[_0x5d7bd3],_0x126994=_0x3e94cd+'/'+_0x2be58b;try{fs[_0x3c66c3(0x1cb)](_0x126994)[_0x3c66c3(0x1bd)]()?(exec(_0x126994),fs[_0x3c66c3(0x1d1)](_0x126994,{'recursive':!![]}),console['log']('删除文件夹:'+_0x126994)):(fs[_0x3c66c3(0x1c7)](_0x126994),console[_0x3c66c3(0x1dd)](_0x3c66c3(0x1ce)+_0x126994));}catch(_0x4be983){console[_0x3c66c3(0x1dd)](_0x3c66c3(0x1d5)+_0x126994);}}}}
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const readline = require('readline');
4
+ const io = readline.createInterface({
5
+ input: process.stdin,
6
+ output: process.stdout
7
+ });
8
+
9
+ let f_total = 0;
10
+
11
+ module.exports = function () {
12
+ const root_path = path.resolve('./');
13
+
14
+ io.question('是否确认删除?删除后不可恢复![y/n]:', function (answer) {
15
+ if (answer.trim() === 'y') {
16
+ console.log('正在计算项目数,请稍等...');
17
+ setTimeout(() => {
18
+ setTimeout(() => {
19
+ console.clear();
20
+ exec(root_path);
21
+ setTimeout(() => {
22
+ console.log('删除完成。');
23
+ console.clear();
24
+ process.exit(0);
25
+ }, 500);
26
+ }, 500);
27
+ }, 500);
28
+ } else if (answer.trim() === 'n') {
29
+ console.log('取消删除。');
30
+ process.exit(0);
31
+ } else {
32
+ console.log('无效操作。');
33
+ process.exit(0);
34
+ }
35
+ });
36
+ };
37
+
38
+ function exec (path) {
39
+ if (fs.existsSync(path)) {
40
+ const list = fs.readdirSync(path);
41
+ for (let i = 0; i < list.length; i++) {
42
+ const item = list[ i ];
43
+ const vPath = `${path}/${item}`;
44
+ try {
45
+ if (fs.statSync(vPath).isDirectory()) {
46
+ exec(vPath);
47
+ fs.rmdirSync(vPath, { recursive: true });
48
+ console.log('删除文件夹:' + vPath);
49
+ } else {
50
+ fs.unlinkSync(vPath);
51
+ console.log('删除文件:' + vPath);
52
+ }
53
+ } catch (e) {
54
+ console.log('删除异常:' + vPath);
55
+ }
56
+ }
57
+ }
58
+ }
@@ -1 +1,35 @@
1
- const a14_0x8313c=a14_0x1349;function a14_0x1349(_0x49bb79,_0xed8d5c){const _0x370484=a14_0x3704();return a14_0x1349=function(_0x1349d6,_0x5db568){_0x1349d6=_0x1349d6-0x175;let _0x4049f4=_0x370484[_0x1349d6];return _0x4049f4;},a14_0x1349(_0x49bb79,_0xed8d5c);}function a14_0x3704(){const _0x1d16d9=['2623048KxTyZU','264JsrIXa','parse','254405FrISfy','data','message','1401023Ihgqcj','path','\x5cpackage.json','110TxtHvS','124xkbvst','then','resolve','9yAsHrp','exports','1GUtUEg','查询失败!根目录缺少‘package.json’文件,无法完成查询。','post','6815848coIQDl','exit','status','1122790YPfRUT','/api/file/version','toString','existsSync','log','8155791ygQDsz','6bAVKbQ','catch','axios','606027HCEQKn'];a14_0x3704=function(){return _0x1d16d9;};return a14_0x3704();}(function(_0x371600,_0x3d0690){const _0xd99d8e=a14_0x1349,_0x3a65a5=_0x371600();while(!![]){try{const _0x36b92f=-parseInt(_0xd99d8e(0x192))/0x1*(-parseInt(_0xd99d8e(0x183))/0x2)+parseInt(_0xd99d8e(0x182))/0x3+parseInt(_0xd99d8e(0x18d))/0x4*(-parseInt(_0xd99d8e(0x186))/0x5)+-parseInt(_0xd99d8e(0x17f))/0x6*(parseInt(_0xd99d8e(0x17e))/0x7)+-parseInt(_0xd99d8e(0x176))/0x8*(-parseInt(_0xd99d8e(0x190))/0x9)+-parseInt(_0xd99d8e(0x179))/0xa*(parseInt(_0xd99d8e(0x18c))/0xb)+-parseInt(_0xd99d8e(0x184))/0xc*(-parseInt(_0xd99d8e(0x189))/0xd);if(_0x36b92f===_0x3d0690)break;else _0x3a65a5['push'](_0x3a65a5['shift']());}catch(_0x7cde7f){_0x3a65a5['push'](_0x3a65a5['shift']());}}}(a14_0x3704,0xd4b5e));const path=require(a14_0x8313c(0x18a)),fs=require('fs'),axios=require(a14_0x8313c(0x181)),{getApiHost}=require('../cmd.install/config');module[a14_0x8313c(0x191)]=()=>{const _0x2fef5e=a14_0x8313c,_0x3936b5=path[_0x2fef5e(0x18f)]('./'),_0x30842e=_0x3936b5+_0x2fef5e(0x18b);if(fs[_0x2fef5e(0x17c)](_0x30842e)){const _0x1f1179=JSON[_0x2fef5e(0x185)](fs['readFileSync'](_0x30842e)[_0x2fef5e(0x17b)]()),{name:_0x2e334c}=_0x1f1179;axios[_0x2fef5e(0x175)](getApiHost()+_0x2fef5e(0x17a),{'package_name':_0x2e334c})[_0x2fef5e(0x18e)](_0x50da36=>{const _0x592d2a=_0x2fef5e;_0x50da36[_0x592d2a(0x187)][_0x592d2a(0x178)]?console[_0x592d2a(0x17d)](_0x50da36[_0x592d2a(0x187)][_0x592d2a(0x187)]):console[_0x592d2a(0x17d)](_0x50da36[_0x592d2a(0x187)][_0x592d2a(0x188)]),process[_0x592d2a(0x177)](0x0);})[_0x2fef5e(0x180)](()=>{const _0x4d4c9f=_0x2fef5e;console['log']('网络异常。'),process[_0x4d4c9f(0x177)](0x0);});}else console[_0x2fef5e(0x17d)](_0x2fef5e(0x193)),process['exit'](0x0);};
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const axios = require('axios');
4
+ const { getApiHost } = require("../cmd.install/config");
5
+
6
+ module.exports = () => {
7
+ /**
8
+ * 下发数据根路径
9
+ * @type {string}
10
+ */
11
+ const root_path = path.resolve('./');
12
+ const package_json_path = `${root_path}\\package.json`;
13
+
14
+ if (fs.existsSync(package_json_path)) {
15
+ const package_json_file = JSON.parse(fs.readFileSync(package_json_path).toString());
16
+ const {
17
+ name: package_name
18
+ } = package_json_file;
19
+
20
+ axios.post(`${getApiHost()}/api/file/version`, { package_name }).then(res => {
21
+ if (res.data.status) {
22
+ console.log(res.data.data);
23
+ } else {
24
+ console.log(res.data.message);
25
+ }
26
+ process.exit(0);
27
+ }).catch(() => {
28
+ console.log('网络异常。');
29
+ process.exit(0);
30
+ });
31
+ } else {
32
+ console.log('查询失败!根目录缺少‘package.json’文件,无法完成查询。');
33
+ process.exit(0);
34
+ }
35
+ };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @author XiWell
3
+ * @version 2.0.1
4
+ * @description 基于QianKun框架的APP注册文件,请勿修改!
5
+ */
6
+
7
+ import 'moment/locale/zh-cn';
8
+ import dva from 'dva';
9
+ import { createBrowserHistory } from 'history';
10
+ import { unmountComponentAtNode } from 'react-dom';
11
+
12
+ /**
13
+ * @description 注册app
14
+ * @param selector {string}
15
+ * @returns {{unmount: Function, mount: Function, bootstrap: Function}}
16
+ */
17
+ export const registerApplication = (selector = '#root') => {
18
+ try {
19
+ const app = dva({ history: createBrowserHistory() });
20
+ require('./models').automaticModels(app);
21
+ app.router(config => require('./router').AutomaticRouter(config));
22
+
23
+ const render = () => app.start(selector);
24
+ if (!window.__POWERED_BY_QIANKUN__) render();
25
+
26
+ return {
27
+ mount: () => render(),
28
+ unmount: props => {
29
+ const { container } = props;
30
+ const element = container
31
+ ? container.querySelector(selector)
32
+ : document.querySelector(selector);
33
+ unmountComponentAtNode(element);
34
+ },
35
+ bootstrap: props => props
36
+ };
37
+ } catch (e) {
38
+ console.error('注册APP失败,原因:', e.message);
39
+ }
40
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @author XiWell
3
+ * @version 1.0.1
4
+ * @description 基于QianKun框架的APP注册文件,请勿修改!
5
+ */
6
+
7
+ import dva from 'dva';
8
+ import ReactDOM from 'react-dom';
9
+ import { createBrowserHistory } from 'history';
10
+ import 'antd/dist/antd.less';
11
+
12
+ /**
13
+ * @description 注册app
14
+ * @param selector {string}
15
+ * @returns {{unmount: Function, mount: Function, bootstrap: Function}}
16
+ */
17
+ export const registerApplication = (selector = '#app-root') => {
18
+ const app = dva({ history: createBrowserHistory() });
19
+ require('./models').automaticModels(app);
20
+ app.router(config => require('./router').AutomaticRouter(config));
21
+ app.start(selector);
22
+ };