jjb-cmd 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +1 -1
- package/src/new/cmd.auth/index.js +1 -26
- package/src/new/cmd.init/index.js +1 -116
- package/src/new/cmd.install/config.js +1 -70
- package/src/new/cmd.install/index.js +1 -262
- package/src/new/cmd.install/tools.js +1 -230
- package/src/new/cmd.install.app/index.js +1 -27
- package/src/new/cmd.jenkins/index.js +1 -72
- package/src/new/cmd.publish/index.js +1 -197
- package/src/new/cmd.push/index.js +1 -76
- package/src/new/cmd.push/java.js +1 -148
- package/src/new/cmd.push-set/index.js +1 -205
- package/src/new/cmd.refresh/index.js +1 -65
- package/src/new/cmd.reglist/index.js +1 -23
- package/src/new/cmd.rm-rf/index.js +1 -58
- package/src/new/cmd.version/index.js +1 -35
- package/src/old/cli.init.js +1 -26
- package/src/old/cli.install/config.js +1 -206
- package/src/old/cli.install/index.js +1 -340
- package/src/old/cli.install/tools.js +1 -230
- package/src/old/cli.merge.js +1 -80
- package/src/old/cli.pull.js +1 -94
- package/src/old/cli.pull2.js +1 -377
- package/src/old/cli.rm-rf.js +1 -88
- package/src/old/progress-bar.js +1 -23
- package/src/old/util.js +1 -149
- package/build.js +0 -15
- package/obf.config.json +0 -3
- package/src/old/cli.dva.register.saas.txt +0 -40
- package/src/old/cli.dva.register.spa.txt +0 -22
- package/src/old/cli.dva.router.saas.txt +0 -210
- package/src/old/cli.dva.router.spa.txt +0 -119
package/README.md
CHANGED
package/package.json
CHANGED
@@ -1,26 +1 @@
|
|
1
|
-
const
|
2
|
-
const fs = require("fs");
|
3
|
-
const path = require("path");
|
4
|
-
const { getApiHost } = require("../cmd.install/config");
|
5
|
-
|
6
|
-
module.exports = args => {
|
7
|
-
console.log(args)
|
8
|
-
const [username, password] = args;
|
9
|
-
axios.post(`${getApiHost()}/api/auth`, {
|
10
|
-
username,
|
11
|
-
password
|
12
|
-
}).then(res => {
|
13
|
-
const authPath = path.join(__dirname, '../../../.auth');
|
14
|
-
if (res.data.status) {
|
15
|
-
console.log('Auth Success!');
|
16
|
-
fs.writeFileSync(authPath, `${username}/${password}`);
|
17
|
-
} else {
|
18
|
-
console.log('Auth Fail!');
|
19
|
-
if (fs.existsSync(authPath)) {
|
20
|
-
fs.unlinkSync(authPath);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}).catch(e => {
|
24
|
-
console.log('Auth NetWork Fail!');
|
25
|
-
});
|
26
|
-
};
|
1
|
+
const a0_0x57f74f=a0_0x4094;function a0_0x4094(_0x3b30c3,_0x18bb0f){const _0x178603=a0_0x1786();return a0_0x4094=function(_0x409412,_0x43758a){_0x409412=_0x409412-0xc6;let _0xa97096=_0x178603[_0x409412];return _0xa97096;},a0_0x4094(_0x3b30c3,_0x18bb0f);}(function(_0x457326,_0x15e4bb){const _0x1cc49c=a0_0x4094,_0x1681c5=_0x457326();while(!![]){try{const _0x241f4b=-parseInt(_0x1cc49c(0xcf))/0x1*(parseInt(_0x1cc49c(0xcb))/0x2)+-parseInt(_0x1cc49c(0xd0))/0x3*(-parseInt(_0x1cc49c(0xdb))/0x4)+-parseInt(_0x1cc49c(0xde))/0x5*(-parseInt(_0x1cc49c(0xd7))/0x6)+parseInt(_0x1cc49c(0xd3))/0x7+-parseInt(_0x1cc49c(0xdd))/0x8+parseInt(_0x1cc49c(0xc6))/0x9*(-parseInt(_0x1cc49c(0xc8))/0xa)+-parseInt(_0x1cc49c(0xc9))/0xb*(parseInt(_0x1cc49c(0xd2))/0xc);if(_0x241f4b===_0x15e4bb)break;else _0x1681c5['push'](_0x1681c5['shift']());}catch(_0xf92d48){_0x1681c5['push'](_0x1681c5['shift']());}}}(a0_0x1786,0xece67));const axios=require(a0_0x57f74f(0xda)),fs=require('fs'),path=require(a0_0x57f74f(0xca)),{getApiHost}=require(a0_0x57f74f(0xcc));module['exports']=_0x27e644=>{const _0x112d3e=a0_0x57f74f;console[_0x112d3e(0xce)](_0x27e644);const [_0x482ebb,_0x4acb62]=_0x27e644;axios[_0x112d3e(0xd1)](getApiHost()+_0x112d3e(0xd8),{'username':_0x482ebb,'password':_0x4acb62})[_0x112d3e(0xc7)](_0xbdb32f=>{const _0x5a5f4e=_0x112d3e,_0x2b092d=path[_0x5a5f4e(0xd5)](__dirname,'../../../.auth');_0xbdb32f['data'][_0x5a5f4e(0xcd)]?(console['log']('Auth\x20Success!'),fs[_0x5a5f4e(0xd4)](_0x2b092d,_0x482ebb+'/'+_0x4acb62)):(console['log'](_0x5a5f4e(0xd9)),fs[_0x5a5f4e(0xdf)](_0x2b092d)&&fs['unlinkSync'](_0x2b092d));})[_0x112d3e(0xdc)](_0x10c145=>{const _0x3b63d4=_0x112d3e;console['log'](_0x3b63d4(0xd6));});};function a0_0x1786(){const _0xfb8f64=['229599JcaDWa','then','130jzFlZx','4895nXfzgk','path','14fsnFGZ','../cmd.install/config','status','log','135671eIEZRb','3ACVJqG','post','13032HySGfq','4671898Qvfqfw','writeFileSync','join','Auth\x20NetWork\x20Fail!','4722KHfzOa','/api/auth','Auth\x20Fail!','axios','6221836VirrIz','catch','2847848gaSOsO','5515JsmshB','existsSync'];a0_0x1786=function(){return _0xfb8f64;};return a0_0x1786();}
|
@@ -1,116 +1 @@
|
|
1
|
-
const
|
2
|
-
const os = require("os");
|
3
|
-
const path = require('path');
|
4
|
-
const request = require("request");
|
5
|
-
const utils = require("../../old/util");
|
6
|
-
const compressing = require("compressing");
|
7
|
-
const readline = require('readline');
|
8
|
-
const io = readline.createInterface({
|
9
|
-
input: process.stdin,
|
10
|
-
output: process.stdout
|
11
|
-
});
|
12
|
-
const child_process = require('child_process');
|
13
|
-
const { CLOUD_PROJECT, GIT_TEMP_DIR, GIT_HOST } = require('../cmd.install/config');
|
14
|
-
|
15
|
-
module.exports = stdin => {
|
16
|
-
/**
|
17
|
-
* 下发数据根路径
|
18
|
-
* @type {string}
|
19
|
-
*/
|
20
|
-
const root_path = path.resolve('./');
|
21
|
-
|
22
|
-
const cloudObj = CLOUD_PROJECT[ stdin ] || undefined;
|
23
|
-
if (cloudObj) {
|
24
|
-
const tmpDir = os.tmpdir();
|
25
|
-
const zipPath = `${tmpDir}/${GIT_TEMP_DIR}/${stdin}.zip`;
|
26
|
-
const zipFolder = `${tmpDir}/${GIT_TEMP_DIR}/unzip/`;
|
27
|
-
utils.DeleteDirAllFile(`${tmpDir}/${GIT_TEMP_DIR}`, () => {
|
28
|
-
fs.mkdirSync(`${tmpDir}/${GIT_TEMP_DIR}`);
|
29
|
-
let stream = fs.createWriteStream(zipPath);
|
30
|
-
request(`${GIT_HOST}/api/v4/projects/${cloudObj.projectId}/repository/archive.zip?private_token=${cloudObj.token}&ref=master`).pipe(stream)
|
31
|
-
.on('close', () => {
|
32
|
-
fs.mkdirSync(zipFolder);
|
33
|
-
compressing.zip.uncompress(zipPath, zipFolder)
|
34
|
-
.then(() => {
|
35
|
-
setTimeout(() => {
|
36
|
-
fs.readdirSync(zipFolder).forEach(dirName => {
|
37
|
-
if (dirName.indexOf('-master-') !== -1) {
|
38
|
-
utils.CopyFolder(zipFolder + dirName, root_path, () => {
|
39
|
-
io.question('初始化完成?请选择安装方式![yarn/npm]:', function (answer) {
|
40
|
-
if (['yarn', 'npm'].includes(answer.trim())) {
|
41
|
-
console.log('安装中,请耐心等待...');
|
42
|
-
child_process.execSync(`jjb-cmd install.app ${answer.trim()}`, { cwd: root_path });
|
43
|
-
console.log('安装完成,祝您愉快编码!');
|
44
|
-
process.exit(0);
|
45
|
-
} else {
|
46
|
-
console.log('初始化完成!请自行使用jjb-cmd install.app yarn/npm安装项目!');
|
47
|
-
process.exit(0);
|
48
|
-
}
|
49
|
-
});
|
50
|
-
});
|
51
|
-
}
|
52
|
-
})
|
53
|
-
}, 2000);
|
54
|
-
})
|
55
|
-
});
|
56
|
-
});
|
57
|
-
} else {
|
58
|
-
console.log('【Error】:初始化失败,'+ stdin +'不存在。');
|
59
|
-
}
|
60
|
-
|
61
|
-
// if (stdin === 'micro-app') {
|
62
|
-
// if (
|
63
|
-
// !fs.existsSync(`${root_path}\\jjb.script`) &&
|
64
|
-
// !fs.existsSync(`${root_path}\\public`) &&
|
65
|
-
// !fs.existsSync(`${root_path}\\src`) &&
|
66
|
-
// !fs.existsSync(`${root_path}\\.gitignore`) &&
|
67
|
-
// !fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
68
|
-
// !fs.existsSync(`${root_path}\\package.json`) &&
|
69
|
-
// !fs.existsSync(`${root_path}\\webstorm.config.js`)
|
70
|
-
// ) {
|
71
|
-
// f_file_copy(`${__dirname}\\..\\cmd.init.copy\\micro-app`, root_path);
|
72
|
-
// console.log('初始化完成!');
|
73
|
-
// process.exit(0);
|
74
|
-
// } else {
|
75
|
-
// console.log('初始化失败,文件已存在!');
|
76
|
-
// process.exit(0);
|
77
|
-
// }
|
78
|
-
// } else if(stdin === 'micro-app-ts') {
|
79
|
-
// if (
|
80
|
-
// !fs.existsSync(`${root_path}\\jjb.script`) &&
|
81
|
-
// !fs.existsSync(`${root_path}\\public`) &&
|
82
|
-
// !fs.existsSync(`${root_path}\\src`) &&
|
83
|
-
// !fs.existsSync(`${root_path}\\.gitignore`) &&
|
84
|
-
// !fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
85
|
-
// !fs.existsSync(`${root_path}\\tsconfig.json`) &&
|
86
|
-
// !fs.existsSync(`${root_path}\\package.json`) &&
|
87
|
-
// !fs.existsSync(`${root_path}\\webstorm.config.js`)
|
88
|
-
// ) {
|
89
|
-
// f_file_copy(`${__dirname}\\..\\cmd.init.copy\\micro-app-ts`, root_path);
|
90
|
-
// console.log('初始化完成!');
|
91
|
-
// process.exit(0);
|
92
|
-
// } else {
|
93
|
-
// console.log('初始化失败,文件已存在!');
|
94
|
-
// process.exit(0);
|
95
|
-
// }
|
96
|
-
// } else if ([
|
97
|
-
// 'lib',
|
98
|
-
// 'react-component'
|
99
|
-
// ].includes(stdin)) {
|
100
|
-
// if (
|
101
|
-
// !fs.existsSync(`${root_path}\\jjb.script`) &&
|
102
|
-
// !fs.existsSync(`${root_path}\\src`) &&
|
103
|
-
// !fs.existsSync(`${root_path}\\.gitignore`) &&
|
104
|
-
// !fs.existsSync(`${root_path}\\jjb.config.json`) &&
|
105
|
-
// !fs.existsSync(`${root_path}\\package.json`) &&
|
106
|
-
// !fs.existsSync(`${root_path}\\webstorm.config.js`)
|
107
|
-
// ) {
|
108
|
-
// f_file_copy(`${__dirname}\\..\\cmd.init.copy\\${stdin}`, root_path);
|
109
|
-
// console.log('初始化完成!');
|
110
|
-
// process.exit(0);
|
111
|
-
// } else {
|
112
|
-
// console.log('初始化失败,文件已存在!');
|
113
|
-
// process.exit(0);
|
114
|
-
// }
|
115
|
-
// }
|
116
|
-
};
|
1
|
+
const a1_0x168df8=a1_0x3c86;function a1_0x3c86(_0x6e2a02,_0x5d51a8){const _0x2329d5=a1_0x2329();return a1_0x3c86=function(_0x3c86a7,_0xc06056){_0x3c86a7=_0x3c86a7-0x1c1;let _0x2a6f1e=_0x2329d5[_0x3c86a7];return _0x2a6f1e;},a1_0x3c86(_0x6e2a02,_0x5d51a8);}(function(_0x584325,_0xe00851){const _0xcf60b1=a1_0x3c86,_0x2caa82=_0x584325();while(!![]){try{const _0x4ff4ab=parseInt(_0xcf60b1(0x1c4))/0x1*(-parseInt(_0xcf60b1(0x1e1))/0x2)+-parseInt(_0xcf60b1(0x1e4))/0x3*(-parseInt(_0xcf60b1(0x1d0))/0x4)+parseInt(_0xcf60b1(0x1e0))/0x5+parseInt(_0xcf60b1(0x1ce))/0x6*(-parseInt(_0xcf60b1(0x1c5))/0x7)+-parseInt(_0xcf60b1(0x1d2))/0x8+parseInt(_0xcf60b1(0x1c1))/0x9+-parseInt(_0xcf60b1(0x1ea))/0xa;if(_0x4ff4ab===_0xe00851)break;else _0x2caa82['push'](_0x2caa82['shift']());}catch(_0x30c9d1){_0x2caa82['push'](_0x2caa82['shift']());}}}(a1_0x2329,0xa954c));const fs=require('fs'),os=require('os'),path=require(a1_0x168df8(0x1d5)),request=require(a1_0x168df8(0x1cf)),utils=require(a1_0x168df8(0x1de)),compressing=require('compressing'),readline=require(a1_0x168df8(0x1c7)),io=readline['createInterface']({'input':process['stdin'],'output':process[a1_0x168df8(0x1c8)]}),child_process=require(a1_0x168df8(0x1e3)),{CLOUD_PROJECT,GIT_TEMP_DIR,GIT_HOST}=require('../cmd.install/config');function a1_0x2329(){const _0xd26b5c=['question','.zip','execSync','createWriteStream','projectId','48KhbvwS','request','32iqueEb','安装中,请耐心等待...','5457072DztRFO','npm','forEach','path','mkdirSync','tmpdir','resolve','yarn','/api/v4/projects/','【Error】:初始化失败,','/repository/archive.zip?private_token=','log','../../old/util','exit','6725405DNJxnt','123592aLVear','zip','child_process','422589SvWIFH','includes','&ref=master','初始化完成?请选择安装方式![yarn/npm]:','uncompress','初始化完成!请自行使用jjb-cmd\x20install.app\x20yarn/npm安装项目!','8006020ychAxR','CopyFolder','2387907kDKmdl','exports','indexOf','6hvFFJH','166439DwcKru','then','readline','stdout'];a1_0x2329=function(){return _0xd26b5c;};return a1_0x2329();}module[a1_0x168df8(0x1c2)]=_0x48dfdf=>{const _0xc6df03=a1_0x168df8,_0x4e9415=path[_0xc6df03(0x1d8)]('./'),_0x5c1729=CLOUD_PROJECT[_0x48dfdf]||undefined;if(_0x5c1729){const _0x4518fc=os[_0xc6df03(0x1d7)](),_0x155466=_0x4518fc+'/'+GIT_TEMP_DIR+'/'+_0x48dfdf+_0xc6df03(0x1ca),_0x518926=_0x4518fc+'/'+GIT_TEMP_DIR+'/unzip/';utils['DeleteDirAllFile'](_0x4518fc+'/'+GIT_TEMP_DIR,()=>{const _0x309b7b=_0xc6df03;fs['mkdirSync'](_0x4518fc+'/'+GIT_TEMP_DIR);let _0xcefd98=fs[_0x309b7b(0x1cc)](_0x155466);request(GIT_HOST+_0x309b7b(0x1da)+_0x5c1729[_0x309b7b(0x1cd)]+_0x309b7b(0x1dc)+_0x5c1729['token']+_0x309b7b(0x1e6))['pipe'](_0xcefd98)['on']('close',()=>{const _0x54f029=_0x309b7b;fs[_0x54f029(0x1d6)](_0x518926),compressing[_0x54f029(0x1e2)][_0x54f029(0x1e8)](_0x155466,_0x518926)[_0x54f029(0x1c6)](()=>{setTimeout(()=>{const _0x52e4fc=a1_0x3c86;fs['readdirSync'](_0x518926)[_0x52e4fc(0x1d4)](_0x359f33=>{const _0x32dc6a=_0x52e4fc;_0x359f33[_0x32dc6a(0x1c3)]('-master-')!==-0x1&&utils[_0x32dc6a(0x1eb)](_0x518926+_0x359f33,_0x4e9415,()=>{const _0x19a8de=_0x32dc6a;io[_0x19a8de(0x1c9)](_0x19a8de(0x1e7),function(_0x757180){const _0x4650e2=_0x19a8de;[_0x4650e2(0x1d9),_0x4650e2(0x1d3)][_0x4650e2(0x1e5)](_0x757180['trim']())?(console['log'](_0x4650e2(0x1d1)),child_process[_0x4650e2(0x1cb)]('jjb-cmd\x20install.app\x20'+_0x757180['trim'](),{'cwd':_0x4e9415}),console[_0x4650e2(0x1dd)]('安装完成,祝您愉快编码!'),process['exit'](0x0)):(console[_0x4650e2(0x1dd)](_0x4650e2(0x1e9)),process[_0x4650e2(0x1df)](0x0));});});});},0x7d0);});});});}else console[_0xc6df03(0x1dd)](_0xc6df03(0x1db)+_0x48dfdf+'不存在。');};
|
@@ -1,70 +1 @@
|
|
1
|
-
const
|
2
|
-
const path = require('path');
|
3
|
-
const fs = require('fs');
|
4
|
-
|
5
|
-
const API_HOST = 'http://120.26.210.58:8088';
|
6
|
-
const API_HOST_TEST = 'http://120.26.210.58:8089';
|
7
|
-
|
8
|
-
exports.CONFIG_FILE_HOST = 'https://cdn.cqjjb.cn/jjb-cloud-config';
|
9
|
-
exports.API_HOST = API_HOST;
|
10
|
-
exports.API_HOST_TEST = API_HOST_TEST;
|
11
|
-
exports.GIT_HOST = 'http://192.168.1.242:10985';
|
12
|
-
exports.GIT_TEMP_DIR = `jjb-assembly-${Date.now()}`;
|
13
|
-
exports.GIT_TEMP_JAVA = `jjb-assembly-java`;
|
14
|
-
exports.GIT_JAVA_ENV_JSON = {
|
15
|
-
"development": "dev",
|
16
|
-
"production": "prod",
|
17
|
-
"test": "test"
|
18
|
-
};
|
19
|
-
exports.CLOUD_PROJECT = {
|
20
|
-
'common': {
|
21
|
-
token: 'G4HJRsHr9D7Ssmixegw2',
|
22
|
-
projectId: 279
|
23
|
-
},
|
24
|
-
'react-admin-component': {
|
25
|
-
token: 'FT3pKzxpRynFkmddJ9Bs',
|
26
|
-
projectId: 340
|
27
|
-
},
|
28
|
-
'jjb-dva-runtime': {
|
29
|
-
token: 'hLqARY89CN6fUD3yg4NL',
|
30
|
-
projectId: 571
|
31
|
-
},
|
32
|
-
'jjb-common-lib': {
|
33
|
-
token: 'e9njpBd1nS_LREN8GFpR',
|
34
|
-
projectId: 572
|
35
|
-
},
|
36
|
-
'jjb-common-decorator': {
|
37
|
-
token: 'gPSit8aJsLVmNzuQ5Cy4',
|
38
|
-
projectId: 574
|
39
|
-
},
|
40
|
-
'vue-unisass-component': {
|
41
|
-
token: 'd4wQ7dzEjYPsgVbKnYei',
|
42
|
-
projectId: 339
|
43
|
-
},
|
44
|
-
'react-component': {
|
45
|
-
token: 'snBxJ2i5kYarGGcsojhY',
|
46
|
-
projectId: 831
|
47
|
-
},
|
48
|
-
'micro-app-ts': {
|
49
|
-
token: '7V-YUxhmh51Mdhgx4rq4',
|
50
|
-
projectId: 830
|
51
|
-
},
|
52
|
-
'micro-app': {
|
53
|
-
token: 'FqNrmFAgrxasMrbbjvq9',
|
54
|
-
projectId: 829
|
55
|
-
},
|
56
|
-
'lib': {
|
57
|
-
token: 'ywPtT3xCG6b_vAxp6sTj',
|
58
|
-
projectId: 828
|
59
|
-
}
|
60
|
-
};
|
61
|
-
exports.TEMPLATE_FOLDER = `${os.tmpdir()}\\${exports.GIT_TEMP_DIR}`;
|
62
|
-
|
63
|
-
exports.getApiHost = () => {
|
64
|
-
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../package.json')).toString());
|
65
|
-
if (packageJson.env === 'test') {
|
66
|
-
return API_HOST_TEST;
|
67
|
-
} else {
|
68
|
-
return API_HOST;
|
69
|
-
}
|
70
|
-
};
|
1
|
+
function a2_0x2afa(_0x4ed7a9,_0x48bcc8){const _0x13ef6f=a2_0x13ef();return a2_0x2afa=function(_0x2afa06,_0x2dd071){_0x2afa06=_0x2afa06-0xe9;let _0x45dd35=_0x13ef6f[_0x2afa06];return _0x45dd35;},a2_0x2afa(_0x4ed7a9,_0x48bcc8);}const a2_0x2a0191=a2_0x2afa;function a2_0x13ef(){const _0x5612a9=['http://192.168.1.242:10985','snBxJ2i5kYarGGcsojhY','77cFCaHA','test','path','45IutoxH','https://cdn.cqjjb.cn/jjb-cloud-config','http://120.26.210.58:8088','env','46568VJJqHN','tmpdir','now','ywPtT3xCG6b_vAxp6sTj','GIT_TEMP_JAVA','1711956GjnuVJ','GIT_HOST','join','CONFIG_FILE_HOST','84850HGITRZ','readFileSync','CLOUD_PROJECT','gPSit8aJsLVmNzuQ5Cy4','FT3pKzxpRynFkmddJ9Bs','204249MoGllS','331515imgIBD','toString','e9njpBd1nS_LREN8GFpR','124856smgcyg','d4wQ7dzEjYPsgVbKnYei','../../../package.json','331228faaber','15QntZSv','API_HOST_TEST','G4HJRsHr9D7Ssmixegw2','API_HOST','jjb-assembly-java','GIT_JAVA_ENV_JSON','GIT_TEMP_DIR'];a2_0x13ef=function(){return _0x5612a9;};return a2_0x13ef();}(function(_0x2c5c2c,_0x23267d){const _0x33ea8d=a2_0x2afa,_0xb0fc6=_0x2c5c2c();while(!![]){try{const _0x5802f9=-parseInt(_0x33ea8d(0x107))/0x1+-parseInt(_0x33ea8d(0x10e))/0x2+parseInt(_0x33ea8d(0x108))/0x3+-parseInt(_0x33ea8d(0xf9))/0x4*(-parseInt(_0x33ea8d(0xe9))/0x5)+parseInt(_0x33ea8d(0xfe))/0x6+parseInt(_0x33ea8d(0xf2))/0x7*(parseInt(_0x33ea8d(0x10b))/0x8)+-parseInt(_0x33ea8d(0xf5))/0x9*(parseInt(_0x33ea8d(0x102))/0xa);if(_0x5802f9===_0x23267d)break;else _0xb0fc6['push'](_0xb0fc6['shift']());}catch(_0xb6774f){_0xb0fc6['push'](_0xb0fc6['shift']());}}}(a2_0x13ef,0x2e6c2));const os=require('os'),path=require(a2_0x2a0191(0xf4)),fs=require('fs'),API_HOST=a2_0x2a0191(0xf7),API_HOST_TEST='http://120.26.210.58:8089';exports[a2_0x2a0191(0x101)]=a2_0x2a0191(0xf6),exports[a2_0x2a0191(0xec)]=API_HOST,exports[a2_0x2a0191(0xea)]=API_HOST_TEST,exports[a2_0x2a0191(0xff)]=a2_0x2a0191(0xf0),exports[a2_0x2a0191(0xef)]='jjb-assembly-'+Date[a2_0x2a0191(0xfb)](),exports[a2_0x2a0191(0xfd)]=a2_0x2a0191(0xed),exports[a2_0x2a0191(0xee)]={'development':'dev','production':'prod','test':'test'},exports[a2_0x2a0191(0x104)]={'common':{'token':a2_0x2a0191(0xeb),'projectId':0x117},'react-admin-component':{'token':a2_0x2a0191(0x106),'projectId':0x154},'jjb-dva-runtime':{'token':'hLqARY89CN6fUD3yg4NL','projectId':0x23b},'jjb-common-lib':{'token':a2_0x2a0191(0x10a),'projectId':0x23c},'jjb-common-decorator':{'token':a2_0x2a0191(0x105),'projectId':0x23e},'vue-unisass-component':{'token':a2_0x2a0191(0x10c),'projectId':0x153},'react-component':{'token':a2_0x2a0191(0xf1),'projectId':0x33f},'micro-app-ts':{'token':'7V-YUxhmh51Mdhgx4rq4','projectId':0x33e},'micro-app':{'token':'FqNrmFAgrxasMrbbjvq9','projectId':0x33d},'lib':{'token':a2_0x2a0191(0xfc),'projectId':0x33c}},exports['TEMPLATE_FOLDER']=os[a2_0x2a0191(0xfa)]()+'\x5c'+exports[a2_0x2a0191(0xef)],exports['getApiHost']=()=>{const _0x1162b9=a2_0x2a0191,_0x2f094e=JSON['parse'](fs[_0x1162b9(0x103)](path[_0x1162b9(0x100)](__dirname,_0x1162b9(0x10d)))[_0x1162b9(0x109)]());return _0x2f094e[_0x1162b9(0xf8)]===_0x1162b9(0xf3)?API_HOST_TEST:API_HOST;};
|
@@ -1,262 +1 @@
|
|
1
|
-
const
|
2
|
-
const path = require('path');
|
3
|
-
const request = require('request');
|
4
|
-
const compressing = require('compressing');
|
5
|
-
const {
|
6
|
-
f_rm_rf,
|
7
|
-
f_file_copy,
|
8
|
-
f_create_package_json,
|
9
|
-
f_pull_git_repository,
|
10
|
-
f_scan_jjb_config_json,
|
11
|
-
f_scan_jjb_config_json_rules,
|
12
|
-
f_update_project_package_json
|
13
|
-
} = require('./tools');
|
14
|
-
const { TEMPLATE_FOLDER } = require('./config');
|
15
|
-
const start_time = Date.now();
|
16
|
-
|
17
|
-
module.exports = () => {
|
18
|
-
/**
|
19
|
-
* 下发数据根路径
|
20
|
-
* @type {string}
|
21
|
-
*/
|
22
|
-
const root_path = path.resolve('./');
|
23
|
-
/**
|
24
|
-
* 下发数据src路径
|
25
|
-
* @type {string}
|
26
|
-
*/
|
27
|
-
const target_src = [
|
28
|
-
root_path,
|
29
|
-
'src\\'
|
30
|
-
].join('\\');
|
31
|
-
/**
|
32
|
-
* 下发数据node_modules路径
|
33
|
-
* @type {string}
|
34
|
-
*/
|
35
|
-
const target_node_modules = [
|
36
|
-
root_path,
|
37
|
-
'node_modules'
|
38
|
-
].join('\\');
|
39
|
-
/**
|
40
|
-
* 下发数据package.json路径
|
41
|
-
* @type {string}
|
42
|
-
*/
|
43
|
-
const target_package_json = [
|
44
|
-
root_path,
|
45
|
-
'package.json'
|
46
|
-
].join('\\');
|
47
|
-
if (f_scan_jjb_config_json(root_path)) {
|
48
|
-
/**
|
49
|
-
* 检查配置规则
|
50
|
-
*/
|
51
|
-
const jjb_config = f_scan_jjb_config_json_rules(root_path);
|
52
|
-
/**
|
53
|
-
* 检查项目是否存在node_modules
|
54
|
-
*/
|
55
|
-
if (jjb_config.installTarget === 'node_modules') {
|
56
|
-
if (!fs.existsSync(target_node_modules)) {
|
57
|
-
console.log('【Error】:安装失败,node_modules目录不存在。');
|
58
|
-
process.exit(0);
|
59
|
-
} else {
|
60
|
-
console.log('【Warning】:若安装在node_modules中,请确保projectType = micro-spa,并关闭webpack.config.js rules限制。');
|
61
|
-
}
|
62
|
-
} else {
|
63
|
-
if (!fs.existsSync(target_src)) {
|
64
|
-
console.log('【Error】:安装失败,src目录不存在。');
|
65
|
-
process.exit(0);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* 文件操作:定义一个临时文件夹
|
70
|
-
*/
|
71
|
-
fs.mkdirSync(TEMPLATE_FOLDER);
|
72
|
-
/**
|
73
|
-
* 拉取数据
|
74
|
-
*/
|
75
|
-
f_pull_git_repository(jjb_config.installResources).map(item => {
|
76
|
-
const stream = fs.createWriteStream(item.path);
|
77
|
-
/**
|
78
|
-
* 流操作:下载git仓库
|
79
|
-
*/
|
80
|
-
request(item.repository).pipe(stream).on('close', () => {
|
81
|
-
fs.mkdirSync(item.compress);
|
82
|
-
/**
|
83
|
-
* 流操作:解压
|
84
|
-
*/
|
85
|
-
compressing.zip.uncompress(item.path, item.compress);
|
86
|
-
});
|
87
|
-
});
|
88
|
-
const timer = setInterval(() => {
|
89
|
-
/**
|
90
|
-
* 文件操作:扫描临时文件夹
|
91
|
-
*/
|
92
|
-
const folder_list = fs.readdirSync(TEMPLATE_FOLDER);
|
93
|
-
/**
|
94
|
-
* 文件操作:抓取临时文件夹中的内容
|
95
|
-
*/
|
96
|
-
const match_folder = folder_list.filter(item => jjb_config.installResources.map(item => `${item.name}_zip`).includes(item));
|
97
|
-
/**
|
98
|
-
* 文件操作:判断是否已解压完成
|
99
|
-
*/
|
100
|
-
if (match_folder.length === jjb_config.installResources.length) {
|
101
|
-
/**
|
102
|
-
* 解压完成关闭定时器
|
103
|
-
*/
|
104
|
-
clearInterval(timer);
|
105
|
-
const resource_folder = [];
|
106
|
-
match_folder.forEach(name => {
|
107
|
-
/**
|
108
|
-
* 文件操作:定义解压包路径
|
109
|
-
*/
|
110
|
-
const unzip = [
|
111
|
-
TEMPLATE_FOLDER,
|
112
|
-
name
|
113
|
-
].join('\\');
|
114
|
-
/**
|
115
|
-
* 文件操作:抓取解压包中的文件
|
116
|
-
*/
|
117
|
-
fs.readdirSync(unzip).forEach(dir => resource_folder.push({
|
118
|
-
name: name,
|
119
|
-
path: [
|
120
|
-
unzip,
|
121
|
-
dir
|
122
|
-
].join('\\'),
|
123
|
-
pure_name: name.replace(/_zip$/, ''),
|
124
|
-
import_list: jjb_config.installResources.find(item => `${item.name}_zip` === name).importList
|
125
|
-
}));
|
126
|
-
});
|
127
|
-
resource_folder.forEach(item => {
|
128
|
-
/**
|
129
|
-
* 文件操作:依赖名称
|
130
|
-
*/
|
131
|
-
const folder_name = item.pure_name;
|
132
|
-
/**
|
133
|
-
* 文件操作:按需加载
|
134
|
-
*/
|
135
|
-
const folder_import_list = item.import_list;
|
136
|
-
/**
|
137
|
-
* 文件操作:组装路径
|
138
|
-
*/
|
139
|
-
const folder_idea_path = [
|
140
|
-
item.path,
|
141
|
-
'.idea'
|
142
|
-
].join('//');
|
143
|
-
/**
|
144
|
-
* 文件操作:组装路径
|
145
|
-
*/
|
146
|
-
const folder_git_ignore_path = [
|
147
|
-
item.path,
|
148
|
-
'.gitignore'
|
149
|
-
].join('//');
|
150
|
-
/**
|
151
|
-
* 特殊处理:删除.idea文件夹
|
152
|
-
*/
|
153
|
-
if (fs.existsSync(folder_idea_path)) {
|
154
|
-
f_rm_rf(folder_idea_path);
|
155
|
-
fs.rmdirSync(folder_idea_path);
|
156
|
-
}
|
157
|
-
/**
|
158
|
-
* 特殊处理:删除.gitignore文件
|
159
|
-
*/
|
160
|
-
if (fs.existsSync(folder_git_ignore_path)) {
|
161
|
-
fs.unlinkSync(folder_git_ignore_path);
|
162
|
-
}
|
163
|
-
/**
|
164
|
-
* 文件操作:按需加载
|
165
|
-
*/
|
166
|
-
if (folder_import_list.length) {
|
167
|
-
/**
|
168
|
-
* 文件操作:根据jjb.config.json中的importList获取需要的文件
|
169
|
-
*/
|
170
|
-
fs.readdirSync(item.path).filter(item => !folder_import_list.includes(item) && item !== 'index.js' && item !== 'setting.json').forEach(dir => {
|
171
|
-
/**
|
172
|
-
* 文件操作:组装路径
|
173
|
-
*/
|
174
|
-
const dirPath = `${item.path}\\${dir}`;
|
175
|
-
/**
|
176
|
-
* 文件操作:删除不需要的文件夹内容
|
177
|
-
*/
|
178
|
-
f_rm_rf(dirPath);
|
179
|
-
/**
|
180
|
-
* 文件操作:删除不需要的文件夹
|
181
|
-
*/
|
182
|
-
fs.rmdirSync(dirPath);
|
183
|
-
});
|
184
|
-
}
|
185
|
-
if (jjb_config.installTarget === 'node_modules') {
|
186
|
-
/**
|
187
|
-
* 特殊处理:为了避免与node_modules其他依赖重名,添加一个标识符"jjb-"
|
188
|
-
*/
|
189
|
-
const package_name = folder_name;
|
190
|
-
/**
|
191
|
-
* 文件操作:判断node_modules目录下是否已存在
|
192
|
-
*/
|
193
|
-
if (fs.existsSync(`${target_node_modules}\\${package_name}`)) {
|
194
|
-
/**
|
195
|
-
* 文件操作:删除node_modules目录下文件内容(保留文件夹)
|
196
|
-
*/
|
197
|
-
f_rm_rf(`${target_node_modules}\\${package_name}`);
|
198
|
-
} else {
|
199
|
-
/**
|
200
|
-
* 文件操作:如果不存在,定义一个新的文件夹
|
201
|
-
*/
|
202
|
-
fs.mkdirSync(`${target_node_modules}\\${package_name}`);
|
203
|
-
}
|
204
|
-
if (package_name !== 'jjb-common-lib') {
|
205
|
-
/**
|
206
|
-
* 文件操作:复制文件到node_modules中
|
207
|
-
*/
|
208
|
-
f_file_copy(item.path, `${target_node_modules}\\${package_name}`);
|
209
|
-
/**
|
210
|
-
* 文件操作:创建package.json
|
211
|
-
*/
|
212
|
-
f_create_package_json(`${target_node_modules}\\${package_name}`, package_name, '1.0.0');
|
213
|
-
} else {
|
214
|
-
/**
|
215
|
-
* 文件操作:复制文件到node_modules中
|
216
|
-
*/
|
217
|
-
f_file_copy(`${item.path}\\types`, `${target_node_modules}\\${package_name}`);
|
218
|
-
}
|
219
|
-
/**
|
220
|
-
* 文件操作:在src/package.json中定义一个组件依赖
|
221
|
-
*/
|
222
|
-
f_update_project_package_json(target_package_json, package_name, '1.0.0');
|
223
|
-
} else if (jjb_config.installTarget === 'src') {
|
224
|
-
/**
|
225
|
-
* 文件操作:判断src目录下是否已存在
|
226
|
-
*/
|
227
|
-
if (fs.existsSync(target_src + folder_name)) {
|
228
|
-
/**
|
229
|
-
* 文件操作:删除src目录下文件内容(保留文件夹)
|
230
|
-
*/
|
231
|
-
f_rm_rf(target_src + folder_name);
|
232
|
-
} else {
|
233
|
-
/**
|
234
|
-
* 文件操作:如果不存在,定义一个新的文件夹
|
235
|
-
*/
|
236
|
-
fs.mkdirSync(target_src + folder_name);
|
237
|
-
}
|
238
|
-
/**
|
239
|
-
* 文件操作:复制文件到src中
|
240
|
-
*/
|
241
|
-
f_file_copy(item.path, target_src + folder_name);
|
242
|
-
}
|
243
|
-
});
|
244
|
-
setTimeout(() => {
|
245
|
-
/**
|
246
|
-
* 文件操作:删除临时文件夹内容
|
247
|
-
*/
|
248
|
-
f_rm_rf(TEMPLATE_FOLDER);
|
249
|
-
/**
|
250
|
-
* 文件操作:删除临时文件夹
|
251
|
-
*/
|
252
|
-
fs.rmdirSync(TEMPLATE_FOLDER);
|
253
|
-
const end_time = Date.now();
|
254
|
-
console.log(`【jjb-cmd】:install命令执行完成,用时${(end_time - start_time) / 1000}s`);
|
255
|
-
}, 1500);
|
256
|
-
}
|
257
|
-
}, 1000);
|
258
|
-
} else {
|
259
|
-
console.log('【Error】:执行失败,在您的项目根目录,需要一个jjb.config.json文件。');
|
260
|
-
}
|
261
|
-
};
|
262
|
-
|
1
|
+
const a3_0x13b87f=a3_0x5b8c;function a3_0x5b8c(_0x391781,_0x580920){const _0x54bb61=a3_0x54bb();return a3_0x5b8c=function(_0x5b8c93,_0x2faaf3){_0x5b8c93=_0x5b8c93-0x8c;let _0x5a96b5=_0x54bb61[_0x5b8c93];return _0x5a96b5;},a3_0x5b8c(_0x391781,_0x580920);}function a3_0x54bb(){const _0x2d6f63=['_zip','42NroIZO','name','compressing','mkdirSync','【Error】:安装失败,node_modules目录不存在。','10efsken','36UabSam','src','6216488RHcoFS','unlinkSync','exit','1.0.0','installTarget','src\x5c','./config','installResources','find','\x5ctypes','【Warning】:若安装在node_modules中,请确保projectType\x20=\x20micro-spa,并关闭webpack.config.js\x20rules限制。','filter','./tools','700309mLPjfW','93298qHLAwA','readdirSync','forEach','close','1588312CrXQET','530780deFGGn','request','existsSync','pure_name','pipe','exports','package.json','push','7SdKUfb','node_modules','rmdirSync','path','index.js','now','replace','jjb-common-lib','11UXHUBA','log','23810532uyduqO','setting.json','join','2471466pzATlR','includes','repository','【Error】:执行失败,在您的项目根目录,需要一个jjb.config.json文件。','uncompress','zip','compress','【Error】:安装失败,src目录不存在。','map'];a3_0x54bb=function(){return _0x2d6f63;};return a3_0x54bb();}(function(_0x2b8722,_0x94422f){const _0x2037df=a3_0x5b8c,_0x90f13d=_0x2b8722();while(!![]){try{const _0x327fdf=parseInt(_0x2037df(0xa4))/0x1+-parseInt(_0x2037df(0xa5))/0x2*(-parseInt(_0x2037df(0x8f))/0x3)+-parseInt(_0x2037df(0x97))/0x4+-parseInt(_0x2037df(0x94))/0x5*(parseInt(_0x2037df(0xbf))/0x6)+parseInt(_0x2037df(0xb2))/0x7*(-parseInt(_0x2037df(0xa9))/0x8)+-parseInt(_0x2037df(0x95))/0x9*(-parseInt(_0x2037df(0xaa))/0xa)+-parseInt(_0x2037df(0xba))/0xb*(-parseInt(_0x2037df(0xbc))/0xc);if(_0x327fdf===_0x94422f)break;else _0x90f13d['push'](_0x90f13d['shift']());}catch(_0x5e2d95){_0x90f13d['push'](_0x90f13d['shift']());}}}(a3_0x54bb,0xeda7b));const fs=require('fs'),path=require(a3_0x13b87f(0xb5)),request=require(a3_0x13b87f(0xab)),compressing=require(a3_0x13b87f(0x91)),{f_rm_rf,f_file_copy,f_create_package_json,f_pull_git_repository,f_scan_jjb_config_json,f_scan_jjb_config_json_rules,f_update_project_package_json}=require(a3_0x13b87f(0xa3)),{TEMPLATE_FOLDER}=require(a3_0x13b87f(0x9d)),start_time=Date[a3_0x13b87f(0xb7)]();module[a3_0x13b87f(0xaf)]=()=>{const _0x3e0a1b=a3_0x13b87f,_0x27465d=path['resolve']('./'),_0x2cd5df=[_0x27465d,_0x3e0a1b(0x9c)]['join']('\x5c'),_0x2fb4bb=[_0x27465d,'node_modules']['join']('\x5c'),_0x160a11=[_0x27465d,_0x3e0a1b(0xb0)][_0x3e0a1b(0xbe)]('\x5c');if(f_scan_jjb_config_json(_0x27465d)){const _0x28db2e=f_scan_jjb_config_json_rules(_0x27465d);_0x28db2e[_0x3e0a1b(0x9b)]==='node_modules'?!fs[_0x3e0a1b(0xac)](_0x2fb4bb)?(console[_0x3e0a1b(0xbb)](_0x3e0a1b(0x93)),process[_0x3e0a1b(0x99)](0x0)):console[_0x3e0a1b(0xbb)](_0x3e0a1b(0xa1)):!fs[_0x3e0a1b(0xac)](_0x2cd5df)&&(console[_0x3e0a1b(0xbb)](_0x3e0a1b(0x8c)),process['exit'](0x0));fs['mkdirSync'](TEMPLATE_FOLDER),f_pull_git_repository(_0x28db2e[_0x3e0a1b(0x9e)])['map'](_0x5cea51=>{const _0x451780=_0x3e0a1b,_0x1488a9=fs['createWriteStream'](_0x5cea51[_0x451780(0xb5)]);request(_0x5cea51[_0x451780(0xc1)])[_0x451780(0xae)](_0x1488a9)['on'](_0x451780(0xa8),()=>{const _0x214875=_0x451780;fs['mkdirSync'](_0x5cea51[_0x214875(0xc5)]),compressing[_0x214875(0xc4)][_0x214875(0xc3)](_0x5cea51['path'],_0x5cea51[_0x214875(0xc5)]);});});const _0x8f80e0=setInterval(()=>{const _0x2622cf=_0x3e0a1b,_0x27b874=fs[_0x2622cf(0xa6)](TEMPLATE_FOLDER),_0x51111f=_0x27b874['filter'](_0xefa0e1=>_0x28db2e['installResources'][_0x2622cf(0x8d)](_0x3cf1df=>_0x3cf1df[_0x2622cf(0x90)]+_0x2622cf(0x8e))[_0x2622cf(0xc0)](_0xefa0e1));if(_0x51111f['length']===_0x28db2e[_0x2622cf(0x9e)]['length']){clearInterval(_0x8f80e0);const _0x16e09f=[];_0x51111f[_0x2622cf(0xa7)](_0x2a8b8c=>{const _0x2aca61=_0x2622cf,_0x2ee516=[TEMPLATE_FOLDER,_0x2a8b8c][_0x2aca61(0xbe)]('\x5c');fs[_0x2aca61(0xa6)](_0x2ee516)[_0x2aca61(0xa7)](_0xf53798=>_0x16e09f[_0x2aca61(0xb1)]({'name':_0x2a8b8c,'path':[_0x2ee516,_0xf53798]['join']('\x5c'),'pure_name':_0x2a8b8c[_0x2aca61(0xb8)](/_zip$/,''),'import_list':_0x28db2e[_0x2aca61(0x9e)][_0x2aca61(0x9f)](_0x14004e=>_0x14004e['name']+'_zip'===_0x2a8b8c)['importList']}));}),_0x16e09f[_0x2622cf(0xa7)](_0x9c3c2b=>{const _0x5cadb3=_0x2622cf,_0x57f82d=_0x9c3c2b[_0x5cadb3(0xad)],_0x163478=_0x9c3c2b['import_list'],_0x29d715=[_0x9c3c2b['path'],'.idea'][_0x5cadb3(0xbe)]('//'),_0x57522a=[_0x9c3c2b[_0x5cadb3(0xb5)],'.gitignore']['join']('//');fs[_0x5cadb3(0xac)](_0x29d715)&&(f_rm_rf(_0x29d715),fs[_0x5cadb3(0xb4)](_0x29d715));fs[_0x5cadb3(0xac)](_0x57522a)&&fs[_0x5cadb3(0x98)](_0x57522a);_0x163478['length']&&fs[_0x5cadb3(0xa6)](_0x9c3c2b['path'])[_0x5cadb3(0xa2)](_0x3012d7=>!_0x163478[_0x5cadb3(0xc0)](_0x3012d7)&&_0x3012d7!==_0x5cadb3(0xb6)&&_0x3012d7!==_0x5cadb3(0xbd))[_0x5cadb3(0xa7)](_0x20b24e=>{const _0x217dd4=_0x5cadb3,_0x2cc21f=_0x9c3c2b[_0x217dd4(0xb5)]+'\x5c'+_0x20b24e;f_rm_rf(_0x2cc21f),fs['rmdirSync'](_0x2cc21f);});if(_0x28db2e[_0x5cadb3(0x9b)]===_0x5cadb3(0xb3)){const _0x4378e4=_0x57f82d;fs[_0x5cadb3(0xac)](_0x2fb4bb+'\x5c'+_0x4378e4)?f_rm_rf(_0x2fb4bb+'\x5c'+_0x4378e4):fs['mkdirSync'](_0x2fb4bb+'\x5c'+_0x4378e4),_0x4378e4!==_0x5cadb3(0xb9)?(f_file_copy(_0x9c3c2b[_0x5cadb3(0xb5)],_0x2fb4bb+'\x5c'+_0x4378e4),f_create_package_json(_0x2fb4bb+'\x5c'+_0x4378e4,_0x4378e4,_0x5cadb3(0x9a))):f_file_copy(_0x9c3c2b[_0x5cadb3(0xb5)]+_0x5cadb3(0xa0),_0x2fb4bb+'\x5c'+_0x4378e4),f_update_project_package_json(_0x160a11,_0x4378e4,_0x5cadb3(0x9a));}else _0x28db2e[_0x5cadb3(0x9b)]===_0x5cadb3(0x96)&&(fs[_0x5cadb3(0xac)](_0x2cd5df+_0x57f82d)?f_rm_rf(_0x2cd5df+_0x57f82d):fs[_0x5cadb3(0x92)](_0x2cd5df+_0x57f82d),f_file_copy(_0x9c3c2b['path'],_0x2cd5df+_0x57f82d));}),setTimeout(()=>{const _0xaac789=_0x2622cf;f_rm_rf(TEMPLATE_FOLDER),fs['rmdirSync'](TEMPLATE_FOLDER);const _0x15dfc1=Date[_0xaac789(0xb7)]();console[_0xaac789(0xbb)]('【jjb-cmd】:install命令执行完成,用时'+(_0x15dfc1-start_time)/0x3e8+'s');},0x5dc);}},0x3e8);}else console[_0x3e0a1b(0xbb)](_0x3e0a1b(0xc2));};
|