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 CHANGED
@@ -1,6 +1,14 @@
1
1
  <h1>重庆市建教帮科技有限公司-前端脚手架</h1>
2
2
  <h3>更新日志:</h3>
3
3
  <ul>
4
+ <li>
5
+ <p>2.2.5</p>
6
+ <div>修复已知问题</div>
7
+ </li>
8
+ <li>
9
+ <p>2.2.4</p>
10
+ <div>push java支持更多参数</div>
11
+ </li>
4
12
  <li>
5
13
  <p>2.2.3</p>
6
14
  <div>修复已知问题</div>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "jjb-cmd",
3
3
  "use": "no",
4
4
  "env": "prod",
5
- "version": "2.2.3",
5
+ "version": "2.2.5",
6
6
  "description": "jjb脚手架工具",
7
7
  "main": "index.js",
8
8
  "scripts": {
@@ -1,26 +1 @@
1
- const axios = require("axios");
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
+ function a0_0x4e47(_0x1a3e38,_0x1067aa){const _0x23ed82=a0_0x23ed();return a0_0x4e47=function(_0x4e4736,_0x5ad9e9){_0x4e4736=_0x4e4736-0x69;let _0x3f51b6=_0x23ed82[_0x4e4736];return _0x3f51b6;},a0_0x4e47(_0x1a3e38,_0x1067aa);}const a0_0x58565b=a0_0x4e47;(function(_0x5c1f53,_0x1e7c23){const _0x2c027b=a0_0x4e47,_0x2ee558=_0x5c1f53();while(!![]){try{const _0x36c651=parseInt(_0x2c027b(0x7a))/0x1+-parseInt(_0x2c027b(0x6e))/0x2*(parseInt(_0x2c027b(0x70))/0x3)+parseInt(_0x2c027b(0x7f))/0x4*(-parseInt(_0x2c027b(0x80))/0x5)+parseInt(_0x2c027b(0x76))/0x6+-parseInt(_0x2c027b(0x7d))/0x7*(-parseInt(_0x2c027b(0x6c))/0x8)+parseInt(_0x2c027b(0x72))/0x9+-parseInt(_0x2c027b(0x77))/0xa;if(_0x36c651===_0x1e7c23)break;else _0x2ee558['push'](_0x2ee558['shift']());}catch(_0x54d3d0){_0x2ee558['push'](_0x2ee558['shift']());}}}(a0_0x23ed,0x21877));const axios=require('axios'),fs=require('fs'),path=require('path'),{getApiHost}=require(a0_0x58565b(0x7b));module[a0_0x58565b(0x6f)]=_0x1b1554=>{const _0x550df7=a0_0x58565b;console[_0x550df7(0x73)](_0x1b1554);const [_0x50c541,_0x29d10c]=_0x1b1554;axios[_0x550df7(0x78)](getApiHost()+'/api/auth',{'username':_0x50c541,'password':_0x29d10c})[_0x550df7(0x6d)](_0x280a4a=>{const _0xf1e44b=_0x550df7,_0x2633d5=path['join'](__dirname,_0xf1e44b(0x75));_0x280a4a[_0xf1e44b(0x79)][_0xf1e44b(0x6b)]?(console['log'](_0xf1e44b(0x74)),fs[_0xf1e44b(0x6a)](_0x2633d5,_0x50c541+'/'+_0x29d10c)):(console[_0xf1e44b(0x73)](_0xf1e44b(0x69)),fs['existsSync'](_0x2633d5)&&fs[_0xf1e44b(0x7c)](_0x2633d5));})[_0x550df7(0x7e)](_0x4452e4=>{const _0x19bb00=_0x550df7;console[_0x19bb00(0x73)](_0x19bb00(0x71));});};function a0_0x23ed(){const _0x35075e=['14HXKfQs','catch','474316wWdWyK','5oweBEJ','Auth\x20Fail!','writeFileSync','status','881072PwSgDk','then','2muAxwq','exports','129714eALleh','Auth\x20NetWork\x20Fail!','1802358Wjzhat','log','Auth\x20Success!','../../../.auth','59382SWOvCi','2620700VsDLei','post','data','130795MNcqxb','../cmd.install/config','unlinkSync'];a0_0x23ed=function(){return _0x35075e;};return a0_0x23ed();}
@@ -1,116 +1 @@
1
- const fs = require('fs');
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
+ function a1_0x3997(){const _0x5efad6=['433644EtOmFO','.zip','12443112DGKnCs','4047243qZmVbw','安装中,请耐心等待...','readline','log','jjb-cmd\x20install.app\x20','path','/repository/archive.zip?private_token=','close','/unzip/','resolve','forEach','mkdirSync','createInterface','../cmd.install/config','278mKUTDu','9257RPMpNt','初始化完成?请选择安装方式![yarn/npm]:','../../old/util','安装完成,祝您愉快编码!','child_process','compressing','execSync','createWriteStream','trim','projectId','readdirSync','11219873PwTvGB','npm','60ORXYVl','10hXyKHg','exit','question','初始化完成!请自行使用jjb-cmd\x20install.app\x20yarn/npm安装项目!','4QCYDTa','/api/v4/projects/','exports','stdin','38976IjOYXQ','includes','53383476PzTeOR','3195qVQbQN'];a1_0x3997=function(){return _0x5efad6;};return a1_0x3997();}function a1_0x22ea(_0x1f66a4,_0x55ac19){const _0x399766=a1_0x3997();return a1_0x22ea=function(_0x22ea4a,_0xed6875){_0x22ea4a=_0x22ea4a-0x12b;let _0x41bb03=_0x399766[_0x22ea4a];return _0x41bb03;},a1_0x22ea(_0x1f66a4,_0x55ac19);}const a1_0x3947c3=a1_0x22ea;(function(_0x55cec9,_0x2ec8ad){const _0x2c2333=a1_0x22ea,_0x272ab9=_0x55cec9();while(!![]){try{const _0x3bc7b6=-parseInt(_0x2c2333(0x13a))/0x1*(parseInt(_0x2c2333(0x139))/0x2)+parseInt(_0x2c2333(0x12b))/0x3*(parseInt(_0x2c2333(0x14c))/0x4)+-parseInt(_0x2c2333(0x147))/0x5*(-parseInt(_0x2c2333(0x154))/0x6)+-parseInt(_0x2c2333(0x145))/0x7+-parseInt(_0x2c2333(0x150))/0x8*(parseInt(_0x2c2333(0x153))/0x9)+parseInt(_0x2c2333(0x148))/0xa*(-parseInt(_0x2c2333(0x156))/0xb)+parseInt(_0x2c2333(0x152))/0xc;if(_0x3bc7b6===_0x2ec8ad)break;else _0x272ab9['push'](_0x272ab9['shift']());}catch(_0x74b4d8){_0x272ab9['push'](_0x272ab9['shift']());}}}(a1_0x3997,0xdf4f6));const fs=require('fs'),os=require('os'),path=require(a1_0x3947c3(0x130)),request=require('request'),utils=require(a1_0x3947c3(0x13c)),compressing=require(a1_0x3947c3(0x13f)),readline=require(a1_0x3947c3(0x12d)),io=readline[a1_0x3947c3(0x137)]({'input':process[a1_0x3947c3(0x14f)],'output':process['stdout']}),child_process=require(a1_0x3947c3(0x13e)),{CLOUD_PROJECT,GIT_TEMP_DIR,GIT_HOST}=require(a1_0x3947c3(0x138));module[a1_0x3947c3(0x14e)]=_0x52ba74=>{const _0x1e7700=a1_0x3947c3,_0x2a8264=path[_0x1e7700(0x134)]('./'),_0xc1ef31=CLOUD_PROJECT[_0x52ba74]||undefined;if(_0xc1ef31){const _0x29a757=os['tmpdir'](),_0x178af9=_0x29a757+'/'+GIT_TEMP_DIR+'/'+_0x52ba74+_0x1e7700(0x155),_0x2009f9=_0x29a757+'/'+GIT_TEMP_DIR+_0x1e7700(0x133);utils['DeleteDirAllFile'](_0x29a757+'/'+GIT_TEMP_DIR,()=>{const _0x1bd9d8=_0x1e7700;fs[_0x1bd9d8(0x136)](_0x29a757+'/'+GIT_TEMP_DIR);let _0x3a4049=fs[_0x1bd9d8(0x141)](_0x178af9);request(GIT_HOST+_0x1bd9d8(0x14d)+_0xc1ef31[_0x1bd9d8(0x143)]+_0x1bd9d8(0x131)+_0xc1ef31['token']+'&ref=master')['pipe'](_0x3a4049)['on'](_0x1bd9d8(0x132),()=>{const _0x4460bf=_0x1bd9d8;fs[_0x4460bf(0x136)](_0x2009f9),compressing['zip']['uncompress'](_0x178af9,_0x2009f9)['then'](()=>{setTimeout(()=>{const _0x5a7fb4=a1_0x22ea;fs[_0x5a7fb4(0x144)](_0x2009f9)[_0x5a7fb4(0x135)](_0x53cde9=>{_0x53cde9['indexOf']('-master-')!==-0x1&&utils['CopyFolder'](_0x2009f9+_0x53cde9,_0x2a8264,()=>{const _0x4ec164=a1_0x22ea;io[_0x4ec164(0x14a)](_0x4ec164(0x13b),function(_0x1652c7){const _0x1757a8=_0x4ec164;['yarn',_0x1757a8(0x146)][_0x1757a8(0x151)](_0x1652c7['trim']())?(console[_0x1757a8(0x12e)](_0x1757a8(0x12c)),child_process[_0x1757a8(0x140)](_0x1757a8(0x12f)+_0x1652c7[_0x1757a8(0x142)](),{'cwd':_0x2a8264}),console[_0x1757a8(0x12e)](_0x1757a8(0x13d)),process[_0x1757a8(0x149)](0x0)):(console[_0x1757a8(0x12e)](_0x1757a8(0x14b)),process[_0x1757a8(0x149)](0x0));});});});},0x7d0);});});});}else console[_0x1e7700(0x12e)]('【Error】:初始化失败,'+_0x52ba74+'不存在。');};
@@ -1,70 +1 @@
1
- const os = require('os');
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_0x13a9(_0x1d3f08,_0x51e00f){const _0x489e27=a2_0x489e();return a2_0x13a9=function(_0x13a95e,_0x1da491){_0x13a95e=_0x13a95e-0xd0;let _0x2d6ab8=_0x489e27[_0x13a95e];return _0x2d6ab8;},a2_0x13a9(_0x1d3f08,_0x51e00f);}const a2_0x3dc60f=a2_0x13a9;(function(_0x56f2e3,_0x1bc143){const _0xe8735a=a2_0x13a9,_0x5b063c=_0x56f2e3();while(!![]){try{const _0x23f561=-parseInt(_0xe8735a(0xde))/0x1+parseInt(_0xe8735a(0xe8))/0x2+-parseInt(_0xe8735a(0xed))/0x3+-parseInt(_0xe8735a(0xf3))/0x4*(parseInt(_0xe8735a(0xd6))/0x5)+parseInt(_0xe8735a(0xd7))/0x6+-parseInt(_0xe8735a(0xd9))/0x7+-parseInt(_0xe8735a(0xe1))/0x8*(-parseInt(_0xe8735a(0xd1))/0x9);if(_0x23f561===_0x1bc143)break;else _0x5b063c['push'](_0x5b063c['shift']());}catch(_0x2b60d3){_0x5b063c['push'](_0x5b063c['shift']());}}}(a2_0x489e,0x855ba));const os=require('os'),path=require(a2_0x3dc60f(0xe9)),fs=require('fs'),API_HOST=a2_0x3dc60f(0xe6),API_HOST_TEST=a2_0x3dc60f(0xef);function a2_0x489e(){const _0x46666b=['test','dev','1345UciYnu','3807768vwAsMo','d4wQ7dzEjYPsgVbKnYei','3586023lQvjNq','jjb-assembly-java','toString','GIT_TEMP_DIR','snBxJ2i5kYarGGcsojhY','148035vVksyJ','now','CLOUD_PROJECT','24Drwukd','env','hLqARY89CN6fUD3yg4NL','ywPtT3xCG6b_vAxp6sTj','API_HOST_TEST','http://120.26.210.58:8088','getApiHost','1490774uevZES','path','../../../package.json','GIT_HOST','G4HJRsHr9D7Ssmixegw2','476292hbiGfy','e9njpBd1nS_LREN8GFpR','http://120.26.210.58:8089','join','FqNrmFAgrxasMrbbjvq9','http://192.168.1.242:10985','8392DUkdlp','prod','GIT_TEMP_JAVA','1649007VIPCLH','TEMPLATE_FOLDER','GIT_JAVA_ENV_JSON'];a2_0x489e=function(){return _0x46666b;};return a2_0x489e();}exports['CONFIG_FILE_HOST']='https://cdn.cqjjb.cn/jjb-cloud-config',exports['API_HOST']=API_HOST,exports[a2_0x3dc60f(0xe5)]=API_HOST_TEST,exports[a2_0x3dc60f(0xeb)]=a2_0x3dc60f(0xf2),exports[a2_0x3dc60f(0xdc)]='jjb-assembly-'+Date[a2_0x3dc60f(0xdf)](),exports[a2_0x3dc60f(0xd0)]=a2_0x3dc60f(0xda),exports[a2_0x3dc60f(0xd3)]={'development':a2_0x3dc60f(0xd5),'production':a2_0x3dc60f(0xf4),'test':a2_0x3dc60f(0xd4)},exports[a2_0x3dc60f(0xe0)]={'common':{'token':a2_0x3dc60f(0xec),'projectId':0x117},'react-admin-component':{'token':'FT3pKzxpRynFkmddJ9Bs','projectId':0x154},'jjb-dva-runtime':{'token':a2_0x3dc60f(0xe3),'projectId':0x23b},'jjb-common-lib':{'token':a2_0x3dc60f(0xee),'projectId':0x23c},'jjb-common-decorator':{'token':'gPSit8aJsLVmNzuQ5Cy4','projectId':0x23e},'vue-unisass-component':{'token':a2_0x3dc60f(0xd8),'projectId':0x153},'react-component':{'token':a2_0x3dc60f(0xdd),'projectId':0x33f},'micro-app-ts':{'token':'7V-YUxhmh51Mdhgx4rq4','projectId':0x33e},'micro-app':{'token':a2_0x3dc60f(0xf1),'projectId':0x33d},'lib':{'token':a2_0x3dc60f(0xe4),'projectId':0x33c}},exports[a2_0x3dc60f(0xd2)]=os['tmpdir']()+'\x5c'+exports['GIT_TEMP_DIR'],exports[a2_0x3dc60f(0xe7)]=()=>{const _0x4107c4=a2_0x3dc60f,_0x1ee9ae=JSON['parse'](fs['readFileSync'](path[_0x4107c4(0xf0)](__dirname,_0x4107c4(0xea)))[_0x4107c4(0xdb)]());return _0x1ee9ae[_0x4107c4(0xe2)]==='test'?API_HOST_TEST:API_HOST;};
@@ -1,262 +1 @@
1
- const fs = require('fs');
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_0x2eea7f=a3_0x335d;function a3_0x1b98(){const _0x4d67fd=['compressing','log','【Error】:执行失败,在您的项目根目录,需要一个jjb.config.json文件。','path','1106049ulOtwE','_zip','resolve','989735uKvAss','package.json','pipe','installResources','rmdirSync','./tools','readdirSync','existsSync','importList','now','installTarget','setting.json','src','【Error】:安装失败,src目录不存在。','1397TWCHAb','filter','\x5ctypes','join','createWriteStream','130090UAhNvo','node_modules','uncompress','2789675sAwWBk','2475222NTcQUK','zip','.idea','map','8dktqVe','length','【Error】:安装失败,node_modules目录不存在。','forEach','unlinkSync','exit','126nlPHWv','find','15344kSyUQD','【jjb-cmd】:install命令执行完成,用时','mkdirSync','src\x5c','index.js','1.0.0','257835hKbxKk','2TbRuYf','replace','jjb-common-lib','includes','push','request','repository','exports','pure_name','./config','compress'];a3_0x1b98=function(){return _0x4d67fd;};return a3_0x1b98();}function a3_0x335d(_0x3b8c0e,_0x2d2438){const _0x1b98a5=a3_0x1b98();return a3_0x335d=function(_0x335d22,_0x512517){_0x335d22=_0x335d22-0x1da;let _0x486c0f=_0x1b98a5[_0x335d22];return _0x486c0f;},a3_0x335d(_0x3b8c0e,_0x2d2438);}(function(_0x2a9ca3,_0x5177aa){const _0x32b755=a3_0x335d,_0x5c84a2=_0x2a9ca3();while(!![]){try{const _0x2350df=parseInt(_0x32b755(0x1ed))/0x1*(-parseInt(_0x32b755(0x1ee))/0x2)+parseInt(_0x32b755(0x1fd))/0x3+parseInt(_0x32b755(0x1df))/0x4*(-parseInt(_0x32b755(0x200))/0x5)+-parseInt(_0x32b755(0x1db))/0x6+-parseInt(_0x32b755(0x1da))/0x7+parseInt(_0x32b755(0x1e7))/0x8*(-parseInt(_0x32b755(0x1e5))/0x9)+-parseInt(_0x32b755(0x213))/0xa*(-parseInt(_0x32b755(0x20e))/0xb);if(_0x2350df===_0x5177aa)break;else _0x5c84a2['push'](_0x5c84a2['shift']());}catch(_0x2f058a){_0x5c84a2['push'](_0x5c84a2['shift']());}}}(a3_0x1b98,0x8131f));const fs=require('fs'),path=require(a3_0x2eea7f(0x1fc)),request=require(a3_0x2eea7f(0x1f3)),compressing=require(a3_0x2eea7f(0x1f9)),{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_0x2eea7f(0x205)),{TEMPLATE_FOLDER}=require(a3_0x2eea7f(0x1f7)),start_time=Date[a3_0x2eea7f(0x209)]();module[a3_0x2eea7f(0x1f5)]=()=>{const _0x2c1b5f=a3_0x2eea7f,_0x22a082=path[_0x2c1b5f(0x1ff)]('./'),_0xa37b62=[_0x22a082,_0x2c1b5f(0x1ea)][_0x2c1b5f(0x211)]('\x5c'),_0x1d4c5=[_0x22a082,_0x2c1b5f(0x214)][_0x2c1b5f(0x211)]('\x5c'),_0x48f7e3=[_0x22a082,_0x2c1b5f(0x201)]['join']('\x5c');if(f_scan_jjb_config_json(_0x22a082)){const _0x28471a=f_scan_jjb_config_json_rules(_0x22a082);_0x28471a[_0x2c1b5f(0x20a)]===_0x2c1b5f(0x214)?!fs[_0x2c1b5f(0x207)](_0x1d4c5)?(console[_0x2c1b5f(0x1fa)](_0x2c1b5f(0x1e1)),process[_0x2c1b5f(0x1e4)](0x0)):console[_0x2c1b5f(0x1fa)]('【Warning】:若安装在node_modules中,请确保projectType\x20=\x20micro-spa,并关闭webpack.config.js\x20rules限制。'):!fs[_0x2c1b5f(0x207)](_0xa37b62)&&(console['log'](_0x2c1b5f(0x20d)),process[_0x2c1b5f(0x1e4)](0x0));fs[_0x2c1b5f(0x1e9)](TEMPLATE_FOLDER),f_pull_git_repository(_0x28471a[_0x2c1b5f(0x203)])['map'](_0x1ad350=>{const _0x4ee255=_0x2c1b5f,_0x957312=fs[_0x4ee255(0x212)](_0x1ad350['path']);request(_0x1ad350[_0x4ee255(0x1f4)])[_0x4ee255(0x202)](_0x957312)['on']('close',()=>{const _0x861993=_0x4ee255;fs[_0x861993(0x1e9)](_0x1ad350[_0x861993(0x1f8)]),compressing[_0x861993(0x1dc)][_0x861993(0x215)](_0x1ad350[_0x861993(0x1fc)],_0x1ad350['compress']);});});const _0x7cef71=setInterval(()=>{const _0x2251b9=_0x2c1b5f,_0x4073e1=fs['readdirSync'](TEMPLATE_FOLDER),_0x21fad3=_0x4073e1[_0x2251b9(0x20f)](_0x1498a7=>_0x28471a['installResources'][_0x2251b9(0x1de)](_0x715994=>_0x715994['name']+_0x2251b9(0x1fe))['includes'](_0x1498a7));if(_0x21fad3[_0x2251b9(0x1e0)]===_0x28471a['installResources'][_0x2251b9(0x1e0)]){clearInterval(_0x7cef71);const _0x1ec1a2=[];_0x21fad3[_0x2251b9(0x1e2)](_0x5b361e=>{const _0x40af1c=_0x2251b9,_0x4dc9ed=[TEMPLATE_FOLDER,_0x5b361e]['join']('\x5c');fs[_0x40af1c(0x206)](_0x4dc9ed)['forEach'](_0x5d478f=>_0x1ec1a2[_0x40af1c(0x1f2)]({'name':_0x5b361e,'path':[_0x4dc9ed,_0x5d478f][_0x40af1c(0x211)]('\x5c'),'pure_name':_0x5b361e[_0x40af1c(0x1ef)](/_zip$/,''),'import_list':_0x28471a[_0x40af1c(0x203)][_0x40af1c(0x1e6)](_0x42f67c=>_0x42f67c['name']+_0x40af1c(0x1fe)===_0x5b361e)[_0x40af1c(0x208)]}));}),_0x1ec1a2[_0x2251b9(0x1e2)](_0x237752=>{const _0x2e0dc2=_0x2251b9,_0x3e8995=_0x237752[_0x2e0dc2(0x1f6)],_0x2447a6=_0x237752['import_list'],_0x505d7a=[_0x237752[_0x2e0dc2(0x1fc)],_0x2e0dc2(0x1dd)][_0x2e0dc2(0x211)]('//'),_0x10d7a4=[_0x237752[_0x2e0dc2(0x1fc)],'.gitignore'][_0x2e0dc2(0x211)]('//');fs[_0x2e0dc2(0x207)](_0x505d7a)&&(f_rm_rf(_0x505d7a),fs['rmdirSync'](_0x505d7a));fs[_0x2e0dc2(0x207)](_0x10d7a4)&&fs[_0x2e0dc2(0x1e3)](_0x10d7a4);_0x2447a6[_0x2e0dc2(0x1e0)]&&fs[_0x2e0dc2(0x206)](_0x237752[_0x2e0dc2(0x1fc)])[_0x2e0dc2(0x20f)](_0x170b44=>!_0x2447a6[_0x2e0dc2(0x1f1)](_0x170b44)&&_0x170b44!==_0x2e0dc2(0x1eb)&&_0x170b44!==_0x2e0dc2(0x20b))[_0x2e0dc2(0x1e2)](_0x11657e=>{const _0x2239a2=_0x2e0dc2,_0x413bae=_0x237752['path']+'\x5c'+_0x11657e;f_rm_rf(_0x413bae),fs[_0x2239a2(0x204)](_0x413bae);});if(_0x28471a[_0x2e0dc2(0x20a)]===_0x2e0dc2(0x214)){const _0x5c3303=_0x3e8995;fs[_0x2e0dc2(0x207)](_0x1d4c5+'\x5c'+_0x5c3303)?f_rm_rf(_0x1d4c5+'\x5c'+_0x5c3303):fs['mkdirSync'](_0x1d4c5+'\x5c'+_0x5c3303),_0x5c3303!==_0x2e0dc2(0x1f0)?(f_file_copy(_0x237752[_0x2e0dc2(0x1fc)],_0x1d4c5+'\x5c'+_0x5c3303),f_create_package_json(_0x1d4c5+'\x5c'+_0x5c3303,_0x5c3303,_0x2e0dc2(0x1ec))):f_file_copy(_0x237752['path']+_0x2e0dc2(0x210),_0x1d4c5+'\x5c'+_0x5c3303),f_update_project_package_json(_0x48f7e3,_0x5c3303,_0x2e0dc2(0x1ec));}else _0x28471a[_0x2e0dc2(0x20a)]===_0x2e0dc2(0x20c)&&(fs[_0x2e0dc2(0x207)](_0xa37b62+_0x3e8995)?f_rm_rf(_0xa37b62+_0x3e8995):fs['mkdirSync'](_0xa37b62+_0x3e8995),f_file_copy(_0x237752[_0x2e0dc2(0x1fc)],_0xa37b62+_0x3e8995));}),setTimeout(()=>{const _0x5e3361=_0x2251b9;f_rm_rf(TEMPLATE_FOLDER),fs['rmdirSync'](TEMPLATE_FOLDER);const _0x2ffee8=Date[_0x5e3361(0x209)]();console[_0x5e3361(0x1fa)](_0x5e3361(0x1e8)+(_0x2ffee8-start_time)/0x3e8+'s');},0x5dc);}},0x3e8);}else console[_0x2c1b5f(0x1fa)](_0x2c1b5f(0x1fb));};