jjb-cmd 2.2.2 → 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_0x120784=a9_0x5f2d;function a9_0x5f2d(_0x21fc8d,_0x478a82){const _0x27914a=a9_0x2791();return a9_0x5f2d=function(_0x5f2df2,_0x2892d4){_0x5f2df2=_0x5f2df2-0x188;let _0x5199f9=_0x27914a[_0x5f2df2];return _0x5199f9;},a9_0x5f2d(_0x21fc8d,_0x478a82);}function a9_0x2791(){const _0x33e531=['2740795NQtSLU','【Error】:参数传递错误','length','2466063MOAHID','Project\x20build\x20Done,copy\x20project,please\x20wait...','yarn\x20build:','tmpdir','git\x20commit\x20-m\x20','status','\x22no\x20message\x22','【Error】:打包失败,没有dist目录!','catch','post','utf-8','environment','split','exports','exit','12NEPkyR','4980423YfaIDs','javaGitBranch','git\x20clone\x20','3087492MAYHqH','path','git\x20checkout\x20','9541406nEwSIp','master','git\x20push\x20--force','../cmd.install/config','/start/src/main/resources/templates','【Error】:no\x20setting\x20git','【warning】:no\x20commit,git\x20push,please\x20wait...','【warning】:Git\x20Pull\x20Done,yarn\x20install\x20project,please\x20wait...','【Error】:no\x20auth\x20login','writeFileSync','appIdentifier','../../../.auth','50473atZHNz','Auth\x20NetWork\x20Fail!','mkdirSync','git\x20pull',',please\x20wait...','readFileSync','data','toString','existsSync','axios','7519984vueNKe','then','\x5cdist','/api/auth','javaGitName','log','javaGit','git\x20add\x20.','execSync','6biHDnr','【Error】:no\x20setting\x20javaGitName'];a9_0x2791=function(){return _0x33e531;};return a9_0x2791();}(function(_0x15dc9d,_0x32c724){const _0x329e85=a9_0x5f2d,_0x35becf=_0x15dc9d();while(!![]){try{const _0x45fe70=parseInt(_0x329e85(0x190))/0x1*(-parseInt(_0x329e85(0x1b7))/0x2)+-parseInt(_0x329e85(0x1b8))/0x3+parseInt(_0x329e85(0x1bb))/0x4+-parseInt(_0x329e85(0x1a5))/0x5*(parseInt(_0x329e85(0x1a3))/0x6)+parseInt(_0x329e85(0x1be))/0x7+parseInt(_0x329e85(0x19a))/0x8+parseInt(_0x329e85(0x1a8))/0x9;if(_0x45fe70===_0x32c724)break;else _0x35becf['push'](_0x35becf['shift']());}catch(_0x254303){_0x35becf['push'](_0x35becf['shift']());}}}(a9_0x2791,0xcc8a6));const fs=require('fs'),os=require('os'),path=require(a9_0x120784(0x1bc)),child_process=require('child_process'),{CopyFolder,DeleteDirAllFile}=require('../../old/util'),{GIT_TEMP_JAVA,GIT_JAVA_ENV_JSON,getApiHost}=require(a9_0x120784(0x1c1)),axios=require(a9_0x120784(0x199));module[a9_0x120784(0x1b5)]=arguments=>{const _0x4817da=a9_0x120784,_0x801162=path['join'](__dirname,_0x4817da(0x18f));!fs[_0x4817da(0x198)](_0x801162)&&(console[_0x4817da(0x19f)](_0x4817da(0x18c)),process[_0x4817da(0x1b6)](0x0));const _0xa6aa63=arguments[0x1],_0x2919ee=arguments[0x2]||_0x4817da(0x1ae),_0xaa4f37=path['resolve']('./'),_0x3d207a=_0xaa4f37+'\x5cjjb.config.js',_0xb3221f=_0xaa4f37+_0x4817da(0x19c),_0x513715=os[_0x4817da(0x1ab)](),[_0x584893,_0x4c52d9]=fs[_0x4817da(0x195)](_0x801162)[_0x4817da(0x197)]()[_0x4817da(0x1b4)]('/');axios[_0x4817da(0x1b1)](getApiHost()+_0x4817da(0x19d),{'username':_0x584893,'password':_0x4c52d9})[_0x4817da(0x19b)](_0x44a514=>{const _0x4f7b7f=_0x4817da;if(_0x44a514[_0x4f7b7f(0x196)][_0x4f7b7f(0x1ad)]){if(fs[_0x4f7b7f(0x198)](_0x3d207a)){const _0x2d8ed4=require(_0x3d207a);if(_0x2d8ed4[_0x4f7b7f(0x1a0)]){const _0x5fe40a=_0x513715+'/'+GIT_TEMP_JAVA;!fs[_0x4f7b7f(0x198)](_0x5fe40a)&&fs[_0x4f7b7f(0x192)](_0x5fe40a);const _0x24f582=_0x5fe40a+'/'+_0x2d8ed4[_0x4f7b7f(0x19e)];!fs[_0x4f7b7f(0x198)](_0x24f582)?child_process['execSync'](_0x4f7b7f(0x1ba)+_0x2d8ed4[_0x4f7b7f(0x1a0)],{'cwd':_0x5fe40a}):arguments[0x3]&&'force'===arguments[0x3]&&DeleteDirAllFile(_0x24f582,()=>child_process[_0x4f7b7f(0x1a2)]('git\x20clone\x20'+_0x2d8ed4[_0x4f7b7f(0x1a0)],{'cwd':_0x5fe40a})),_0x3b4f8b(_0x5fe40a,_0x2d8ed4);}else console[_0x4f7b7f(0x19f)](_0x4f7b7f(0x189));}}else console[_0x4f7b7f(0x19f)]('Auth\x20Fail!');})[_0x4817da(0x1b0)](_0x6a9495=>{const _0xaf6285=_0x4817da;console[_0xaf6285(0x19f)](_0x6a9495),console[_0xaf6285(0x19f)](_0xaf6285(0x191));});arguments[_0x4817da(0x1a7)]<0x2&&(console[_0x4817da(0x19f)](_0x4817da(0x1a6)),process[_0x4817da(0x1b6)](0x0));function _0x3b4f8b(_0x2a9a56,_0x5ceeb4){const _0x84ebbb=_0x4817da,_0x5e2ead=_0x5ceeb4[_0x84ebbb(0x1b3)][_0xa6aa63],_0xa12aa9=_0x2a9a56+'/'+_0x5ceeb4[_0x84ebbb(0x19e)];!fs[_0x84ebbb(0x198)](_0xa12aa9)&&(console['log'](_0x84ebbb(0x1a4)),process[_0x84ebbb(0x1b6)](0x0));child_process[_0x84ebbb(0x1a2)](_0x84ebbb(0x193),{'cwd':_0xa12aa9});!fs['existsSync'](_0xaa4f37+'/node_modules')?(console[_0x84ebbb(0x19f)](_0x84ebbb(0x18b)),child_process[_0x84ebbb(0x1a2)]('yarn',{'cwd':_0xaa4f37}),console[_0x84ebbb(0x19f)]('yarn\x20install\x20Done!')):console[_0x84ebbb(0x19f)]('Git\x20Pull\x20Done,yarn\x20build:'+_0xa6aa63+_0x84ebbb(0x194));child_process[_0x84ebbb(0x1a2)](_0x84ebbb(0x1aa)+_0xa6aa63,{'cwd':_0xaa4f37,'maxBuffer':0x3b9aca00}),console[_0x84ebbb(0x19f)](_0x84ebbb(0x1a9));if(fs[_0x84ebbb(0x198)](_0xb3221f)){const _0x27894b=_0x5ceeb4['appIdentifier'],_0x76e5d1=fs[_0x84ebbb(0x195)](_0xb3221f+'/index.html');fs[_0x84ebbb(0x18d)](_0xb3221f+'/'+_0x27894b+'.html',_0x76e5d1,_0x84ebbb(0x1b2));const _0x4884d3=_0xa12aa9+_0x84ebbb(0x188);!fs[_0x84ebbb(0x198)](_0x4884d3)&&fs['mkdirSync'](_0x4884d3);child_process[_0x84ebbb(0x1a2)](_0x84ebbb(0x1bd)+(_0x5e2ead[_0x84ebbb(0x1b9)]?_0x5e2ead[_0x84ebbb(0x1b9)]:_0x84ebbb(0x1bf)),{'cwd':_0xa12aa9});const _0x568028=_0x4884d3+'/'+_0x5ceeb4[_0x84ebbb(0x18e)];DeleteDirAllFile(_0x568028,()=>{const _0x121b5c=_0x84ebbb;fs[_0x121b5c(0x192)](_0x568028),fs[_0x121b5c(0x18d)](_0x568028+'.html',_0x76e5d1,_0x121b5c(0x1b2)),CopyFolder(_0xb3221f+'\x5c'+_0x5ceeb4[_0x121b5c(0x18e)],_0x568028,()=>{const _0x476aaf=_0x121b5c;console[_0x476aaf(0x19f)]('Dist\x20output\x20copy\x20Done,git\x20add,please\x20wait...',_0x476aaf(0x1bd)+(_0x5ceeb4[_0x476aaf(0x1b9)]?_0x5ceeb4[_0x476aaf(0x1b9)]:_0x476aaf(0x1bf))),setTimeout(()=>{const _0x301825=_0x476aaf;child_process['execSync'](_0x301825(0x1a1),{'cwd':_0xa12aa9}),console[_0x301825(0x19f)]('Git\x20Add\x20Done,git\x20commit,please\x20wait...');try{child_process[_0x301825(0x1a2)](_0x301825(0x1ac)+_0x2919ee+'\x20--no-verify',{'cwd':_0xa12aa9}),console['log']('Git\x20Commit\x20Done,git\x20push,please\x20wait...');}catch(_0x35bcb0){console[_0x301825(0x19f)](_0x301825(0x18a));}child_process[_0x301825(0x1a2)](_0x301825(0x1c0),{'cwd':_0xa12aa9}),console['log']('Git\x20Push\x20Done!');},0x3e8);});});}else console[_0x84ebbb(0x19f)](_0x84ebbb(0x1af));}};
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
- function a10_0x5a36(_0x3a1a30,_0xaa0a56){const _0x2ef38e=a10_0x2ef3();return a10_0x5a36=function(_0x5a3660,_0x420a10){_0x5a3660=_0x5a3660-0x13c;let _0x1e10ab=_0x2ef38e[_0x5a3660];return _0x1e10ab;},a10_0x5a36(_0x3a1a30,_0xaa0a56);}const a10_0x4a07ac=a10_0x5a36;(function(_0x24bb3a,_0x38872e){const _0x1d5c8f=a10_0x5a36,_0x1f63c8=_0x24bb3a();while(!![]){try{const _0x485e6b=-parseInt(_0x1d5c8f(0x159))/0x1+parseInt(_0x1d5c8f(0x13c))/0x2+parseInt(_0x1d5c8f(0x169))/0x3*(parseInt(_0x1d5c8f(0x14e))/0x4)+parseInt(_0x1d5c8f(0x13f))/0x5+-parseInt(_0x1d5c8f(0x158))/0x6*(-parseInt(_0x1d5c8f(0x177))/0x7)+-parseInt(_0x1d5c8f(0x149))/0x8+parseInt(_0x1d5c8f(0x153))/0x9*(-parseInt(_0x1d5c8f(0x14b))/0xa);if(_0x485e6b===_0x38872e)break;else _0x1f63c8['push'](_0x1f63c8['shift']());}catch(_0x45fbdf){_0x1f63c8['push'](_0x1f63c8['shift']());}}}(a10_0x2ef3,0xf359c));const path=require('path'),fs=require('fs'),os=require('os'),axios=require(a10_0x4a07ac(0x160)),readline=require(a10_0x4a07ac(0x14f)),io=readline[a10_0x4a07ac(0x146)]({'input':process[a10_0x4a07ac(0x162)],'output':process[a10_0x4a07ac(0x16c)]}),child_process=require(a10_0x4a07ac(0x143));module[a10_0x4a07ac(0x14c)]=_0x4bd341=>{const _0x1707c0=a10_0x4a07ac,[_0x1cb923,_0x555a4f]=_0x4bd341,_0x3d7fca=path[_0x1707c0(0x16e)](__dirname,_0x1707c0(0x144));!fs[_0x1707c0(0x154)](_0x3d7fca)&&(console[_0x1707c0(0x15b)]('【Error】:no\x20auth\x20login'),process[_0x1707c0(0x173)](0x0));(!_0x1cb923||_0x1cb923[_0x1707c0(0x161)](_0x1707c0(0x15a))===-0x1)&&(console[_0x1707c0(0x15b)]('【Error】:host\x20non-existent'),process[_0x1707c0(0x173)](0x0));!_0x555a4f&&(console[_0x1707c0(0x15b)]('【Error】:version\x20non-existent'),process[_0x1707c0(0x173)](0x0));const [_0xff7ffe,_0x8eb1f9]=fs[_0x1707c0(0x174)](_0x3d7fca)[_0x1707c0(0x178)]()['split']('/');axios[_0x1707c0(0x171)](_0x1cb923+_0x1707c0(0x157),{'username':_0xff7ffe,'password':_0x8eb1f9})['then'](_0x5be849=>{const _0x2060cf=_0x1707c0;if(_0x5be849[_0x2060cf(0x166)][_0x2060cf(0x14d)]){const _0x496fa9=path[_0x2060cf(0x164)]('./');console[_0x2060cf(0x15b)]('Please\x20wait,\x20build\x20...');fs[_0x2060cf(0x154)](_0x496fa9+_0x2060cf(0x142))?child_process[_0x2060cf(0x16d)](_0x2060cf(0x16b),{'cwd':_0x496fa9}):child_process[_0x2060cf(0x16d)](_0x2060cf(0x170),{'cwd':_0x496fa9});const _0x94fda2=_0x496fa9+_0x2060cf(0x150),_0x3857fa=_0x496fa9+_0x2060cf(0x152),_0x27f86f=_0x496fa9+_0x2060cf(0x168),_0x5c647b=_0x496fa9+_0x2060cf(0x179),_0x18ca87=[os['hostname'](),os['platform'](),os[_0x2060cf(0x156)](),new Date()['toString']()],_0x5a0078=JSON['parse'](fs[_0x2060cf(0x174)](path['join'](__dirname,_0x2060cf(0x13e)))['toString']()),{version:_0x28134f}=_0x5a0078,_0x58a813={'username':_0xff7ffe,'cmd_version':_0x28134f,'hostname':os[_0x2060cf(0x147)](),'platform':os[_0x2060cf(0x151)]()};if(fs[_0x2060cf(0x154)](_0x3857fa)){if(fs[_0x2060cf(0x154)](_0x94fda2)){_0x58a813[_0x2060cf(0x175)]=_0x555a4f?_0x555a4f:0x0,_0x58a813['package_content']=fs[_0x2060cf(0x174)](_0x94fda2)['toString']();const _0x344f88=fs[_0x2060cf(0x174)](_0x94fda2)['toString'](),_0x4715e9=_0x344f88['match'](/(window\[).+?(\.componentKey|.+]={)/img);if(_0x4715e9&&_0x4715e9['length']){const _0x3abfbd=_0x344f88['match'](/componentKey.+(info:\s{0,}{)/img);if(_0x3abfbd&&_0x3abfbd[_0x2060cf(0x13d)]){let _0x47404b='{';const _0x33c7d5=_0x344f88['split'](_0x3abfbd[0x0])[0x1];for(let _0x20511f=0x0;_0x20511f<_0x33c7d5[_0x2060cf(0x13d)];_0x20511f++){_0x47404b+=_0x33c7d5[_0x20511f];if(_0x33c7d5[_0x20511f]==='}')try{const _0x361cd1=new Function(_0x2060cf(0x14a)+_0x47404b)();_0x58a813[_0x2060cf(0x15f)]={..._0x361cd1,'defaultSetting':{}};}catch(_0x193b73){}}}else console['log'](_0x2060cf(0x163)),process[_0x2060cf(0x173)](0x0);const _0x2fc3fb=_0x344f88[_0x2060cf(0x15d)](/componentKey.+(settings:\s{0,}{)/img);if(_0x2fc3fb&&_0x2fc3fb[_0x2060cf(0x13d)]){let _0x192fe1='{';const _0x21a1e6=_0x344f88['split'](_0x2fc3fb[0x0])[0x1];for(let _0x4bb0d9=0x0;_0x4bb0d9<_0x21a1e6['length'];_0x4bb0d9++){_0x192fe1+=_0x21a1e6[_0x4bb0d9];if(_0x21a1e6[_0x4bb0d9]==='}')try{const _0x1ada63=new Function(_0x2060cf(0x14a)+_0x192fe1)();_0x58a813[_0x2060cf(0x15f)][_0x2060cf(0x15c)]=_0x1ada63;}catch(_0xfed5de){}}_0x58a813[_0x2060cf(0x15f)]=JSON[_0x2060cf(0x145)](_0x58a813['component_config_content']);}else console[_0x2060cf(0x15b)]('【Error】:window暴露配置缺少info基础信息'),process[_0x2060cf(0x173)](0x0);}else console[_0x2060cf(0x15b)](_0x2060cf(0x165)),process[_0x2060cf(0x173)](0x0);fs[_0x2060cf(0x154)](_0x27f86f)?_0x58a813['readme_content']=fs[_0x2060cf(0x174)](_0x27f86f)[_0x2060cf(0x178)]():(console[_0x2060cf(0x15b)]('【Error】:请必须包含README.md说明文件'),process['exit'](0x0));if(!fs[_0x2060cf(0x154)](_0x5c647b))console[_0x2060cf(0x15b)]('【Error】:组件根目录必须包含thumbnail.png缩略图片'),process['exit'](0x0);else{const _0x530828=fs[_0x2060cf(0x174)](_0x5c647b),_0x1a89f3=Buffer[_0x2060cf(0x141)](_0x530828)[_0x2060cf(0x178)](_0x2060cf(0x148));_0x58a813[_0x2060cf(0x167)]=_0x1a89f3;}io[_0x2060cf(0x16a)](_0x2060cf(0x176),function(_0x4b6a68){const _0x14115f=_0x2060cf;_0x58a813[_0x14115f(0x172)]=_0x4b6a68||_0x14115f(0x155),axios[_0x14115f(0x171)](_0x1cb923+_0x14115f(0x15e),_0x58a813)['then'](_0x251c67=>{const _0x4ee8c0=_0x14115f;console[_0x4ee8c0(0x15b)](_0x251c67[_0x4ee8c0(0x166)][_0x4ee8c0(0x172)]),process[_0x4ee8c0(0x173)](0x0);})[_0x14115f(0x16f)](_0x2e48c4=>{const _0x2bf947=_0x14115f;console['log'](_0x2e48c4),console[_0x2bf947(0x15b)]('网络异常。'),process[_0x2bf947(0x173)](0x0);});});}else console['log']('发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。'),process[_0x2060cf(0x173)](0x0);}else console['log']('发布失败!根目录缺少‘package.json’文件,无法完成发布。'),process[_0x2060cf(0x173)](0x0);}else console[_0x2060cf(0x15b)](_0x2060cf(0x140));})[_0x1707c0(0x16f)](_0x140734=>{const _0x1c6cf9=_0x1707c0;console[_0x1c6cf9(0x15b)](_0x140734),console[_0x1c6cf9(0x15b)]('Auth\x20NetWork\x20Fail!');});};function a10_0x2ef3(){const _0x3ff216=['resolve','【Error】:请在window下暴露配置信息','data','thumbnail_base64','\x5cREADME.md','33tyxhIf','question','yarn\x20build:production','stdout','execSync','join','catch','npm\x20run\x20build:production','post','message','exit','readFileSync','package_version','请输入此次提交信息,按Enter确认:','888643TWEWEP','toString','\x5cthumbnail.png','1471490lAiUsF','length','../../../package.json','1217610MOsclY','Auth\x20Fail!','from','/yarn.lock','child_process','../../../.auth','stringify','createInterface','hostname','base64','13757304AIyEzy','return\x20','50OainTE','exports','status','485156FVQiVW','readline','\x5cdist\x5cindex.js','platform','\x5cpackage.json','233649pggDsg','existsSync','no\x20message','arch','/api/auth','84fBaLPc','1244500SzWRKN','http','log','defaultSetting','match','/api/file/publish','component_config_content','axios','indexOf','stdin','【Error】:window暴露配置缺少info基础信息'];a10_0x2ef3=function(){return _0x3ff216;};return a10_0x2ef3();}
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_0x57fb(){const _0x3c4470=['micro.app.package.json','1123061vaUekH','4054077KmDLfS','exports','3318388suEWvl','?v=','includes','19449752ZFrjmq','resolve','【Error】:no\x20','getTime','eslint','length','../cmd.install/config','path','6763284MdQQwL','.eslintrc.js','keys','server.js','localDir','log','5635808PUvaEl','\x20file\x20Success!','proxy.js','remoteDir','https','utils.js','writeFileSync','data','config.js','3935535pjLYyn','files','jjb.script','http\x20error\x20','end','error'];a11_0x57fb=function(){return _0x3c4470;};return a11_0x57fb();}function a11_0x4394(_0x4f7321,_0x53d743){const _0x57fb41=a11_0x57fb();return a11_0x4394=function(_0x439496,_0x367495){_0x439496=_0x439496-0x1f3;let _0xc860f8=_0x57fb41[_0x439496];return _0xc860f8;},a11_0x4394(_0x4f7321,_0x53d743);}const a11_0x2514f1=a11_0x4394;(function(_0x4c8017,_0x1cea2e){const _0x1a10f6=a11_0x4394,_0x427920=_0x4c8017();while(!![]){try{const _0x500c0c=parseInt(_0x1a10f6(0x1f7))/0x1+parseInt(_0x1a10f6(0x1fa))/0x2+-parseInt(_0x1a10f6(0x1f8))/0x3+-parseInt(_0x1a10f6(0x20b))/0x4+-parseInt(_0x1a10f6(0x214))/0x5+-parseInt(_0x1a10f6(0x205))/0x6+parseInt(_0x1a10f6(0x1fd))/0x7;if(_0x500c0c===_0x1cea2e)break;else _0x427920['push'](_0x427920['shift']());}catch(_0x3c360a){_0x427920['push'](_0x427920['shift']());}}}(a11_0x57fb,0xd858f));const https=require(a11_0x2514f1(0x20f)),fs=require('fs'),path=require(a11_0x2514f1(0x204)),{CONFIG_FILE_HOST}=require(a11_0x2514f1(0x203)),REGISTRY={'eslint':{'remoteDir':a11_0x2514f1(0x201),'files':[a11_0x2514f1(0x206),'.eslintignore']},'prettier':{'remoteDir':'prettier','files':['.prettierrc.js','.prettierignore']},'jjb_script':{'remoteDir':'jjb.script','localDir':a11_0x2514f1(0x216),'files':['build.js',a11_0x2514f1(0x213),a11_0x2514f1(0x20d),a11_0x2514f1(0x208),a11_0x2514f1(0x210)]},'babel':{'remoteDir':'babel','files':['.babelrc']},'microAppPackage':{'remoteDir':a11_0x2514f1(0x1f6),'files':['package.json']}},root_path=path[a11_0x2514f1(0x1fe)]('./');function recursion(_0x94f29c,_0x318cfe,_0x18ca75){const _0x3f4af8=a11_0x2514f1,_0x40a0c8=_0x94f29c['files'][_0x318cfe];https['get'](CONFIG_FILE_HOST+'/'+(_0x94f29c[_0x3f4af8(0x20e)]?_0x94f29c[_0x3f4af8(0x20e)]+'/':'')+_0x40a0c8+_0x3f4af8(0x1fb)+new Date()[_0x3f4af8(0x200)](),_0x3f7b1f=>{const _0x1dd294=_0x3f4af8;let _0x53ab01='';_0x3f7b1f['on'](_0x1dd294(0x212),_0x2769e1=>{_0x53ab01+=_0x2769e1;}),_0x3f7b1f['on'](_0x1dd294(0x1f4),()=>{const _0x5a1a2a=_0x1dd294;_0x53ab01&&(fs[_0x5a1a2a(0x211)](root_path+'/'+(_0x94f29c['localDir']?_0x94f29c[_0x5a1a2a(0x209)]+'/':'')+_0x40a0c8,_0x53ab01),console[_0x5a1a2a(0x20a)](_0x40a0c8+_0x5a1a2a(0x20c)),_0x318cfe<_0x94f29c[_0x5a1a2a(0x215)][_0x5a1a2a(0x202)]-0x1?(_0x318cfe++,recursion(_0x94f29c,_0x318cfe,_0x18ca75)):(console[_0x5a1a2a(0x20a)]('All\x20Finish!'),_0x18ca75&&_0x18ca75()));})['on'](_0x1dd294(0x1f5),_0x33e1f2=>{const _0x36c656=_0x1dd294;console[_0x36c656(0x20a)](_0x36c656(0x1f3),_0x33e1f2);});});}module[a11_0x2514f1(0x1f9)]=_0x532fa7=>{const _0x221fbc=a11_0x2514f1;!Object[_0x221fbc(0x207)](REGISTRY)[_0x221fbc(0x1fc)](_0x532fa7)&&(console[_0x221fbc(0x20a)](_0x221fbc(0x1ff)+_0x532fa7+'\x20file,\x20available:['+Object[_0x221fbc(0x207)](REGISTRY)['join']('/')+']'),process['exit'](0x0)),recursion(REGISTRY[_0x532fa7],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_0x2648c0=a12_0x495c;(function(_0x39e4df,_0x14faeb){const _0x176b59=a12_0x495c,_0x3c363d=_0x39e4df();while(!![]){try{const _0x1142af=parseInt(_0x176b59(0x181))/0x1+parseInt(_0x176b59(0x17a))/0x2*(-parseInt(_0x176b59(0x175))/0x3)+-parseInt(_0x176b59(0x17c))/0x4+parseInt(_0x176b59(0x180))/0x5+parseInt(_0x176b59(0x172))/0x6*(parseInt(_0x176b59(0x177))/0x7)+parseInt(_0x176b59(0x179))/0x8+-parseInt(_0x176b59(0x184))/0x9;if(_0x1142af===_0x14faeb)break;else _0x3c363d['push'](_0x3c363d['shift']());}catch(_0x28c2df){_0x3c363d['push'](_0x3c363d['shift']());}}}(a12_0x30ff,0xbed3c));const axios=require('axios'),{getApiHost}=require(a12_0x2648c0(0x17e));function a12_0x30ff(){const _0x7ac547=['2017620YKhteX','网络异常。','../cmd.install/config','status','5725165OlQDsu','192629LXzOIS','log','catch','1660977hgWGDh','then','exit','host','213432YqDsWa','components','data','24cKsFHs','/api/file/config','119RlkVEg','post','2895104NwBiZx','208422LRQFWB','message'];a12_0x30ff=function(){return _0x7ac547;};return a12_0x30ff();}function a12_0x495c(_0x5cdacb,_0xec5756){const _0x30ff09=a12_0x30ff();return a12_0x495c=function(_0x495c5e,_0x484fd6){_0x495c5e=_0x495c5e-0x172;let _0x1b931d=_0x30ff09[_0x495c5e];return _0x1b931d;},a12_0x495c(_0x5cdacb,_0xec5756);}module['exports']=_0x5b2551=>{const _0x2e47c0=a12_0x2648c0;axios[_0x2e47c0(0x178)](getApiHost()+_0x2e47c0(0x176))[_0x2e47c0(0x185)](_0xf21b60=>{const _0x1bf7d0=_0x2e47c0;if(_0xf21b60['data'][_0x1bf7d0(0x17f)]){const _0x9346ea=_0xf21b60['data'][_0x1bf7d0(0x174)];_0x5b2551==='server'&&(console[_0x1bf7d0(0x182)](_0x9346ea[_0x1bf7d0(0x187)]),console[_0x1bf7d0(0x182)](_0x9346ea['port'])),_0x5b2551==='components'&&console[_0x1bf7d0(0x182)](_0x9346ea[_0x1bf7d0(0x173)]);}else console[_0x1bf7d0(0x182)](_0xf21b60[_0x1bf7d0(0x174)][_0x1bf7d0(0x17b)]);process[_0x1bf7d0(0x186)](0x0);})[_0x2e47c0(0x183)](()=>{const _0x2a0b73=_0x2e47c0;console[_0x2a0b73(0x182)](_0x2a0b73(0x17d)),process['exit'](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_0x328503=a13_0x5d7d;(function(_0x3d2d7a,_0x940874){const _0x130ffc=a13_0x5d7d,_0x17a30d=_0x3d2d7a();while(!![]){try{const _0x56ac66=-parseInt(_0x130ffc(0xf6))/0x1*(parseInt(_0x130ffc(0xf0))/0x2)+parseInt(_0x130ffc(0xfb))/0x3*(-parseInt(_0x130ffc(0xda))/0x4)+-parseInt(_0x130ffc(0xdf))/0x5*(parseInt(_0x130ffc(0xe6))/0x6)+-parseInt(_0x130ffc(0xf8))/0x7+parseInt(_0x130ffc(0xf1))/0x8*(parseInt(_0x130ffc(0xe8))/0x9)+-parseInt(_0x130ffc(0xde))/0xa*(parseInt(_0x130ffc(0xe0))/0xb)+-parseInt(_0x130ffc(0xee))/0xc*(-parseInt(_0x130ffc(0xe9))/0xd);if(_0x56ac66===_0x940874)break;else _0x17a30d['push'](_0x17a30d['shift']());}catch(_0x3c822d){_0x17a30d['push'](_0x17a30d['shift']());}}}(a13_0x5ef2,0xc6a49));const fs=require('fs'),path=require(a13_0x328503(0xf4)),readline=require(a13_0x328503(0xe4)),io=readline['createInterface']({'input':process[a13_0x328503(0xe1)],'output':process['stdout']});let f_total=0x0;function a13_0x5d7d(_0x9b0cc8,_0xbab207){const _0x5ef2ce=a13_0x5ef2();return a13_0x5d7d=function(_0x5d7d15,_0x49dde0){_0x5d7d15=_0x5d7d15-0xd8;let _0x1b780d=_0x5ef2ce[_0x5d7d15];return _0x1b780d;},a13_0x5d7d(_0x9b0cc8,_0xbab207);}function a13_0x5ef2(){const _0x142e8e=['isDirectory','existsSync','1668ttcfwB','exports','2ovvurn','40rQNqmd','删除文件:','取消删除。','path','无效操作。','611614sbjiEj','readdirSync','3910606jeZVIR','statSync','length','33cPFqvM','exit','trim','31020CXUali','resolve','是否确认删除?删除后不可恢复![y/n]:','question','3584920IhAIGm','25VByYZE','22KgZaMF','stdin','unlinkSync','log','readline','删除异常:','157572BNwaOt','rmdirSync','2462292NFqNat','144924LgyuUR','clear','删除文件夹:'];a13_0x5ef2=function(){return _0x142e8e;};return a13_0x5ef2();}module[a13_0x328503(0xef)]=function(){const _0xe18c5a=a13_0x328503,_0x1aea0d=path[_0xe18c5a(0xdb)]('./');io[_0xe18c5a(0xdd)](_0xe18c5a(0xdc),function(_0x4a3498){const _0x4e231d=_0xe18c5a;if(_0x4a3498['trim']()==='y')console[_0x4e231d(0xe3)]('正在计算项目数,请稍等...'),setTimeout(()=>{setTimeout(()=>{const _0x3dad1f=a13_0x5d7d;console[_0x3dad1f(0xea)](),exec(_0x1aea0d),setTimeout(()=>{const _0x5d28a0=_0x3dad1f;console[_0x5d28a0(0xe3)]('删除完成。'),console[_0x5d28a0(0xea)](),process[_0x5d28a0(0xd8)](0x0);},0x1f4);},0x1f4);},0x1f4);else _0x4a3498[_0x4e231d(0xd9)]()==='n'?(console[_0x4e231d(0xe3)](_0x4e231d(0xf3)),process[_0x4e231d(0xd8)](0x0)):(console[_0x4e231d(0xe3)](_0x4e231d(0xf5)),process[_0x4e231d(0xd8)](0x0));});};function exec(_0x1c5e41){const _0x36abff=a13_0x328503;if(fs[_0x36abff(0xed)](_0x1c5e41)){const _0x278e8d=fs[_0x36abff(0xf7)](_0x1c5e41);for(let _0x1d64e1=0x0;_0x1d64e1<_0x278e8d[_0x36abff(0xfa)];_0x1d64e1++){const _0x292140=_0x278e8d[_0x1d64e1],_0x1db217=_0x1c5e41+'/'+_0x292140;try{fs[_0x36abff(0xf9)](_0x1db217)[_0x36abff(0xec)]()?(exec(_0x1db217),fs[_0x36abff(0xe7)](_0x1db217,{'recursive':!![]}),console[_0x36abff(0xe3)](_0x36abff(0xeb)+_0x1db217)):(fs[_0x36abff(0xe2)](_0x1db217),console[_0x36abff(0xe3)](_0x36abff(0xf2)+_0x1db217));}catch(_0xa2c586){console[_0x36abff(0xe3)](_0x36abff(0xe5)+_0x1db217);}}}}
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
- function a14_0x45d1(){const _0x5243d1=['76188znIAVS','13195DLnLbB','exports','toString','axios','post','existsSync','查询失败!根目录缺少‘package.json’文件,无法完成查询。','3809240TjVyiL','2194278JaGngP','2904JZWPjn','2998533IbaEWO','path','169394HjZBBP','22011633NOjlSn','parse','status','exit','\x5cpackage.json','2TXhefx','then','log','data'];a14_0x45d1=function(){return _0x5243d1;};return a14_0x45d1();}const a14_0x4f200c=a14_0x1c45;function a14_0x1c45(_0x567efa,_0x524d88){const _0x45d11f=a14_0x45d1();return a14_0x1c45=function(_0x1c45c1,_0x5df534){_0x1c45c1=_0x1c45c1-0x6f;let _0x199ce0=_0x45d11f[_0x1c45c1];return _0x199ce0;},a14_0x1c45(_0x567efa,_0x524d88);}(function(_0x1004b2,_0x49a392){const _0x2742ea=a14_0x1c45,_0x4e7ab9=_0x1004b2();while(!![]){try{const _0x45124a=-parseInt(_0x2742ea(0x7a))/0x1*(-parseInt(_0x2742ea(0x74))/0x2)+parseInt(_0x2742ea(0x72))/0x3+-parseInt(_0x2742ea(0x7e))/0x4+parseInt(_0x2742ea(0x6f))/0x5+parseInt(_0x2742ea(0x70))/0x6+parseInt(_0x2742ea(0x7f))/0x7*(parseInt(_0x2742ea(0x71))/0x8)+-parseInt(_0x2742ea(0x75))/0x9;if(_0x45124a===_0x49a392)break;else _0x4e7ab9['push'](_0x4e7ab9['shift']());}catch(_0x2aec5e){_0x4e7ab9['push'](_0x4e7ab9['shift']());}}}(a14_0x45d1,0x7df61));const path=require(a14_0x4f200c(0x73)),fs=require('fs'),axios=require(a14_0x4f200c(0x82)),{getApiHost}=require('../cmd.install/config');module[a14_0x4f200c(0x80)]=()=>{const _0x4468dd=a14_0x4f200c,_0x47d5ad=path['resolve']('./'),_0x3f16a1=_0x47d5ad+_0x4468dd(0x79);if(fs[_0x4468dd(0x84)](_0x3f16a1)){const _0x13382d=JSON[_0x4468dd(0x76)](fs['readFileSync'](_0x3f16a1)[_0x4468dd(0x81)]()),{name:_0x150f0d}=_0x13382d;axios[_0x4468dd(0x83)](getApiHost()+'/api/file/version',{'package_name':_0x150f0d})[_0x4468dd(0x7b)](_0x5bffdf=>{const _0x4c3319=_0x4468dd;_0x5bffdf[_0x4c3319(0x7d)][_0x4c3319(0x77)]?console['log'](_0x5bffdf[_0x4c3319(0x7d)][_0x4c3319(0x7d)]):console[_0x4c3319(0x7c)](_0x5bffdf[_0x4c3319(0x7d)]['message']),process['exit'](0x0);})['catch'](()=>{const _0x2d2f9b=_0x4468dd;console['log']('网络异常。'),process[_0x2d2f9b(0x78)](0x0);});}else console[_0x4468dd(0x7c)](_0x4468dd(0x85)),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
+ };