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.
- package/README.md +8 -0
- package/package.json +1 -1
- package/src/new/cmd.auth/index.js +1 -26
- package/src/new/cmd.init/index.js +1 -116
- package/src/new/cmd.install/config.js +1 -70
- package/src/new/cmd.install/index.js +1 -262
- package/src/new/cmd.install/tools.js +1 -230
- package/src/new/cmd.install.app/index.js +1 -27
- package/src/new/cmd.jenkins/index.js +1 -72
- package/src/new/cmd.publish/index.js +1 -197
- package/src/new/cmd.push/index.js +1 -76
- package/src/new/cmd.push/java.js +1 -148
- package/src/new/cmd.push-set/index.js +1 -205
- package/src/new/cmd.refresh/index.js +1 -65
- package/src/new/cmd.reglist/index.js +1 -23
- package/src/new/cmd.rm-rf/index.js +1 -58
- package/src/new/cmd.version/index.js +1 -35
- package/src/old/cli.init.js +1 -26
- package/src/old/cli.install/config.js +1 -206
- package/src/old/cli.install/index.js +1 -340
- package/src/old/cli.install/tools.js +1 -230
- package/src/old/cli.merge.js +1 -80
- package/src/old/cli.pull.js +1 -94
- package/src/old/cli.pull2.js +1 -377
- package/src/old/cli.rm-rf.js +1 -88
- package/src/old/progress-bar.js +1 -23
- package/src/old/util.js +1 -149
- package/build.js +0 -15
- package/obf.config.json +0 -3
- package/src/old/cli.dva.register.saas.txt +0 -40
- package/src/old/cli.dva.register.spa.txt +0 -22
- package/src/old/cli.dva.router.saas.txt +0 -210
- package/src/old/cli.dva.router.spa.txt +0 -119
package/src/new/cmd.push/java.js
CHANGED
@@ -1,148 +1 @@
|
|
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
|
+
function a9_0x5459(){const _0x56621b=['javaGit','../../../.auth','【Error】:打包失败,没有dist目录!','../../old/util','3033460vyHgib','javaGitName','../cmd.install/config','/index.html','git\x20clone\x20','mkdirSync','join','split','javaGitBranch','force','【warning】:Git\x20Pull\x20Done,yarn\x20install\x20project,please\x20wait...','613654JPuXUZ','yarn\x20install\x20Done!','exit','Auth\x20Fail!','includes','Git\x20Push\x20Done!','utf-8','\x20--no-verify','3724422LhthNT','status','master','path','Git\x20Pull\x20Done,yarn\x20build:','length','log','resolve','.html','writeFileSync','existsSync','/start/src/main/resources/templates','git\x20commit\x20-m\x20','git\x20add\x20.','【Error】:参数传递错误','Dist\x20output\x20copy\x20Done,git\x20add,please\x20wait...','61100waureB','\x5cjjb.config.js','appIdentifier','Auth\x20NetWork\x20Fail!','tmpdir','Project\x20build\x20Done,copy\x20project,please\x20wait...','toString','execSync','environment','2TjTamH','4371417JrOXaO','git\x20checkout\x20','4422400nlSrfK','child_process','axios','catch','60ZYRWwC','post','then','Git\x20Commit\x20Done,git\x20push,please\x20wait...','4470186ghyqmW','readFileSync','index','git\x20push\x20--force','【Error】:no\x20setting\x20javaGitName'];a9_0x5459=function(){return _0x56621b;};return a9_0x5459();}const a9_0x155c00=a9_0x7ed4;function a9_0x7ed4(_0x36aeb8,_0x32451a){const _0x545904=a9_0x5459();return a9_0x7ed4=function(_0x7ed444,_0x4731ee){_0x7ed444=_0x7ed444-0x1da;let _0x5a22aa=_0x545904[_0x7ed444];return _0x5a22aa;},a9_0x7ed4(_0x36aeb8,_0x32451a);}(function(_0x439616,_0x406a06){const _0x4cf49d=a9_0x7ed4,_0x544257=_0x439616();while(!![]){try{const _0x62a995=parseInt(_0x4cf49d(0x20a))/0x1*(-parseInt(_0x4cf49d(0x1eb))/0x2)+parseInt(_0x4cf49d(0x212))/0x3+parseInt(_0x4cf49d(0x1ff))/0x4+parseInt(_0x4cf49d(0x1e2))/0x5*(-parseInt(_0x4cf49d(0x1f2))/0x6)+-parseInt(_0x4cf49d(0x1f6))/0x7+parseInt(_0x4cf49d(0x1ee))/0x8+-parseInt(_0x4cf49d(0x1ec))/0x9;if(_0x62a995===_0x406a06)break;else _0x544257['push'](_0x544257['shift']());}catch(_0x52bf60){_0x544257['push'](_0x544257['shift']());}}}(a9_0x5459,0xa90fa));const fs=require('fs'),os=require('os'),path=require(a9_0x155c00(0x215)),child_process=require(a9_0x155c00(0x1ef)),{CopyFolder,DeleteDirAllFile}=require(a9_0x155c00(0x1fe)),{GIT_TEMP_JAVA,GIT_JAVA_ENV_JSON,getApiHost}=require(a9_0x155c00(0x201)),axios=require(a9_0x155c00(0x1f0));module['exports']=arguments=>{const _0x251b51=a9_0x155c00,_0x5764dc=path[_0x251b51(0x205)](__dirname,_0x251b51(0x1fc));!fs[_0x251b51(0x1dc)](_0x5764dc)&&(console[_0x251b51(0x218)]('【Error】:no\x20auth\x20login'),process[_0x251b51(0x20c)](0x0));const _0x1fef0f=arguments[0x1],_0x30ba13=arguments[0x2]||'\x22no\x20message\x22',_0x21c112=arguments[0x3]?arguments[0x3][_0x251b51(0x206)](','):[],_0x4555c4=path[_0x251b51(0x219)]('./'),_0x3728a9=_0x4555c4+_0x251b51(0x1e3),_0x41812c=_0x4555c4+'\x5cdist',_0x2f19bb=os[_0x251b51(0x1e6)](),[_0xe4351c,_0x59d287]=fs[_0x251b51(0x1f7)](_0x5764dc)[_0x251b51(0x1e8)]()['split']('/');axios[_0x251b51(0x1f3)](getApiHost()+'/api/auth',{'username':_0xe4351c,'password':_0x59d287})[_0x251b51(0x1f4)](_0x253ce0=>{const _0x482f4e=_0x251b51;if(_0x253ce0['data'][_0x482f4e(0x213)]){if(fs[_0x482f4e(0x1dc)](_0x3728a9)){const _0x450374=require(_0x3728a9);if(_0x450374[_0x482f4e(0x1fb)]){const _0x2629b4=_0x2f19bb+'/'+GIT_TEMP_JAVA;!fs[_0x482f4e(0x1dc)](_0x2629b4)&&fs[_0x482f4e(0x204)](_0x2629b4);const _0x26daa5=_0x2629b4+'/'+_0x450374[_0x482f4e(0x200)];!fs[_0x482f4e(0x1dc)](_0x26daa5)?child_process['execSync']('git\x20clone\x20'+_0x450374[_0x482f4e(0x1fb)],{'cwd':_0x2629b4}):_0x21c112['includes'](_0x482f4e(0x208))?DeleteDirAllFile(_0x26daa5,()=>child_process[_0x482f4e(0x1e9)](_0x482f4e(0x203)+_0x450374[_0x482f4e(0x1fb)],{'cwd':_0x2629b4})):child_process['execSync']('git\x20clone\x20'+_0x450374[_0x482f4e(0x1fb)],{'cwd':_0x2629b4}),_0x102895(_0x2629b4,_0x450374);}else console[_0x482f4e(0x218)]('【Error】:no\x20setting\x20git');}}else console['log'](_0x482f4e(0x20d));})[_0x251b51(0x1f1)](_0x31ed72=>{const _0x2a05ff=_0x251b51;console[_0x2a05ff(0x218)](_0x31ed72),console['log'](_0x2a05ff(0x1e5));});arguments[_0x251b51(0x217)]<0x2&&(console[_0x251b51(0x218)](_0x251b51(0x1e0)),process[_0x251b51(0x20c)](0x0));function _0x102895(_0x540bb7,_0x1a0360){const _0x131a0c=_0x251b51,_0x2e6e31=_0x1a0360[_0x131a0c(0x1ea)][_0x1fef0f],_0x5d5c4b=_0x540bb7+'/'+_0x1a0360['javaGitName'];!fs[_0x131a0c(0x1dc)](_0x5d5c4b)&&(console[_0x131a0c(0x218)](_0x131a0c(0x1fa)),process[_0x131a0c(0x20c)](0x0));child_process[_0x131a0c(0x1e9)]('git\x20pull',{'cwd':_0x5d5c4b});!fs['existsSync'](_0x4555c4+'/node_modules')?(console[_0x131a0c(0x218)](_0x131a0c(0x209)),child_process[_0x131a0c(0x1e9)]('yarn',{'cwd':_0x4555c4}),console['log'](_0x131a0c(0x20b))):console['log'](_0x131a0c(0x216)+_0x1fef0f+',please\x20wait...');child_process[_0x131a0c(0x1e9)]('yarn\x20build:'+_0x1fef0f,{'cwd':_0x4555c4,'maxBuffer':0x3b9aca00}),console[_0x131a0c(0x218)](_0x131a0c(0x1e7));if(fs[_0x131a0c(0x1dc)](_0x41812c)){const _0x3754c4=_0x1a0360['appIdentifier'],_0x56a089=fs['readFileSync'](_0x41812c+'/index.html');fs[_0x131a0c(0x1db)](_0x41812c+'/'+_0x3754c4+_0x131a0c(0x1da),_0x56a089,'utf-8');_0x21c112[_0x131a0c(0x20e)](_0x131a0c(0x1f8))&&fs[_0x131a0c(0x1db)](_0x41812c+_0x131a0c(0x202),_0x56a089,'utf-8');const _0x59fcc6=_0x5d5c4b+_0x131a0c(0x1dd);!fs[_0x131a0c(0x1dc)](_0x59fcc6)&&fs[_0x131a0c(0x204)](_0x59fcc6);child_process[_0x131a0c(0x1e9)](_0x131a0c(0x1ed)+(_0x2e6e31[_0x131a0c(0x207)]?_0x2e6e31[_0x131a0c(0x207)]:_0x131a0c(0x214)),{'cwd':_0x5d5c4b});const _0x4f9669=_0x59fcc6+'/'+_0x1a0360[_0x131a0c(0x1e4)];DeleteDirAllFile(_0x4f9669,()=>{const _0x5c03ba=_0x131a0c;fs[_0x5c03ba(0x204)](_0x4f9669),fs[_0x5c03ba(0x1db)](_0x4f9669+_0x5c03ba(0x1da),_0x56a089,_0x5c03ba(0x210)),CopyFolder(_0x41812c+'\x5c'+_0x1a0360['appIdentifier'],_0x4f9669,()=>{const _0x2e287b=_0x5c03ba;console[_0x2e287b(0x218)](_0x2e287b(0x1e1),'git\x20checkout\x20'+(_0x1a0360['javaGitBranch']?_0x1a0360['javaGitBranch']:_0x2e287b(0x214))),setTimeout(()=>{const _0x1b7443=_0x2e287b;child_process[_0x1b7443(0x1e9)](_0x1b7443(0x1df),{'cwd':_0x5d5c4b}),console[_0x1b7443(0x218)]('Git\x20Add\x20Done,git\x20commit,please\x20wait...');try{child_process['execSync'](_0x1b7443(0x1de)+_0x30ba13+_0x1b7443(0x211),{'cwd':_0x5d5c4b}),console['log'](_0x1b7443(0x1f5));}catch(_0x449dbb){console[_0x1b7443(0x218)]('【warning】:no\x20commit,git\x20push,please\x20wait...');}child_process[_0x1b7443(0x1e9)](_0x1b7443(0x1f9),{'cwd':_0x5d5c4b}),console[_0x1b7443(0x218)](_0x1b7443(0x20f));},0x3e8);});});}else console[_0x131a0c(0x218)](_0x131a0c(0x1fd));}};
|
@@ -1,205 +1 @@
|
|
1
|
-
const
|
2
|
-
const fs = require('fs');
|
3
|
-
const os = require('os');
|
4
|
-
const axios = require('axios');
|
5
|
-
const readline = require('readline');
|
6
|
-
const io = readline.createInterface({
|
7
|
-
input: process.stdin,
|
8
|
-
output: process.stdout
|
9
|
-
});
|
10
|
-
const child_process = require('child_process');
|
11
|
-
|
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
|
+
function a10_0x7d9a(){const _0x11e09d=['resolve','1926240pBeGbe','33gvRCxi','readFileSync','【Error】:no\x20auth\x20login','yarn\x20build:production','indexOf','toString','npm\x20run\x20build:production','Auth\x20Fail!','data','2050872lhvZtG','stdout','【Error】:请必须包含README.md说明文件','9AJwNgo','网络异常。','defaultSetting','message','no\x20message','length','from','\x5cthumbnail.png','readme_content','axios','91sDwrtB','package_content','/yarn.lock','http','248504dPTGqx','match','exit','package_version','【Error】:window暴露配置缺少info基础信息','post','Please\x20wait,\x20build\x20...','546045PwmUoX','thumbnail_base64','createInterface','split','6AKnmfc','component_config_content','join','exports','existsSync','parse','发布失败!根目录缺少‘package.json’文件,无法完成发布。','execSync','stringify','log','hostname','readline','请输入此次提交信息,按Enter确认:','/api/auth','/api/file/publish','\x5cpackage.json','238608CEEIAJ','4623864SRmomD','1290230fhKXqE','question','platform','发布失败!根目录缺少‘dist/index.js’文件,无法完成发布。','\x5cdist\x5cindex.js','base64','then','../../../package.json','child_process'];a10_0x7d9a=function(){return _0x11e09d;};return a10_0x7d9a();}function a10_0x53ee(_0x10271b,_0x3cdf04){const _0x7d9a57=a10_0x7d9a();return a10_0x53ee=function(_0x53ee32,_0x52d9d1){_0x53ee32=_0x53ee32-0x1d5;let _0x463125=_0x7d9a57[_0x53ee32];return _0x463125;},a10_0x53ee(_0x10271b,_0x3cdf04);}const a10_0x112b3e=a10_0x53ee;(function(_0x587ba2,_0x307305){const _0x1cd609=a10_0x53ee,_0x504adf=_0x587ba2();while(!![]){try{const _0x38cc29=-parseInt(_0x1cd609(0x1ea))/0x1+parseInt(_0x1cd609(0x1f5))/0x2*(-parseInt(_0x1cd609(0x1f1))/0x3)+parseInt(_0x1cd609(0x206))/0x4+-parseInt(_0x1cd609(0x211))/0x5+-parseInt(_0x1cd609(0x205))/0x6*(-parseInt(_0x1cd609(0x1e6))/0x7)+parseInt(_0x1cd609(0x1d9))/0x8*(-parseInt(_0x1cd609(0x1dc))/0x9)+-parseInt(_0x1cd609(0x207))/0xa*(-parseInt(_0x1cd609(0x212))/0xb);if(_0x38cc29===_0x307305)break;else _0x504adf['push'](_0x504adf['shift']());}catch(_0x498d38){_0x504adf['push'](_0x504adf['shift']());}}}(a10_0x7d9a,0x984f7));const path=require('path'),fs=require('fs'),os=require('os'),axios=require(a10_0x112b3e(0x1e5)),readline=require(a10_0x112b3e(0x200)),io=readline[a10_0x112b3e(0x1f3)]({'input':process['stdin'],'output':process[a10_0x112b3e(0x1da)]}),child_process=require(a10_0x112b3e(0x20f));module[a10_0x112b3e(0x1f8)]=_0x4bbe03=>{const _0x30d0db=a10_0x112b3e,[_0x2c55ec,_0x3beb18]=_0x4bbe03,_0x4394b2=path[_0x30d0db(0x1f7)](__dirname,'../../../.auth');!fs['existsSync'](_0x4394b2)&&(console['log'](_0x30d0db(0x214)),process[_0x30d0db(0x1ec)](0x0));(!_0x2c55ec||_0x2c55ec[_0x30d0db(0x216)](_0x30d0db(0x1e9))===-0x1)&&(console[_0x30d0db(0x1fe)]('【Error】:host\x20non-existent'),process[_0x30d0db(0x1ec)](0x0));!_0x3beb18&&(console[_0x30d0db(0x1fe)]('【Error】:version\x20non-existent'),process[_0x30d0db(0x1ec)](0x0));const [_0x128218,_0x4bfec4]=fs[_0x30d0db(0x213)](_0x4394b2)[_0x30d0db(0x1d5)]()['split']('/');axios[_0x30d0db(0x1ef)](_0x2c55ec+_0x30d0db(0x202),{'username':_0x128218,'password':_0x4bfec4})[_0x30d0db(0x20d)](_0x2b215d=>{const _0x197672=_0x30d0db;if(_0x2b215d[_0x197672(0x1d8)]['status']){const _0x3c3a8f=path[_0x197672(0x210)]('./');console['log'](_0x197672(0x1f0));fs[_0x197672(0x1f9)](_0x3c3a8f+_0x197672(0x1e8))?child_process['execSync'](_0x197672(0x215),{'cwd':_0x3c3a8f}):child_process[_0x197672(0x1fc)](_0x197672(0x1d6),{'cwd':_0x3c3a8f});const _0x4fc717=_0x3c3a8f+_0x197672(0x20b),_0x2da361=_0x3c3a8f+_0x197672(0x204),_0x48b25a=_0x3c3a8f+'\x5cREADME.md',_0x8bbee3=_0x3c3a8f+_0x197672(0x1e3),_0x2add37=[os[_0x197672(0x1ff)](),os[_0x197672(0x209)](),os['arch'](),new Date()[_0x197672(0x1d5)]()],_0x13c00c=JSON[_0x197672(0x1fa)](fs[_0x197672(0x213)](path[_0x197672(0x1f7)](__dirname,_0x197672(0x20e)))[_0x197672(0x1d5)]()),{version:_0x59c6f6}=_0x13c00c,_0x2d4b27={'username':_0x128218,'cmd_version':_0x59c6f6,'hostname':os[_0x197672(0x1ff)](),'platform':os[_0x197672(0x209)]()};if(fs['existsSync'](_0x2da361)){if(fs['existsSync'](_0x4fc717)){_0x2d4b27[_0x197672(0x1ed)]=_0x3beb18?_0x3beb18:0x0,_0x2d4b27[_0x197672(0x1e7)]=fs[_0x197672(0x213)](_0x4fc717)[_0x197672(0x1d5)]();const _0xb53238=fs[_0x197672(0x213)](_0x4fc717)['toString'](),_0x47967f=_0xb53238[_0x197672(0x1eb)](/(window\[).+?(\.componentKey|.+]={)/img);if(_0x47967f&&_0x47967f[_0x197672(0x1e1)]){const _0x55c81f=_0xb53238[_0x197672(0x1eb)](/componentKey.+(info:\s{0,}{)/img);if(_0x55c81f&&_0x55c81f[_0x197672(0x1e1)]){let _0x5df9e1='{';const _0xae0c78=_0xb53238[_0x197672(0x1f4)](_0x55c81f[0x0])[0x1];for(let _0x1973b8=0x0;_0x1973b8<_0xae0c78[_0x197672(0x1e1)];_0x1973b8++){_0x5df9e1+=_0xae0c78[_0x1973b8];if(_0xae0c78[_0x1973b8]==='}')try{const _0x51839a=new Function('return\x20'+_0x5df9e1)();_0x2d4b27[_0x197672(0x1f6)]={..._0x51839a,'defaultSetting':{}};}catch(_0x5c0a64){}}}else console[_0x197672(0x1fe)](_0x197672(0x1ee)),process[_0x197672(0x1ec)](0x0);const _0x20010e=_0xb53238[_0x197672(0x1eb)](/componentKey.+(settings:\s{0,}{)/img);if(_0x20010e&&_0x20010e[_0x197672(0x1e1)]){let _0x53e247='{';const _0x4bdcf9=_0xb53238[_0x197672(0x1f4)](_0x20010e[0x0])[0x1];for(let _0x5eaa92=0x0;_0x5eaa92<_0x4bdcf9[_0x197672(0x1e1)];_0x5eaa92++){_0x53e247+=_0x4bdcf9[_0x5eaa92];if(_0x4bdcf9[_0x5eaa92]==='}')try{const _0x586ee0=new Function('return\x20'+_0x53e247)();_0x2d4b27[_0x197672(0x1f6)][_0x197672(0x1de)]=_0x586ee0;}catch(_0xff108){}}_0x2d4b27[_0x197672(0x1f6)]=JSON[_0x197672(0x1fd)](_0x2d4b27[_0x197672(0x1f6)]);}else console[_0x197672(0x1fe)](_0x197672(0x1ee)),process[_0x197672(0x1ec)](0x0);}else console['log']('【Error】:请在window下暴露配置信息'),process[_0x197672(0x1ec)](0x0);fs['existsSync'](_0x48b25a)?_0x2d4b27[_0x197672(0x1e4)]=fs['readFileSync'](_0x48b25a)[_0x197672(0x1d5)]():(console[_0x197672(0x1fe)](_0x197672(0x1db)),process[_0x197672(0x1ec)](0x0));if(!fs['existsSync'](_0x8bbee3))console[_0x197672(0x1fe)]('【Error】:组件根目录必须包含thumbnail.png缩略图片'),process[_0x197672(0x1ec)](0x0);else{const _0x54a665=fs[_0x197672(0x213)](_0x8bbee3),_0x3a027c=Buffer[_0x197672(0x1e2)](_0x54a665)[_0x197672(0x1d5)](_0x197672(0x20c));_0x2d4b27[_0x197672(0x1f2)]=_0x3a027c;}io[_0x197672(0x208)](_0x197672(0x201),function(_0x336f90){const _0x2fd9fd=_0x197672;_0x2d4b27['message']=_0x336f90||_0x2fd9fd(0x1e0),axios[_0x2fd9fd(0x1ef)](_0x2c55ec+_0x2fd9fd(0x203),_0x2d4b27)[_0x2fd9fd(0x20d)](_0x6561f7=>{const _0x734e29=_0x2fd9fd;console['log'](_0x6561f7[_0x734e29(0x1d8)][_0x734e29(0x1df)]),process[_0x734e29(0x1ec)](0x0);})['catch'](_0x3b57fe=>{const _0x186e4a=_0x2fd9fd;console[_0x186e4a(0x1fe)](_0x3b57fe),console[_0x186e4a(0x1fe)](_0x186e4a(0x1dd)),process[_0x186e4a(0x1ec)](0x0);});});}else console[_0x197672(0x1fe)](_0x197672(0x20a)),process[_0x197672(0x1ec)](0x0);}else console[_0x197672(0x1fe)](_0x197672(0x1fb)),process[_0x197672(0x1ec)](0x0);}else console['log'](_0x197672(0x1d7));})['catch'](_0x4f6e44=>{const _0x463612=_0x30d0db;console[_0x463612(0x1fe)](_0x4f6e44),console[_0x463612(0x1fe)]('Auth\x20NetWork\x20Fail!');});};
|
@@ -1,65 +1 @@
|
|
1
|
-
const 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
|
+
function a11_0x48d1(_0x53ad9e,_0x47bd9a){const _0xedc97=a11_0xedc9();return a11_0x48d1=function(_0x48d168,_0x437e3a){_0x48d168=_0x48d168-0x172;let _0x344074=_0xedc97[_0x48d168];return _0x344074;},a11_0x48d1(_0x53ad9e,_0x47bd9a);}const a11_0x35fb33=a11_0x48d1;(function(_0x26658e,_0x45b180){const _0x13afd4=a11_0x48d1,_0x404300=_0x26658e();while(!![]){try{const _0x9cb115=parseInt(_0x13afd4(0x18f))/0x1+-parseInt(_0x13afd4(0x181))/0x2+parseInt(_0x13afd4(0x174))/0x3+-parseInt(_0x13afd4(0x192))/0x4+parseInt(_0x13afd4(0x191))/0x5*(-parseInt(_0x13afd4(0x189))/0x6)+-parseInt(_0x13afd4(0x179))/0x7*(parseInt(_0x13afd4(0x175))/0x8)+parseInt(_0x13afd4(0x185))/0x9*(parseInt(_0x13afd4(0x180))/0xa);if(_0x9cb115===_0x45b180)break;else _0x404300['push'](_0x404300['shift']());}catch(_0x501dc6){_0x404300['push'](_0x404300['shift']());}}}(a11_0xedc9,0x68b62));function a11_0xedc9(){const _0x557dc5=['1680469zxGtwZ','exit','.prettierignore','localDir','length','【Error】:no\x20','All\x20Finish!','40YCDyLq','571660WQdpQT','server.js','build.js','package.json','2772747JBmlOx','http\x20error\x20','data','https','3842148oNLsga','getTime','log','jjb.script','remoteDir','\x20file,\x20available:[','422395LnnIHm','files','5VpeWVq','3239780NAOuND','../cmd.install/config','keys','resolve','babel','2251113xznTmE','8JJydAa','writeFileSync','includes','.eslintrc.js'];a11_0xedc9=function(){return _0x557dc5;};return a11_0xedc9();}const https=require(a11_0x35fb33(0x188)),fs=require('fs'),path=require('path'),{CONFIG_FILE_HOST}=require(a11_0x35fb33(0x193)),REGISTRY={'eslint':{'remoteDir':'eslint','files':[a11_0x35fb33(0x178),'.eslintignore']},'prettier':{'remoteDir':'prettier','files':['.prettierrc.js',a11_0x35fb33(0x17b)]},'jjb_script':{'remoteDir':a11_0x35fb33(0x18c),'localDir':a11_0x35fb33(0x18c),'files':[a11_0x35fb33(0x183),'config.js','proxy.js',a11_0x35fb33(0x182),'utils.js']},'babel':{'remoteDir':a11_0x35fb33(0x173),'files':['.babelrc']},'microAppPackage':{'remoteDir':'micro.app.package.json','files':[a11_0x35fb33(0x184)]}},root_path=path[a11_0x35fb33(0x172)]('./');function recursion(_0x589026,_0x4f18ae,_0x277dd5){const _0x897d0d=a11_0x35fb33,_0x4baf23=_0x589026['files'][_0x4f18ae];https['get'](CONFIG_FILE_HOST+'/'+(_0x589026[_0x897d0d(0x18d)]?_0x589026['remoteDir']+'/':'')+_0x4baf23+'?v='+new Date()[_0x897d0d(0x18a)](),_0x92d1d5=>{const _0x14234a=_0x897d0d;let _0x5deaa6='';_0x92d1d5['on'](_0x14234a(0x187),_0x12fae3=>{_0x5deaa6+=_0x12fae3;}),_0x92d1d5['on']('end',()=>{const _0x1b8832=_0x14234a;_0x5deaa6&&(fs[_0x1b8832(0x176)](root_path+'/'+(_0x589026['localDir']?_0x589026[_0x1b8832(0x17c)]+'/':'')+_0x4baf23,_0x5deaa6),console[_0x1b8832(0x18b)](_0x4baf23+'\x20file\x20Success!'),_0x4f18ae<_0x589026[_0x1b8832(0x190)][_0x1b8832(0x17d)]-0x1?(_0x4f18ae++,recursion(_0x589026,_0x4f18ae,_0x277dd5)):(console['log'](_0x1b8832(0x17f)),_0x277dd5&&_0x277dd5()));})['on']('error',_0x513fe4=>{const _0x276b1b=_0x14234a;console['log'](_0x276b1b(0x186),_0x513fe4);});});}module['exports']=_0x1c15d5=>{const _0x342084=a11_0x35fb33;!Object[_0x342084(0x194)](REGISTRY)[_0x342084(0x177)](_0x1c15d5)&&(console[_0x342084(0x18b)](_0x342084(0x17e)+_0x1c15d5+_0x342084(0x18e)+Object['keys'](REGISTRY)['join']('/')+']'),process[_0x342084(0x17a)](0x0)),recursion(REGISTRY[_0x1c15d5],0x0);};
|
@@ -1,23 +1 @@
|
|
1
|
-
const
|
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
|
+
const a12_0xf099c3=a12_0x156a;function a12_0x156a(_0x4aca5f,_0x2f2b5c){const _0x994d2c=a12_0x994d();return a12_0x156a=function(_0x156ab4,_0x12796a){_0x156ab4=_0x156ab4-0x19e;let _0xaf9e8a=_0x994d2c[_0x156ab4];return _0xaf9e8a;},a12_0x156a(_0x4aca5f,_0x2f2b5c);}(function(_0x23cc9a,_0x19377c){const _0x4f5cf0=a12_0x156a,_0x275e2a=_0x23cc9a();while(!![]){try{const _0x5acdf8=parseInt(_0x4f5cf0(0x1b3))/0x1*(parseInt(_0x4f5cf0(0x1b8))/0x2)+parseInt(_0x4f5cf0(0x1a7))/0x3*(-parseInt(_0x4f5cf0(0x1b0))/0x4)+parseInt(_0x4f5cf0(0x1ae))/0x5+parseInt(_0x4f5cf0(0x1b9))/0x6*(parseInt(_0x4f5cf0(0x1a0))/0x7)+-parseInt(_0x4f5cf0(0x1a3))/0x8*(-parseInt(_0x4f5cf0(0x19e))/0x9)+parseInt(_0x4f5cf0(0x1a9))/0xa+-parseInt(_0x4f5cf0(0x19f))/0xb*(parseInt(_0x4f5cf0(0x1a6))/0xc);if(_0x5acdf8===_0x19377c)break;else _0x275e2a['push'](_0x275e2a['shift']());}catch(_0x3de7ef){_0x275e2a['push'](_0x275e2a['shift']());}}}(a12_0x994d,0xa6f4d));const axios=require(a12_0xf099c3(0x1a2)),{getApiHost}=require(a12_0xf099c3(0x1aa));module[a12_0xf099c3(0x1b7)]=_0x73e2c6=>{const _0x5d43af=a12_0xf099c3;axios[_0x5d43af(0x1a5)](getApiHost()+_0x5d43af(0x1af))[_0x5d43af(0x1b1)](_0x54a161=>{const _0x18d947=_0x5d43af;if(_0x54a161[_0x18d947(0x1ad)][_0x18d947(0x1b4)]){const _0x2379df=_0x54a161[_0x18d947(0x1ad)][_0x18d947(0x1ad)];_0x73e2c6===_0x18d947(0x1ac)&&(console[_0x18d947(0x1a8)](_0x2379df[_0x18d947(0x1ab)]),console[_0x18d947(0x1a8)](_0x2379df[_0x18d947(0x1b6)])),_0x73e2c6===_0x18d947(0x1b5)&&console[_0x18d947(0x1a8)](_0x2379df[_0x18d947(0x1b5)]);}else console[_0x18d947(0x1a8)](_0x54a161[_0x18d947(0x1ad)][_0x18d947(0x1a4)]);process[_0x18d947(0x1a1)](0x0);})[_0x5d43af(0x1b2)](()=>{const _0x673464=_0x5d43af;console[_0x673464(0x1a8)]('网络异常。'),process[_0x673464(0x1a1)](0x0);});};function a12_0x994d(){const _0x426ad2=['components','port','exports','764266rdnVsR','2634BylMtq','4123773KYTylR','187rLFGRa','14917SELWld','exit','axios','8KnMQTp','message','post','1253940xAJJbQ','27POioNA','log','9474880ynpIUg','../cmd.install/config','host','server','data','1316215HyRmla','/api/file/config','233912loRAkM','then','catch','1wlebon','status'];a12_0x994d=function(){return _0x426ad2;};return a12_0x994d();}
|
@@ -1,58 +1 @@
|
|
1
|
-
const
|
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
|
+
function a13_0xa16a(){const _0x2cf1bb=['statSync','5764352ASzkep','1429173gZYNuE','readline','25037631luNomw','stdin','createInterface','取消删除。','3504039XNRtMf','无效操作。','existsSync','4dwKqrh','stdout','path','readdirSync','exit','正在计算项目数,请稍等...','clear','trim','2RAIFEj','rmdirSync','log','question','删除文件:','697415LbfYyx','exports','resolve','3544344smOmjU','是否确认删除?删除后不可恢复![y/n]:','删除异常:','85465LJJZba'];a13_0xa16a=function(){return _0x2cf1bb;};return a13_0xa16a();}const a13_0x4cd9ed=a13_0x5991;(function(_0x1d3dd1,_0x159b23){const _0x2d716b=a13_0x5991,_0x218c65=_0x1d3dd1();while(!![]){try{const _0x5e89ff=parseInt(_0x2d716b(0x1cb))/0x1+-parseInt(_0x2d716b(0x1df))/0x2*(parseInt(_0x2d716b(0x1ce))/0x3)+-parseInt(_0x2d716b(0x1d7))/0x4*(-parseInt(_0x2d716b(0x1c5))/0x5)+-parseInt(_0x2d716b(0x1c8))/0x6+-parseInt(_0x2d716b(0x1d4))/0x7+-parseInt(_0x2d716b(0x1cd))/0x8+parseInt(_0x2d716b(0x1d0))/0x9;if(_0x5e89ff===_0x159b23)break;else _0x218c65['push'](_0x218c65['shift']());}catch(_0x57efe6){_0x218c65['push'](_0x218c65['shift']());}}}(a13_0xa16a,0xaf74f));const fs=require('fs'),path=require(a13_0x4cd9ed(0x1d9)),readline=require(a13_0x4cd9ed(0x1cf)),io=readline[a13_0x4cd9ed(0x1d2)]({'input':process[a13_0x4cd9ed(0x1d1)],'output':process[a13_0x4cd9ed(0x1d8)]});function a13_0x5991(_0xe8f975,_0x4b9bab){const _0xa16acf=a13_0xa16a();return a13_0x5991=function(_0x599190,_0xc3d9cb){_0x599190=_0x599190-0x1c1;let _0x46f708=_0xa16acf[_0x599190];return _0x46f708;},a13_0x5991(_0xe8f975,_0x4b9bab);}let f_total=0x0;module[a13_0x4cd9ed(0x1c6)]=function(){const _0x1a9a0b=a13_0x4cd9ed,_0x295537=path[_0x1a9a0b(0x1c7)]('./');io[_0x1a9a0b(0x1c3)](_0x1a9a0b(0x1c9),function(_0x1a41f4){const _0x209231=_0x1a9a0b;if(_0x1a41f4[_0x209231(0x1de)]()==='y')console[_0x209231(0x1c2)](_0x209231(0x1dc)),setTimeout(()=>{setTimeout(()=>{console['clear'](),exec(_0x295537),setTimeout(()=>{const _0x2d8e87=a13_0x5991;console[_0x2d8e87(0x1c2)]('删除完成。'),console[_0x2d8e87(0x1dd)](),process['exit'](0x0);},0x1f4);},0x1f4);},0x1f4);else _0x1a41f4['trim']()==='n'?(console[_0x209231(0x1c2)](_0x209231(0x1d3)),process[_0x209231(0x1db)](0x0)):(console[_0x209231(0x1c2)](_0x209231(0x1d5)),process['exit'](0x0));});};function exec(_0xf37e77){const _0x3b0f7a=a13_0x4cd9ed;if(fs[_0x3b0f7a(0x1d6)](_0xf37e77)){const _0x492675=fs[_0x3b0f7a(0x1da)](_0xf37e77);for(let _0x5d2dee=0x0;_0x5d2dee<_0x492675['length'];_0x5d2dee++){const _0x247901=_0x492675[_0x5d2dee],_0x1f4fd6=_0xf37e77+'/'+_0x247901;try{fs[_0x3b0f7a(0x1cc)](_0x1f4fd6)['isDirectory']()?(exec(_0x1f4fd6),fs[_0x3b0f7a(0x1c1)](_0x1f4fd6,{'recursive':!![]}),console[_0x3b0f7a(0x1c2)]('删除文件夹:'+_0x1f4fd6)):(fs['unlinkSync'](_0x1f4fd6),console[_0x3b0f7a(0x1c2)](_0x3b0f7a(0x1c4)+_0x1f4fd6));}catch(_0x1b6dc5){console[_0x3b0f7a(0x1c2)](_0x3b0f7a(0x1ca)+_0x1f4fd6);}}}}
|
@@ -1,35 +1 @@
|
|
1
|
-
const
|
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
|
-
};
|
1
|
+
const a14_0x2f2dca=a14_0x4d2e;(function(_0x26f72b,_0x3fa00c){const _0x3c485f=a14_0x4d2e,_0x33d742=_0x26f72b();while(!![]){try{const _0x4b6fda=parseInt(_0x3c485f(0x1a6))/0x1+-parseInt(_0x3c485f(0x1a7))/0x2+-parseInt(_0x3c485f(0x1a4))/0x3*(parseInt(_0x3c485f(0x198))/0x4)+-parseInt(_0x3c485f(0x19f))/0x5+-parseInt(_0x3c485f(0x19b))/0x6*(-parseInt(_0x3c485f(0x1a5))/0x7)+parseInt(_0x3c485f(0x19a))/0x8*(-parseInt(_0x3c485f(0x19e))/0x9)+-parseInt(_0x3c485f(0x19c))/0xa*(-parseInt(_0x3c485f(0x18d))/0xb);if(_0x4b6fda===_0x3fa00c)break;else _0x33d742['push'](_0x33d742['shift']());}catch(_0x6ef8d3){_0x33d742['push'](_0x33d742['shift']());}}}(a14_0xc555,0xa692d));const path=require('path'),fs=require('fs'),axios=require(a14_0x2f2dca(0x195)),{getApiHost}=require(a14_0x2f2dca(0x18c));function a14_0x4d2e(_0x425508,_0x32cfe2){const _0xc5556b=a14_0xc555();return a14_0x4d2e=function(_0x4d2e67,_0x462f5e){_0x4d2e67=_0x4d2e67-0x18c;let _0x261143=_0xc5556b[_0x4d2e67];return _0x261143;},a14_0x4d2e(_0x425508,_0x32cfe2);}function a14_0xc555(){const _0x56c78d=['post','7794aLizNL','6443525jmttSe','existsSync','resolve','readFileSync','查询失败!根目录缺少‘package.json’文件,无法完成查询。','15fzwhDk','226541cRnrcZ','23855HEsxQT','1524480NfSEmx','\x5cpackage.json','../cmd.install/config','22snBNyk','log','/api/file/version','parse','toString','message','status','data','axios','网络异常。','exit','171548CqQFvY','catch','10408muTQhO','48sCDDCO','18957860tcWOHn'];a14_0xc555=function(){return _0x56c78d;};return a14_0xc555();}module['exports']=()=>{const _0x164872=a14_0x2f2dca,_0x3efe95=path[_0x164872(0x1a1)]('./'),_0x45112a=_0x3efe95+_0x164872(0x1a8);if(fs[_0x164872(0x1a0)](_0x45112a)){const _0x5dd58e=JSON[_0x164872(0x190)](fs[_0x164872(0x1a2)](_0x45112a)[_0x164872(0x191)]()),{name:_0x538d26}=_0x5dd58e;axios[_0x164872(0x19d)](getApiHost()+_0x164872(0x18f),{'package_name':_0x538d26})['then'](_0x436e5a=>{const _0x552cce=_0x164872;_0x436e5a[_0x552cce(0x194)][_0x552cce(0x193)]?console[_0x552cce(0x18e)](_0x436e5a['data'][_0x552cce(0x194)]):console[_0x552cce(0x18e)](_0x436e5a[_0x552cce(0x194)][_0x552cce(0x192)]),process[_0x552cce(0x197)](0x0);})[_0x164872(0x199)](()=>{const _0x18440e=_0x164872;console['log'](_0x18440e(0x196)),process[_0x18440e(0x197)](0x0);});}else console[_0x164872(0x18e)](_0x164872(0x1a3)),process[_0x164872(0x197)](0x0);};
|
package/src/old/cli.init.js
CHANGED
@@ -1,26 +1 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
const readline = require('readline');
|
3
|
-
const { f_file_copy } = require('./cli.install/tools');
|
4
|
-
const fs = require('fs');
|
5
|
-
|
6
|
-
module.exports = () => {
|
7
|
-
/**
|
8
|
-
* 下发数据根路径
|
9
|
-
* @type {string}
|
10
|
-
*/
|
11
|
-
const root_path = path.resolve('./');
|
12
|
-
if (
|
13
|
-
!fs.existsSync(`${root_path}\\jjb.script`) &&
|
14
|
-
!fs.existsSync(`${root_path}\\public`) &&
|
15
|
-
!fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
16
|
-
!fs.existsSync(`${root_path}\\package.json`) &&
|
17
|
-
!fs.existsSync(`${root_path}\\webstorm.config.js`)
|
18
|
-
) {
|
19
|
-
f_file_copy(`${__dirname}\\cli.init`, root_path);
|
20
|
-
console.log('初始化完成!');
|
21
|
-
process.exit(0);
|
22
|
-
} else {
|
23
|
-
console.log('初始化失败,文件已存在!');
|
24
|
-
process.exit(0);
|
25
|
-
}
|
26
|
-
};
|
1
|
+
function a15_0x1a37(){const _0x5c25b4=['2549432DqZBgm','144035eHoRpO','6674733ksyPzd','114AAGBZN','\x5cjjb.config.json','\x5cpackage.json','\x5cjjb.script','267956acoAfc','./cli.install/tools','2332162vsBZxT','existsSync','1tLUffT','\x5cwebstorm.config.js','初始化完成!','20510750lXGQVz','3cHWJea','exports','path','初始化失败,文件已存在!','\x5cpublic','exit','767874tpKnKH','readline','log'];a15_0x1a37=function(){return _0x5c25b4;};return a15_0x1a37();}const a15_0x28077c=a15_0x4c74;(function(_0x34bfde,_0x27e046){const _0x59bf59=a15_0x4c74,_0x509d6e=_0x34bfde();while(!![]){try{const _0x1af6b3=-parseInt(_0x59bf59(0x15f))/0x1*(parseInt(_0x59bf59(0x169))/0x2)+-parseInt(_0x59bf59(0x163))/0x3*(-parseInt(_0x59bf59(0x15b))/0x4)+-parseInt(_0x59bf59(0x16d))/0x5*(parseInt(_0x59bf59(0x16f))/0x6)+-parseInt(_0x59bf59(0x15d))/0x7+parseInt(_0x59bf59(0x16c))/0x8+-parseInt(_0x59bf59(0x16e))/0x9+parseInt(_0x59bf59(0x162))/0xa;if(_0x1af6b3===_0x27e046)break;else _0x509d6e['push'](_0x509d6e['shift']());}catch(_0x3d5252){_0x509d6e['push'](_0x509d6e['shift']());}}}(a15_0x1a37,0x6924e));const path=require(a15_0x28077c(0x165)),readline=require(a15_0x28077c(0x16a)),{f_file_copy}=require(a15_0x28077c(0x15c)),fs=require('fs');function a15_0x4c74(_0x1c369c,_0x1aef62){const _0x1a3750=a15_0x1a37();return a15_0x4c74=function(_0x4c74d4,_0x5a7adf){_0x4c74d4=_0x4c74d4-0x159;let _0x3205ae=_0x1a3750[_0x4c74d4];return _0x3205ae;},a15_0x4c74(_0x1c369c,_0x1aef62);}module[a15_0x28077c(0x164)]=()=>{const _0x4e8972=a15_0x28077c,_0x1f929e=path['resolve']('./');!fs['existsSync'](_0x1f929e+_0x4e8972(0x15a))&&!fs[_0x4e8972(0x15e)](_0x1f929e+_0x4e8972(0x167))&&!fs[_0x4e8972(0x15e)](_0x1f929e+_0x4e8972(0x170))&&!fs[_0x4e8972(0x15e)](_0x1f929e+_0x4e8972(0x159))&&!fs[_0x4e8972(0x15e)](_0x1f929e+_0x4e8972(0x160))?(f_file_copy(__dirname+'\x5ccli.init',_0x1f929e),console['log'](_0x4e8972(0x161)),process[_0x4e8972(0x168)](0x0)):(console[_0x4e8972(0x16b)](_0x4e8972(0x166)),process[_0x4e8972(0x168)](0x0));};
|