zmp-cli 3.15.5 → 3.15.6-beta.1
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 +1 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/init-zmp-ui.js +1 -216
- package/create/templates/app-parameters.js +9 -25
- package/create/templates/common/webpack/build.js +2 -40
- package/create/templates/copy-assets.js +1 -158
- package/create/templates/core/copy-assets.js +14 -82
- package/create/templates/core/generate-home-page.js +16 -38
- package/create/templates/core/generate-root.js +28 -63
- package/create/templates/core/generate-routes.js +12 -38
- package/create/templates/core/generate-scripts.js +16 -65
- package/create/templates/create-folders.js +1 -30
- package/create/templates/generate-config-xml.js +2 -9
- package/create/templates/generate-index.js +10 -35
- package/create/templates/generate-manifest.js +1 -49
- package/create/templates/generate-recoil.js +4 -16
- package/create/templates/generate-routes.js +1 -16
- package/create/templates/generate-scripts.js +1 -16
- package/create/templates/generate-service-worker.js +4 -10
- package/create/templates/generate-store.js +4 -15
- package/create/templates/generate-styles.js +10 -64
- package/create/templates/generate-webpack-config.js +43 -125
- package/create/templates/generate-zmp-custom.js +14 -72
- package/create/templates/react/copy-assets.js +1 -85
- package/create/templates/react/generate-home-page.js +20 -50
- package/create/templates/react/generate-root.js +15 -44
- package/create/templates/react/generate-routes.js +1 -16
- package/create/templates/react/generate-scripts.js +12 -38
- package/create/templates/react/pages/404.js +2 -10
- package/create/templates/react/pages/about.js +2 -10
- package/create/templates/react/pages/catalog.js +3 -17
- package/create/templates/react/pages/dynamic-route.js +2 -10
- package/create/templates/react/pages/form.js +6 -26
- package/create/templates/react/pages/index copy.js +1 -17
- package/create/templates/react/pages/index.js +1 -17
- package/create/templates/react/pages/settings.js +3 -17
- package/create/templates/react/pages/user.js +8 -27
- package/create/templates/react-typescript/components/app-items.js +2 -9
- package/create/templates/react-typescript/components/index.js +1 -9
- package/create/templates/react-typescript/components/navbar-back.js +2 -9
- package/create/templates/react-typescript/components/user-card.js +2 -9
- package/create/templates/react-typescript/copy-assets.js +1 -94
- package/create/templates/react-typescript/generate-home-page.js +20 -52
- package/create/templates/react-typescript/generate-root.js +14 -45
- package/create/templates/react-typescript/generate-routes.js +1 -12
- package/create/templates/react-typescript/generate-scripts.js +12 -37
- package/create/templates/react-typescript/pages/404.js +2 -10
- package/create/templates/react-typescript/pages/about.js +2 -10
- package/create/templates/react-typescript/pages/catalog.js +3 -17
- package/create/templates/react-typescript/pages/dynamic-route.js +2 -10
- package/create/templates/react-typescript/pages/form.js +6 -26
- package/create/templates/react-typescript/pages/index.js +1 -17
- package/create/templates/react-typescript/pages/settings.js +3 -17
- package/create/templates/react-typescript/pages/user.js +8 -27
- package/create/templates/svelte/copy-assets.js +1 -47
- package/create/templates/svelte/generate-home-page.js +20 -56
- package/create/templates/svelte/generate-root.js +22 -80
- package/create/templates/svelte/generate-routes.js +7 -22
- package/create/templates/svelte/generate-scripts.js +7 -23
- package/create/templates/vue/copy-assets.js +1 -67
- package/create/templates/vue/generate-home-page.js +2 -8
- package/create/templates/vue/generate-root.js +3 -13
- package/create/templates/vue/generate-routes.js +1 -7
- package/create/templates/vue/generate-scripts.js +9 -26
- package/create/templates/vue/global-components.d.js +1 -0
- package/create/templates/zaui/copy-assets.js +1 -90
- package/create/templates/zaui/generate-home-page.js +27 -53
- package/create/templates/zaui/generate-root.js +14 -34
- package/create/templates/zaui/generate-routes.js +1 -10
- package/create/templates/zaui/generate-scripts.js +6 -20
- package/create/templates/zaui/generate-user-card.js +3 -18
- package/create/templates/zaui/pages/about.js +3 -20
- package/create/templates/zaui/pages/form.js +3 -20
- package/create/templates/zaui/pages/index.js +1 -9
- package/create/templates/zaui/pages/user.js +3 -20
- package/create/utils/colors.js +1 -94
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-gitignore.js +1 -43
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/generate-package-json.js +1 -132
- package/create/utils/generate-readme.js +1 -28
- package/create/utils/get-options.js +1 -204
- package/create/utils/indent.js +1 -31
- package/create/utils/npm-scripts.js +1 -62
- package/create/utils/string.js +1 -13
- package/create/utils/styles-extension.js +1 -9
- package/create/utils/template-if.js +1 -9
- package/deploy/index.js +1 -148
- package/deploy/utils/get-options.js +1 -69
- package/deploy/utils/request-upload.js +1 -34
- package/deploy/utils/upload-app.js +1 -82
- package/index.js +1 -319
- package/login/index.js +1 -169
- package/login/utils/get-options.js +1 -58
- package/login/utils/zalo-login.js +1 -32
- package/migrate/icons/update-icon-v3.js +1 -19
- package/migrate/index.js +1 -60
- package/migrate/utils/get-options.js +1 -46
- package/migrate/utils/migrate-react.js +1 -33
- package/package.json +11 -39
- package/start/generate-hr-config.js +1 -59
- package/start/index.js +1 -382
- package/sync/index-to-app-config.js +1 -146
- package/sync/index.js +1 -55
- package/utils/axios.js +1 -15
- package/utils/check-update.js +1 -53
- package/utils/constants.js +1 -20
- package/utils/env.js +1 -39
- package/utils/error.js +1 -16
- package/utils/find-files-by-ext.js +1 -27
- package/utils/find-free-port.js +1 -11
- package/utils/fs-extra.js +1 -90
- package/utils/generate-pages-map.js +1 -17
- package/utils/get-app-info.js +1 -22
- package/utils/get-current-project.js +1 -25
- package/utils/get-ip.js +1 -19
- package/utils/log.js +1 -19
- package/utils/node-blob.js +1 -106
- package/utils/resumable.d.js +1 -0
- package/utils/resumable.js +1 -1204
- package/utils/spinner.js +1 -25
- package/utils/tunnel.js +1 -36
- package/.editorconfig +0 -15
- package/.eslintignore +0 -8
- package/.eslintrc.js +0 -10
- package/.vscode/launch.json +0 -23
- package/LICENSE +0 -21
- package/README.git.md +0 -37
- package/assets/index.js +0 -147
- package/build/dist/index.dev.js +0 -217
- package/config/dist/index.dev.js +0 -48
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/utils/dist/get-options.dev.js +0 -277
- package/deploy/dist/index.dev.js +0 -227
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/screenshots/wellcome.jpg +0 -0
- package/show-qr-app/assets/css/style.css +0 -87
- package/show-qr-app/assets/js/qrcode.min.js +0 -1
- package/show-qr-app/index.html +0 -57
- package/show-qr-app/package.json +0 -14
- package/start/dist/index.dev.js +0 -312
- package/ui/server.js +0 -194
- package/ui/www/css/app.css +0 -1
- package/ui/www/css/app.css.map +0 -1
- package/ui/www/fonts/ZMPIcons-Regular.eot +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.ttf +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff +0 -0
- package/ui/www/fonts/ZMPIcons-Regular.woff2 +0 -0
- package/ui/www/images/logo.png +0 -0
- package/ui/www/index.html +0 -1
- package/ui/www/js/app.js +0 -3
- package/ui/www/js/app.js.LICENSE.txt +0 -20
- package/ui/www/js/app.js.map +0 -1
- package/ui/www/static/icons/apple-touch-icon.png +0 -0
- package/ui/www/static/icons/favicon.png +0 -0
- package/utils/dist/get-app-info.dev.js +0 -54
package/create/utils/indent.js
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
module
|
|
2
|
-
if (typeof indent === 'undefined') return str.trim();
|
|
3
|
-
let minIndent;
|
|
4
|
-
str.split('\n').forEach((line) => {
|
|
5
|
-
const match = line.match(/[ ]*/);
|
|
6
|
-
if (match) {
|
|
7
|
-
if (match[0].length === line.length) return;
|
|
8
|
-
if (typeof minIndent === 'undefined') minIndent = match[0].length;
|
|
9
|
-
else minIndent = Math.min(minIndent, match[0].length);
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
if (typeof minIndent === 'undefined') return str.trim();
|
|
13
|
-
return str
|
|
14
|
-
.split('\n')
|
|
15
|
-
.map((l) => {
|
|
16
|
-
const lineIndentMatch = l.match(/[ ]*/);
|
|
17
|
-
let lineIndent = 0;
|
|
18
|
-
if (lineIndentMatch) lineIndent = Math.max(lineIndentMatch[0].length - minIndent, 0);
|
|
19
|
-
return `${' '.repeat(indent + lineIndent)}${l.replace(/^\s+/, '')}`;
|
|
20
|
-
})
|
|
21
|
-
.map((l) => {
|
|
22
|
-
if (!l.trim().length && l.length) return l.trim();
|
|
23
|
-
return l;
|
|
24
|
-
})
|
|
25
|
-
.filter((l, index, arr) => {
|
|
26
|
-
if (index === 0 && !l.trim().length && l.length) return false;
|
|
27
|
-
if (index === arr.length - 1 && !l.trim().length && l.length) return false;
|
|
28
|
-
return true;
|
|
29
|
-
})
|
|
30
|
-
.join('\n');
|
|
31
|
-
};
|
|
1
|
+
'use strict';function _0x2560(_0x3b483e,_0x5665e9){const _0x240d0a=_0x240d();return _0x2560=function(_0x25604b,_0x4c0a80){_0x25604b=_0x25604b-0x6a;let _0x3fb48b=_0x240d0a[_0x25604b];return _0x3fb48b;},_0x2560(_0x3b483e,_0x5665e9);}(function(_0x30ef57,_0x4005c1){const _0x3da7c0=_0x2560,_0x52b62e=_0x30ef57();while(!![]){try{const _0x5247bc=-parseInt(_0x3da7c0(0x74))/0x1+parseInt(_0x3da7c0(0x70))/0x2+-parseInt(_0x3da7c0(0x76))/0x3+parseInt(_0x3da7c0(0x71))/0x4+-parseInt(_0x3da7c0(0x6c))/0x5+-parseInt(_0x3da7c0(0x6f))/0x6*(-parseInt(_0x3da7c0(0x6d))/0x7)+parseInt(_0x3da7c0(0x6b))/0x8;if(_0x5247bc===_0x4005c1)break;else _0x52b62e['push'](_0x52b62e['shift']());}catch(_0x2c7bbd){_0x52b62e['push'](_0x52b62e['shift']());}}}(_0x240d,0x909de));function _0x240d(){const _0x4e30c6=['join','375340CAmVbJ','match','2281197qnAeOv','trim','forEach','map','split','max','min','repeat','3225832ggFqxL','829955eDhUck','339738YxxTRU','replace','24FbXHjg','1988848SVqoDo','1209164nSpjoV','length'];_0x240d=function(){return _0x4e30c6;};return _0x240d();}module['exports']=(_0x2f7c71,_0x52a4ec)=>{const _0x37d820=_0x2560;let _0x349720;return void 0x0===_0x2f7c71?_0x52a4ec[_0x37d820(0x77)]():(_0x52a4ec[_0x37d820(0x7a)]('\x0a')[_0x37d820(0x78)](_0x53bcb0=>{const _0x5e3c04=_0x37d820;let _0x1373f4=_0x53bcb0[_0x5e3c04(0x75)](/[ ]*/);if(_0x1373f4){if(_0x1373f4[0x0][_0x5e3c04(0x72)]===_0x53bcb0[_0x5e3c04(0x72)])return;_0x349720=void 0x0===_0x349720?_0x1373f4[0x0]['length']:Math[_0x5e3c04(0x7c)](_0x349720,_0x1373f4[0x0][_0x5e3c04(0x72)]);}}),void 0x0===_0x349720)?_0x52a4ec[_0x37d820(0x77)]():_0x52a4ec[_0x37d820(0x7a)]('\x0a')[_0x37d820(0x79)](_0x149641=>{const _0x4ec950=_0x37d820;let _0x241e5b=_0x149641[_0x4ec950(0x75)](/[ ]*/),_0x58b2d0=0x0;return _0x241e5b&&(_0x58b2d0=Math[_0x4ec950(0x7b)](_0x241e5b[0x0]['length']-_0x349720,0x0)),''+'\x20'[_0x4ec950(0x6a)](_0x2f7c71+_0x58b2d0)+_0x149641[_0x4ec950(0x6e)](/^\s+/,'');})[_0x37d820(0x79)](_0x3ed345=>!_0x3ed345[_0x37d820(0x77)]()[_0x37d820(0x72)]&&_0x3ed345[_0x37d820(0x72)]?_0x3ed345['trim']():_0x3ed345)['filter']((_0x24eab1,_0x469e25,_0x29c26d)=>(0x0!==_0x469e25||!!_0x24eab1['trim']()[_0x37d820(0x72)]||!_0x24eab1[_0x37d820(0x72)])&&(_0x469e25!==_0x29c26d['length']-0x1||!!_0x24eab1[_0x37d820(0x77)]()['length']||!_0x24eab1[_0x37d820(0x72)]))[_0x37d820(0x73)]('\x0a');};
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
const map = {
|
|
2
|
-
d: 'dev',
|
|
3
|
-
p: 'prod',
|
|
4
|
-
s: 'start',
|
|
5
|
-
v: 'serve',
|
|
6
|
-
r: 'deploy',
|
|
7
|
-
t: 'build:css',
|
|
8
|
-
};
|
|
9
|
-
function scriptName(tokens) {
|
|
10
|
-
return tokens
|
|
11
|
-
.split('_')[0]
|
|
12
|
-
.split('')
|
|
13
|
-
.map((token) => map[token])
|
|
14
|
-
.join('-');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const npmScripts = {
|
|
18
|
-
default: {
|
|
19
|
-
s: {
|
|
20
|
-
icon: '🔥',
|
|
21
|
-
script: 'zmp start',
|
|
22
|
-
description: 'run development server',
|
|
23
|
-
},
|
|
24
|
-
r: {
|
|
25
|
-
icon: '🙏',
|
|
26
|
-
script: 'zmp deploy',
|
|
27
|
-
description: 'deploy mini app for production',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
httpServer: {
|
|
31
|
-
v: {
|
|
32
|
-
icon: '🔧',
|
|
33
|
-
script: 'http-server ./www/ -o -c 1 -a localhost -p 8080',
|
|
34
|
-
description: 'run development server',
|
|
35
|
-
},
|
|
36
|
-
s: {
|
|
37
|
-
icon: '🔥',
|
|
38
|
-
script: 'npm run serve',
|
|
39
|
-
description: 'run development server',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
tailwind: {
|
|
43
|
-
t: {
|
|
44
|
-
icon: '🔧',
|
|
45
|
-
script: 'postcss src/css/tailwind.css -o src/css/styles.css',
|
|
46
|
-
description: 'build tailwind css',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Object.keys(npmScripts.default).forEach((tokens) => {
|
|
52
|
-
npmScripts.default[tokens].name = scriptName(tokens);
|
|
53
|
-
});
|
|
54
|
-
Object.keys(npmScripts.httpServer).forEach((tokens) => {
|
|
55
|
-
npmScripts.httpServer[tokens].name = scriptName(tokens);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
Object.keys(npmScripts.tailwind).forEach((tokens) => {
|
|
59
|
-
npmScripts.tailwind[tokens].name = scriptName(tokens);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
module.exports = npmScripts;
|
|
1
|
+
'use strict';function _0x5f7c(){const _0x235a99=['prod','4YTmiJj','161412gUmTUk','8037bGDFSO','728484VWSKYl','split','http-server\x20./www/\x20-o\x20-c\x201\x20-a\x20localhost\x20-p\x208080','exports','build:css','1211255ypNzUx','join','zmp\x20start','npm\x20run\x20serve','keys','build\x20tailwind\x20css','dev','run\x20development\x20server','621390patXLT','68903xYhwJl','serve','472780IieHmK','start','httpServer','default','2792UgFEGl','name','zmp\x20deploy','map','forEach','deploy\x20mini\x20app\x20for\x20production'];_0x5f7c=function(){return _0x235a99;};return _0x5f7c();}const _0x4d1f6c=_0x1b28;(function(_0x5af77e,_0x1574a9){const _0x3d5e8c=_0x1b28,_0x2c0a13=_0x5af77e();while(!![]){try{const _0x4333e3=-parseInt(_0x3d5e8c(0x1df))/0x1+-parseInt(_0x3d5e8c(0x1e1))/0x2+-parseInt(_0x3d5e8c(0x1ef))/0x3+parseInt(_0x3d5e8c(0x1ec))/0x4*(parseInt(_0x3d5e8c(0x1d6))/0x5)+parseInt(_0x3d5e8c(0x1ed))/0x6+parseInt(_0x3d5e8c(0x1de))/0x7+parseInt(_0x3d5e8c(0x1e5))/0x8*(parseInt(_0x3d5e8c(0x1ee))/0x9);if(_0x4333e3===_0x1574a9)break;else _0x2c0a13['push'](_0x2c0a13['shift']());}catch(_0x3f66e4){_0x2c0a13['push'](_0x2c0a13['shift']());}}}(_0x5f7c,0x1da73));const e={'d':_0x4d1f6c(0x1dc),'p':_0x4d1f6c(0x1eb),'s':_0x4d1f6c(0x1e2),'v':_0x4d1f6c(0x1e0),'r':'deploy','t':_0x4d1f6c(0x1d5)};function s(_0x30a77f){const _0x390882=_0x4d1f6c;return _0x30a77f[_0x390882(0x1f0)]('_')[0x0]['split']('')[_0x390882(0x1e8)](_0x5cbe4e=>e[_0x5cbe4e])[_0x390882(0x1d7)]('-');}function _0x1b28(_0x33df3d,_0x46247a){const _0x5f7cb0=_0x5f7c();return _0x1b28=function(_0x1b28a3,_0x2bef50){_0x1b28a3=_0x1b28a3-0x1d4;let _0x424c85=_0x5f7cb0[_0x1b28a3];return _0x424c85;},_0x1b28(_0x33df3d,_0x46247a);}const t={'default':{'s':{'icon':'🔥','script':_0x4d1f6c(0x1d8),'description':_0x4d1f6c(0x1dd)},'r':{'icon':'🙏','script':_0x4d1f6c(0x1e7),'description':_0x4d1f6c(0x1ea)}},'httpServer':{'v':{'icon':'🔧','script':_0x4d1f6c(0x1f1),'description':_0x4d1f6c(0x1dd)},'s':{'icon':'🔥','script':_0x4d1f6c(0x1d9),'description':_0x4d1f6c(0x1dd)}},'tailwind':{'t':{'icon':'🔧','script':'postcss\x20src/css/tailwind.css\x20-o\x20src/css/styles.css','description':_0x4d1f6c(0x1db)}}};Object[_0x4d1f6c(0x1da)](t[_0x4d1f6c(0x1e4)])[_0x4d1f6c(0x1e9)](_0xda060c=>{const _0x79c501=_0x4d1f6c;t[_0x79c501(0x1e4)][_0xda060c][_0x79c501(0x1e6)]=s(_0xda060c);}),Object[_0x4d1f6c(0x1da)](t[_0x4d1f6c(0x1e3)])[_0x4d1f6c(0x1e9)](_0x3b5d2b=>{const _0x37a6b6=_0x4d1f6c;t[_0x37a6b6(0x1e3)][_0x3b5d2b][_0x37a6b6(0x1e6)]=s(_0x3b5d2b);}),Object[_0x4d1f6c(0x1da)](t['tailwind'])['forEach'](_0x5e3391=>{const _0x68e2e2=_0x4d1f6c;t['tailwind'][_0x5e3391][_0x68e2e2(0x1e6)]=s(_0x5e3391);}),module[_0x4d1f6c(0x1d4)]=t;
|
package/create/utils/string.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (!string) {
|
|
3
|
-
return '';
|
|
4
|
-
}
|
|
5
|
-
const words = string
|
|
6
|
-
.split(/[,.\-_\s]/)
|
|
7
|
-
.map((word) => word[0].toUpperCase() + word.substring(1));
|
|
8
|
-
|
|
9
|
-
return words.join('');
|
|
10
|
-
};
|
|
11
|
-
module.exports = {
|
|
12
|
-
capitalize,
|
|
13
|
-
};
|
|
1
|
+
'use strict';function _0x313d(){var _0x291880=['substring','11661147GSXgXz','toUpperCase','join','5172108uNIYIf','98smIHKK','map','2904130jzXemq','exports','118064sIwDKk','split','56841RJPVld','6796PSOhoB','99ZdPWrI','6DgvGvD','3261410KcAfMv','351KOJPiv'];_0x313d=function(){return _0x291880;};return _0x313d();}var _0x55d081=_0x45f9;(function(_0x183a71,_0x4aa739){var _0x33c4f5=_0x45f9,_0x63378b=_0x183a71();while(!![]){try{var _0x50da5c=-parseInt(_0x33c4f5(0x1d4))/0x1+parseInt(_0x33c4f5(0x1d5))/0x2*(parseInt(_0x33c4f5(0x1d9))/0x3)+parseInt(_0x33c4f5(0x1de))/0x4+-parseInt(_0x33c4f5(0x1e1))/0x5*(-parseInt(_0x33c4f5(0x1d7))/0x6)+parseInt(_0x33c4f5(0x1df))/0x7*(parseInt(_0x33c4f5(0x1d2))/0x8)+parseInt(_0x33c4f5(0x1db))/0x9+-parseInt(_0x33c4f5(0x1d8))/0xa*(parseInt(_0x33c4f5(0x1d6))/0xb);if(_0x50da5c===_0x4aa739)break;else _0x63378b['push'](_0x63378b['shift']());}catch(_0x28e5ac){_0x63378b['push'](_0x63378b['shift']());}}}(_0x313d,0xbed24));function _0x45f9(_0x33b189,_0x1951b2){var _0x313dbd=_0x313d();return _0x45f9=function(_0x45f958,_0x335261){_0x45f958=_0x45f958-0x1d2;var _0x39cc0c=_0x313dbd[_0x45f958];return _0x39cc0c;},_0x45f9(_0x33b189,_0x1951b2);}module[_0x55d081(0x1e2)]={'capitalize':_0x40179c=>_0x40179c?_0x40179c[_0x55d081(0x1d3)](/[,.\-_\s]/)[_0x55d081(0x1e0)](_0x446c6b=>_0x446c6b[0x0][_0x55d081(0x1dc)]()+_0x446c6b[_0x55d081(0x1da)](0x1))[_0x55d081(0x1dd)](''):''};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (!cssPreProcessor) return 'css';
|
|
3
|
-
const exts = {
|
|
4
|
-
less: 'less',
|
|
5
|
-
stylus: 'styl',
|
|
6
|
-
scss: 'scss',
|
|
7
|
-
};
|
|
8
|
-
return exts[cssPreProcessor];
|
|
9
|
-
};
|
|
1
|
+
'use strict';function _0x5f3d(){var _0x3a21f0=['15376232WlvsZU','css','scss','22122dTYmvW','295188KSYbCJ','42sALsnn','exports','1681184pwKOdb','1049106WOOhxp','less','5146580xRaCZC','219313ZexvMY'];_0x5f3d=function(){return _0x3a21f0;};return _0x5f3d();}var _0x388c33=_0x5179;(function(_0x2a3d18,_0x32e330){var _0xc97fe0=_0x5179,_0x20866a=_0x2a3d18();while(!![]){try{var _0x4c29eb=parseInt(_0xc97fe0(0xcb))/0x1+parseInt(_0xc97fe0(0xc7))/0x2+parseInt(_0xc97fe0(0xc8))/0x3+parseInt(_0xc97fe0(0xd0))/0x4+parseInt(_0xc97fe0(0xca))/0x5+-parseInt(_0xc97fe0(0xcf))/0x6*(-parseInt(_0xc97fe0(0xd1))/0x7)+-parseInt(_0xc97fe0(0xcc))/0x8;if(_0x4c29eb===_0x32e330)break;else _0x20866a['push'](_0x20866a['shift']());}catch(_0x1534ad){_0x20866a['push'](_0x20866a['shift']());}}}(_0x5f3d,0x959cd));function _0x5179(_0x2dc5a0,_0x42bb56){var _0x5f3dfb=_0x5f3d();return _0x5179=function(_0x517972,_0xb6d8fb){_0x517972=_0x517972-0xc7;var _0x3162aa=_0x5f3dfb[_0x517972];return _0x3162aa;},_0x5179(_0x2dc5a0,_0x42bb56);}module[_0x388c33(0xd2)]=_0x5da7d2=>_0x5da7d2?{'less':_0x388c33(0xc9),'stylus':'styl','scss':_0x388c33(0xce)}[_0x5da7d2]:_0x388c33(0xcd);
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
if (condition) {
|
|
3
|
-
return callback().trim();
|
|
4
|
-
}
|
|
5
|
-
if (callbackElse) {
|
|
6
|
-
return callbackElse().trim();
|
|
7
|
-
}
|
|
8
|
-
return '';
|
|
9
|
-
};
|
|
1
|
+
'use strict';var _0x3a4697=_0x127b;function _0x2b98(){var _0x7117b9=['754pqBgEa','7166824kYgYLm','172075AIHPBe','8567982VuMjBB','21042EYlelm','12021jYYVuw','exports','148YDtAVi','1818blvUMA','6790828rDpWSH','120rcMhck','910508fphnaw'];_0x2b98=function(){return _0x7117b9;};return _0x2b98();}(function(_0x112751,_0x29b635){var _0x2e34f5=_0x127b,_0x522263=_0x112751();while(!![]){try{var _0x2b241d=-parseInt(_0x2e34f5(0x18f))/0x1+parseInt(_0x2e34f5(0x184))/0x2*(-parseInt(_0x2e34f5(0x189))/0x3)+-parseInt(_0x2e34f5(0x18b))/0x4*(parseInt(_0x2e34f5(0x186))/0x5)+-parseInt(_0x2e34f5(0x18c))/0x6*(parseInt(_0x2e34f5(0x188))/0x7)+-parseInt(_0x2e34f5(0x185))/0x8+-parseInt(_0x2e34f5(0x187))/0x9+parseInt(_0x2e34f5(0x18e))/0xa*(parseInt(_0x2e34f5(0x18d))/0xb);if(_0x2b241d===_0x29b635)break;else _0x522263['push'](_0x522263['shift']());}catch(_0x4a89b4){_0x522263['push'](_0x522263['shift']());}}}(_0x2b98,0xe927d));function _0x127b(_0x57154c,_0x2b8ff9){var _0x2b98fb=_0x2b98();return _0x127b=function(_0x127be1,_0xaebd7){_0x127be1=_0x127be1-0x184;var _0x172668=_0x2b98fb[_0x127be1];return _0x172668;},_0x127b(_0x57154c,_0x2b8ff9);}module[_0x3a4697(0x18a)]=(_0x1f4ebf,_0x4784d1,_0x4d3546)=>_0x1f4ebf?_0x4784d1()['trim']():_0x4d3546?_0x4d3546()['trim']():'';
|
package/deploy/index.js
CHANGED
|
@@ -1,148 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint no-console: off */
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const zipper = require('zip-local');
|
|
6
|
-
const logSymbols = require('log-symbols');
|
|
7
|
-
const qrcode = require('qrcode-terminal');
|
|
8
|
-
const config = require('../config');
|
|
9
|
-
const buildApp = require('../build/index');
|
|
10
|
-
const envUtils = require('../utils/env');
|
|
11
|
-
const uploadApp = require('./utils/upload-app');
|
|
12
|
-
const fse = require('../utils/fs-extra');
|
|
13
|
-
const requestUpload = require('./utils/request-upload');
|
|
14
|
-
|
|
15
|
-
const waitText = chalk.gray('(Please wait, it can take a while)');
|
|
16
|
-
const defaultLogger = {
|
|
17
|
-
statusStart() {},
|
|
18
|
-
statusDone() {},
|
|
19
|
-
statusText() {},
|
|
20
|
-
statusError() {},
|
|
21
|
-
text() {},
|
|
22
|
-
error() {},
|
|
23
|
-
showOnUI() {},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
module.exports = async (
|
|
27
|
-
options = {},
|
|
28
|
-
logger = defaultLogger,
|
|
29
|
-
{ exitOnError = true } = {}
|
|
30
|
-
) => {
|
|
31
|
-
const cwd = options.cwd || process.cwd();
|
|
32
|
-
const outputDir = options.outputDir || 'www';
|
|
33
|
-
const apiDomain = config.api_domain;
|
|
34
|
-
const resolvePath = (dir) => {
|
|
35
|
-
return path.join(cwd, dir);
|
|
36
|
-
};
|
|
37
|
-
function errorExit(err) {
|
|
38
|
-
logger.error(err.stderr || err);
|
|
39
|
-
if (exitOnError) process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const token = envUtils.getEnv(config.env.token);
|
|
43
|
-
const appConfigFilename = config.filename.appConfig;
|
|
44
|
-
const packageJsonFilename = config.filename.packageJson;
|
|
45
|
-
|
|
46
|
-
let appConfigJson;
|
|
47
|
-
let writeAppConfig = true;
|
|
48
|
-
try {
|
|
49
|
-
appConfigJson = require(resolvePath(appConfigFilename));
|
|
50
|
-
} catch (err) {
|
|
51
|
-
try {
|
|
52
|
-
// If app-config.json not found, try to use the one in the outputDir
|
|
53
|
-
appConfigJson = require(resolvePath(`${outputDir}/${appConfigFilename}`));
|
|
54
|
-
writeAppConfig = false;
|
|
55
|
-
} catch (err) {
|
|
56
|
-
errorExit(new Error(config.error_msg.app_config_not_found));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let packageJson;
|
|
61
|
-
const frameworkVersions = {};
|
|
62
|
-
try {
|
|
63
|
-
packageJson = require(resolvePath(packageJsonFilename));
|
|
64
|
-
const dependencies = packageJson.dependencies;
|
|
65
|
-
Object.entries(dependencies).forEach(([key, value]) => {
|
|
66
|
-
if (key.includes('zmp') || key.includes('react')) {
|
|
67
|
-
frameworkVersions[key] = value;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
} catch (err) {
|
|
71
|
-
// pass
|
|
72
|
-
}
|
|
73
|
-
const dataRequest = {
|
|
74
|
-
appName: appConfigJson.app.title,
|
|
75
|
-
appDesc: options.desc || 'Update app with new version',
|
|
76
|
-
appConfig: JSON.stringify(appConfigJson),
|
|
77
|
-
frameworkVersions: JSON.stringify(frameworkVersions),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
let nextVersion;
|
|
81
|
-
let identifier;
|
|
82
|
-
try {
|
|
83
|
-
const urlRequestUpload = `${apiDomain}${config.path.requestUploadResumable}`;
|
|
84
|
-
const requestUploadData = await requestUpload(
|
|
85
|
-
urlRequestUpload,
|
|
86
|
-
dataRequest,
|
|
87
|
-
options.versionStatus,
|
|
88
|
-
token
|
|
89
|
-
);
|
|
90
|
-
nextVersion = requestUploadData.nextVersion;
|
|
91
|
-
identifier = requestUploadData.identifier;
|
|
92
|
-
} catch (err) {
|
|
93
|
-
errorExit(err);
|
|
94
|
-
}
|
|
95
|
-
if (options.customProject) {
|
|
96
|
-
let flag = 0;
|
|
97
|
-
if (appConfigJson.listSyncJS && appConfigJson.listSyncJS.length > 0)
|
|
98
|
-
flag += 1;
|
|
99
|
-
if (appConfigJson.listAsyncJS && appConfigJson.listAsyncJS.length > 0)
|
|
100
|
-
flag += 1;
|
|
101
|
-
if (flag === 0) {
|
|
102
|
-
errorExit(
|
|
103
|
-
new Error(
|
|
104
|
-
'Please define your assets output at app-config.json. Read more: https://mini.zalo.me/intro/getting-started/app-config/'
|
|
105
|
-
)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
if (writeAppConfig) {
|
|
109
|
-
fse.writeFileSync(
|
|
110
|
-
resolvePath(`${outputDir}/${config.filename.appConfig}`),
|
|
111
|
-
JSON.stringify(appConfigJson)
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
appConfigJson = await buildApp(
|
|
116
|
-
{ ...options, appConfigJson, nextVersion },
|
|
117
|
-
logger
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
logger.statusStart(`Deploying Your App ${waitText}`);
|
|
122
|
-
try {
|
|
123
|
-
const buffer = await new Promise((resolve, reject) => {
|
|
124
|
-
zipper.zip(resolvePath(outputDir), function (zipError, zipped) {
|
|
125
|
-
if (zipError) return reject(zipError);
|
|
126
|
-
zipped.compress();
|
|
127
|
-
return resolve(zipped.memory());
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
const uploadData = {
|
|
131
|
-
...dataRequest,
|
|
132
|
-
appBuffer: buffer,
|
|
133
|
-
identifier,
|
|
134
|
-
};
|
|
135
|
-
const uploadRes = await uploadApp(uploadData, options, logger);
|
|
136
|
-
const appURL = uploadRes && uploadRes.data && uploadRes.data.appUrl;
|
|
137
|
-
qrcode.generate(appURL, { small: true }, function (qrcode) {
|
|
138
|
-
const qrCode = `${chalk.bold(
|
|
139
|
-
`${logSymbols.info} View app at:\n${qrcode}`
|
|
140
|
-
)}`;
|
|
141
|
-
logger.statusDone(`${chalk.bold.green('Deploy Done!')} 💪`);
|
|
142
|
-
logger.text(qrCode);
|
|
143
|
-
});
|
|
144
|
-
} catch (err) {
|
|
145
|
-
logger.statusError('Error deploying your app');
|
|
146
|
-
errorExit(err);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
1
|
+
'use strict';const _0x1bbcf8=_0x37b5;(function(_0x1803b7,_0x23a6a0){const _0x3b6f11=_0x37b5,_0x1152f3=_0x1803b7();while(!![]){try{const _0xff1c69=-parseInt(_0x3b6f11(0xb0))/0x1+-parseInt(_0x3b6f11(0xa3))/0x2*(-parseInt(_0x3b6f11(0xa4))/0x3)+parseInt(_0x3b6f11(0xc8))/0x4*(parseInt(_0x3b6f11(0x93))/0x5)+-parseInt(_0x3b6f11(0xa6))/0x6+-parseInt(_0x3b6f11(0xb2))/0x7+-parseInt(_0x3b6f11(0x91))/0x8*(parseInt(_0x3b6f11(0xb3))/0x9)+-parseInt(_0x3b6f11(0xc7))/0xa*(-parseInt(_0x3b6f11(0xaf))/0xb);if(_0xff1c69===_0x23a6a0)break;else _0x1152f3['push'](_0x1152f3['shift']());}catch(_0x277b28){_0x1152f3['push'](_0x1152f3['shift']());}}}(_0x5e2a,0x65fdf));function _0x37b5(_0x1db8e6,_0x27a8ed){const _0x5e2a73=_0x5e2a();return _0x37b5=function(_0x37b51c,_0x2b9973){_0x37b51c=_0x37b51c-0x8d;let _0x425c80=_0x5e2a73[_0x37b51c];return _0x425c80;},_0x37b5(_0x1db8e6,_0x27a8ed);}function _0x5e2a(){const _0x27b56b=['6gWsVth','versionStatus','1038126MwzyYS','www','Deploy\x20Done!','path','statusError','../config','bold','Deploying\x20Your\x20App\x20','generate','1617qjslsi','333038INmXWQ','zip','2117815rvYihN','63FcykNR','nextVersion','appUrl','entries','desc','text','info','Please\x20define\x20your\x20assets\x20output\x20at\x20app-config.json.\x20Read\x20more:\x20https://mini.zalo.me/intro/getting-started/app-config/','error_msg','zip-local','./utils/request-upload','./utils/upload-app','stringify','listAsyncJS','\x20💪','../build/index','length','app_config_not_found','statusStart','api_domain','64490JFLhAh','4pKILxs','appConfig','customProject','filename','zmp','../utils/env','901288giXhdh','forEach','2349565WTGeJC','dependencies','../utils/fs-extra','env','data','Error\x20deploying\x20your\x20app','exit','listSyncJS','title','identifier','(Please\x20wait,\x20it\x20can\x20take\x20a\x20while)','memory','includes','\x20View\x20app\x20at:\x0a','packageJson','react','597074DTdGMd'];_0x5e2a=function(){return _0x27b56b;};return _0x5e2a();}const e=require('chalk'),t=require(_0x1bbcf8(0xa9)),r=require(_0x1bbcf8(0xbc)),i=require('log-symbols'),a=require('qrcode-terminal'),s=require(_0x1bbcf8(0xab)),n=require(_0x1bbcf8(0xc2)),o=require(_0x1bbcf8(0x90)),p=require(_0x1bbcf8(0xbe)),l=require(_0x1bbcf8(0x95)),u=require(_0x1bbcf8(0xbd)),c=e['gray'](_0x1bbcf8(0x9d)),d={'statusStart'(){},'statusDone'(){},'statusText'(){},'statusError'(){},'text'(){},'error'(){},'showOnUI'(){}};module['exports']=async(_0x244c35={},_0x2c4870=d,{exitOnError:_0x3d3741=!0x0}={})=>{const _0x37a720=_0x1bbcf8;let _0x5a88bd,_0x22f86d,_0x7495fa,_0x10f43c=_0x244c35['cwd']||process['cwd'](),_0xae29a6=_0x244c35['outputDir']||_0x37a720(0xa7),_0x5c310e=s[_0x37a720(0xc6)],_0x503a22=_0x3573c5=>t['join'](_0x10f43c,_0x3573c5);function _0xd100d2(_0x4264cf){const _0x2d7c57=_0x37a720;_0x2c4870['error'](_0x4264cf['stderr']||_0x4264cf),_0x3d3741&&process[_0x2d7c57(0x99)](0x1);}let _0x2f66bc=o['getEnv'](s[_0x37a720(0x96)]['token']),_0x4d7dc0=s[_0x37a720(0x8e)][_0x37a720(0xc9)],_0x4cdfa1=s['filename'][_0x37a720(0xa1)],_0x2982c0=!0x0;try{_0x5a88bd=require(_0x503a22(_0x4d7dc0));}catch(_0x446b4e){try{_0x5a88bd=require(_0x503a22(_0xae29a6+'/'+_0x4d7dc0)),_0x2982c0=!0x1;}catch(_0x437196){_0xd100d2(Error(s[_0x37a720(0xbb)][_0x37a720(0xc4)]));}}let _0x155b31={};try{let _0x39e3d1=require(_0x503a22(_0x4cdfa1))[_0x37a720(0x94)];Object[_0x37a720(0xb6)](_0x39e3d1)[_0x37a720(0x92)](([_0x4d5ed9,_0x18f6e4])=>{const _0x3c495f=_0x37a720;(_0x4d5ed9[_0x3c495f(0x9f)](_0x3c495f(0x8f))||_0x4d5ed9[_0x3c495f(0x9f)](_0x3c495f(0xa2)))&&(_0x155b31[_0x4d5ed9]=_0x18f6e4);});}catch(_0x4cc4a6){}let _0x5b5b79={'appName':_0x5a88bd['app'][_0x37a720(0x9b)],'appDesc':_0x244c35[_0x37a720(0xb7)]||'Update\x20app\x20with\x20new\x20version','appConfig':JSON[_0x37a720(0xbf)](_0x5a88bd),'frameworkVersions':JSON[_0x37a720(0xbf)](_0x155b31)};try{let _0xb21c78=''+_0x5c310e+s['path']['requestUploadResumable'],_0x3504a7=await u(_0xb21c78,_0x5b5b79,_0x244c35[_0x37a720(0xa5)],_0x2f66bc);_0x22f86d=_0x3504a7[_0x37a720(0xb4)],_0x7495fa=_0x3504a7[_0x37a720(0x9c)];}catch(_0x584cae){_0xd100d2(_0x584cae);}if(_0x244c35[_0x37a720(0x8d)]){let _0x3bdaf9=0x0;_0x5a88bd[_0x37a720(0x9a)]&&_0x5a88bd[_0x37a720(0x9a)][_0x37a720(0xc3)]>0x0&&(_0x3bdaf9+=0x1),_0x5a88bd['listAsyncJS']&&_0x5a88bd[_0x37a720(0xc0)]['length']>0x0&&(_0x3bdaf9+=0x1),0x0===_0x3bdaf9&&_0xd100d2(Error(_0x37a720(0xba))),_0x2982c0&&l['writeFileSync'](_0x503a22(_0xae29a6+'/'+s['filename'][_0x37a720(0xc9)]),JSON[_0x37a720(0xbf)](_0x5a88bd));}else _0x5a88bd=await n({..._0x244c35,'appConfigJson':_0x5a88bd,'nextVersion':_0x22f86d},_0x2c4870);_0x2c4870[_0x37a720(0xc5)](_0x37a720(0xad)+c);try{let _0x21bfc3=await new Promise((_0x1710c9,_0x2ed7b3)=>{const _0x52f2c5=_0x37a720;r[_0x52f2c5(0xb1)](_0x503a22(_0xae29a6),function(_0x1c141c,_0x526345){const _0x1c0a14=_0x52f2c5;return _0x1c141c?_0x2ed7b3(_0x1c141c):(_0x526345['compress'](),_0x1710c9(_0x526345[_0x1c0a14(0x9e)]()));});}),_0x12493e={..._0x5b5b79,'appBuffer':_0x21bfc3,'identifier':_0x7495fa},_0x40daae=await p(_0x12493e,_0x244c35,_0x2c4870),_0x13d701=_0x40daae&&_0x40daae[_0x37a720(0x97)]&&_0x40daae[_0x37a720(0x97)][_0x37a720(0xb5)];a[_0x37a720(0xae)](_0x13d701,{'small':!0x0},function(_0x2adedd){const _0x1a6e48=_0x37a720;let _0x1722f8=''+e[_0x1a6e48(0xac)](i[_0x1a6e48(0xb9)]+_0x1a6e48(0xa0)+_0x2adedd);_0x2c4870['statusDone'](e[_0x1a6e48(0xac)]['green'](_0x1a6e48(0xa8))+_0x1a6e48(0xc1)),_0x2c4870[_0x1a6e48(0xb8)](_0x1722f8);});}catch(_0x151852){_0x2c4870[_0x37a720(0xaa)](_0x37a720(0x98)),_0xd100d2(_0x151852);}};
|
|
@@ -1,69 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const inquirer = require('inquirer');
|
|
3
|
-
const { versionStatus } = require('../../utils/constants');
|
|
4
|
-
const _ = require('lodash');
|
|
5
|
-
|
|
6
|
-
const questions = [
|
|
7
|
-
{
|
|
8
|
-
type: 'list',
|
|
9
|
-
name: 'versionStatus',
|
|
10
|
-
message: 'What version status are you deploying?',
|
|
11
|
-
choices: Object.keys(versionStatus).map((key) => ({
|
|
12
|
-
name: _.capitalize(key),
|
|
13
|
-
value: versionStatus[key],
|
|
14
|
-
})),
|
|
15
|
-
when: (opts) => !opts.quit,
|
|
16
|
-
validate(input) {
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
if (!input || !input.length)
|
|
19
|
-
reject(new Error('Server type is required!'));
|
|
20
|
-
else resolve(true);
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'input',
|
|
26
|
-
name: 'desc',
|
|
27
|
-
message: 'Description:',
|
|
28
|
-
when: (opts) => !opts.quit,
|
|
29
|
-
validate(input) {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
if (!input || !input.length)
|
|
32
|
-
reject(new Error('Description is required!'));
|
|
33
|
-
else resolve(true);
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
const nonZmpOptions = [
|
|
40
|
-
{
|
|
41
|
-
type: 'list',
|
|
42
|
-
name: 'quit',
|
|
43
|
-
message: 'This is not a ZMP Project, do you want to continue?',
|
|
44
|
-
choices: [
|
|
45
|
-
{ name: 'Deploy your existing project', value: false },
|
|
46
|
-
{ name: 'Quit', value: true },
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'input',
|
|
51
|
-
name: 'outputDir',
|
|
52
|
-
message: 'Where is your dist folder?',
|
|
53
|
-
when: (opts) => !opts.quit,
|
|
54
|
-
default: 'www',
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
module.exports = async function getOptions(project = undefined) {
|
|
59
|
-
const promptQuestions = project
|
|
60
|
-
? [...questions]
|
|
61
|
-
: [...nonZmpOptions, ...questions];
|
|
62
|
-
return inquirer.prompt(promptQuestions).then((options) => {
|
|
63
|
-
options.customProject = false;
|
|
64
|
-
if (options.quit === false) {
|
|
65
|
-
options.customProject = true;
|
|
66
|
-
}
|
|
67
|
-
return Promise.resolve(options);
|
|
68
|
-
});
|
|
69
|
-
};
|
|
1
|
+
'use strict';function _0x5273(){const _0x533110=['10ZcMxjI','18384vLASxC','888824ntcDDp','2004860FirZrK','Description\x20is\x20required!','109541pycRBi','What\x20version\x20status\x20are\x20you\x20deploying?','list','desc','48qZkcPo','inquirer','customProject','7503167iKUBNc','This\x20is\x20not\x20a\x20ZMP\x20Project,\x20do\x20you\x20want\x20to\x20continue?','24FYRgKN','../../utils/constants','prompt','length','10ZyHjUI','868542RGbwnK','keys','10IJllmN','input','Description:','capitalize','quit','outputDir','Server\x20type\x20is\x20required!','lodash','223553icTrSm','9smZoST','www','exports'];_0x5273=function(){return _0x533110;};return _0x5273();}const _0x41070e=_0x28ad;(function(_0x52a146,_0x197fd7){const _0xa443e1=_0x28ad,_0x5ddbc2=_0x52a146();while(!![]){try{const _0x1b1442=parseInt(_0xa443e1(0x1d3))/0x1*(parseInt(_0xa443e1(0x1e0))/0x2)+parseInt(_0xa443e1(0x1dc))/0x3*(-parseInt(_0xa443e1(0x1cf))/0x4)+parseInt(_0xa443e1(0x1ce))/0x5*(-parseInt(_0xa443e1(0x1e1))/0x6)+parseInt(_0xa443e1(0x1da))/0x7+parseInt(_0xa443e1(0x1d0))/0x8*(-parseInt(_0xa443e1(0x1cb))/0x9)+-parseInt(_0xa443e1(0x1e3))/0xa*(-parseInt(_0xa443e1(0x1ca))/0xb)+parseInt(_0xa443e1(0x1d7))/0xc*(-parseInt(_0xa443e1(0x1d1))/0xd);if(_0x1b1442===_0x197fd7)break;else _0x5ddbc2['push'](_0x5ddbc2['shift']());}catch(_0x6c6dd7){_0x5ddbc2['push'](_0x5ddbc2['shift']());}}}(_0x5273,0x8efac));const e=require(_0x41070e(0x1d8)),{versionStatus:t}=require(_0x41070e(0x1dd)),i=require(_0x41070e(0x1c9)),r=[{'type':_0x41070e(0x1d5),'name':'versionStatus','message':_0x41070e(0x1d4),'choices':Object[_0x41070e(0x1e2)](t)['map'](_0x32ac86=>({'name':i[_0x41070e(0x1e6)](_0x32ac86),'value':t[_0x32ac86]})),'when':_0x1845ad=>!_0x1845ad[_0x41070e(0x1c6)],'validate':_0x4354fb=>new Promise((_0x51f8b7,_0x4eed2e)=>{const _0x289918=_0x41070e;_0x4354fb&&_0x4354fb[_0x289918(0x1df)]?_0x51f8b7(!0x0):_0x4eed2e(Error(_0x289918(0x1c8)));})},{'type':_0x41070e(0x1e4),'name':_0x41070e(0x1d6),'message':_0x41070e(0x1e5),'when':_0x1da252=>!_0x1da252[_0x41070e(0x1c6)],'validate':_0x264fa8=>new Promise((_0x85b1d8,_0x79f677)=>{const _0x15aea4=_0x41070e;_0x264fa8&&_0x264fa8['length']?_0x85b1d8(!0x0):_0x79f677(Error(_0x15aea4(0x1d2)));})}],s=[{'type':_0x41070e(0x1d5),'name':_0x41070e(0x1c6),'message':_0x41070e(0x1db),'choices':[{'name':'Deploy\x20your\x20existing\x20project','value':!0x1},{'name':'Quit','value':!0x0}]},{'type':_0x41070e(0x1e4),'name':_0x41070e(0x1c7),'message':'Where\x20is\x20your\x20dist\x20folder?','when':_0x2dc714=>!_0x2dc714[_0x41070e(0x1c6)],'default':_0x41070e(0x1cc)}];function _0x28ad(_0x216086,_0x3321ee){const _0x5273b3=_0x5273();return _0x28ad=function(_0x28ad3d,_0xbccd99){_0x28ad3d=_0x28ad3d-0x1c6;let _0x2f8c91=_0x5273b3[_0x28ad3d];return _0x2f8c91;},_0x28ad(_0x216086,_0x3321ee);}module[_0x41070e(0x1cd)]=async function(_0x2c17f7){const _0x5e5da6=_0x41070e;let _0x285278=_0x2c17f7?[...r]:[...s,...r];return e[_0x5e5da6(0x1de)](_0x285278)['then'](_0x1eeb0e=>(_0x1eeb0e[_0x5e5da6(0x1d9)]=!0x1,!0x1===_0x1eeb0e['quit']&&(_0x1eeb0e['customProject']=!0x0),Promise['resolve'](_0x1eeb0e)));};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
const { axiosClient } =
|
|
2
|
-
const config = require('../../config');
|
|
3
|
-
|
|
4
|
-
const requestUpload = async (url, appData, versionStatus, token) => {
|
|
5
|
-
const { appName, appDesc, appConfig, frameworkVersions } = appData;
|
|
6
|
-
|
|
7
|
-
const params = {
|
|
8
|
-
name: appName,
|
|
9
|
-
desc: appDesc,
|
|
10
|
-
config: appConfig,
|
|
11
|
-
versionStatus,
|
|
12
|
-
frameworkVersions,
|
|
13
|
-
};
|
|
14
|
-
const headers = {
|
|
15
|
-
Authorization: `Bearer ${token}`,
|
|
16
|
-
'cache-control': 'no-cache',
|
|
17
|
-
};
|
|
18
|
-
const res = await axiosClient.get(url, {
|
|
19
|
-
params,
|
|
20
|
-
headers,
|
|
21
|
-
withCredentials: true,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const resData = res.data;
|
|
25
|
-
if (!resData || resData.err < 0) {
|
|
26
|
-
if (resData && resData.err === config.error_code.permission_denied) {
|
|
27
|
-
throw new Error(config.error_msg.permission_denied);
|
|
28
|
-
}
|
|
29
|
-
throw new Error(JSON.stringify(resData));
|
|
30
|
-
}
|
|
31
|
-
return resData.data;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = requestUpload;
|
|
1
|
+
'use strict';const _0x335675=_0x1544;(function(_0x37a012,_0x3cbd74){const _0x3d7730=_0x1544,_0x1550f0=_0x37a012();while(!![]){try{const _0x38d230=-parseInt(_0x3d7730(0x164))/0x1*(-parseInt(_0x3d7730(0x16f))/0x2)+parseInt(_0x3d7730(0x15f))/0x3+-parseInt(_0x3d7730(0x161))/0x4*(parseInt(_0x3d7730(0x166))/0x5)+parseInt(_0x3d7730(0x170))/0x6+parseInt(_0x3d7730(0x169))/0x7*(parseInt(_0x3d7730(0x172))/0x8)+parseInt(_0x3d7730(0x173))/0x9+-parseInt(_0x3d7730(0x163))/0xa;if(_0x38d230===_0x3cbd74)break;else _0x1550f0['push'](_0x1550f0['shift']());}catch(_0x3d7235){_0x1550f0['push'](_0x1550f0['shift']());}}}(_0x2b7a,0x6da44));const {axiosClient:r}=require(_0x335675(0x171)),e=require(_0x335675(0x16c)),i=async(_0x262185,_0x2436a4,_0x38af7c,_0xe36021)=>{const _0x329308=_0x335675;let {appName:_0x2739e6,appDesc:_0x305561,appConfig:_0x219429,frameworkVersions:_0x57248f}=_0x2436a4,_0x47e404={'Authorization':_0x329308(0x162)+_0xe36021,'cache-control':_0x329308(0x16b)},_0xc84a44=(await r[_0x329308(0x165)](_0x262185,{'params':{'name':_0x2739e6,'desc':_0x305561,'config':_0x219429,'versionStatus':_0x38af7c,'frameworkVersions':_0x57248f},'headers':_0x47e404,'withCredentials':!0x0}))[_0x329308(0x168)];if(!_0xc84a44||_0xc84a44[_0x329308(0x16d)]<0x0){if(_0xc84a44&&_0xc84a44[_0x329308(0x16d)]===e[_0x329308(0x16e)][_0x329308(0x16a)])throw Error(e[_0x329308(0x160)]['permission_denied']);throw Error(JSON['stringify'](_0xc84a44));}return _0xc84a44[_0x329308(0x168)];};function _0x1544(_0x3d64fb,_0x1d2c63){const _0x2b7aa7=_0x2b7a();return _0x1544=function(_0x1544dd,_0x24aca0){_0x1544dd=_0x1544dd-0x15f;let _0x265015=_0x2b7aa7[_0x1544dd];return _0x265015;},_0x1544(_0x3d64fb,_0x1d2c63);}function _0x2b7a(){const _0x23a8e0=['70458CIwrsl','5197422AkNoGL','../../utils/axios','8SsiSqz','1529271iUvwJB','2327940tMrMxy','error_msg','4ioKFSh','Bearer\x20','24604790fKBjga','15ASrcxI','get','167605DjeIpB','exports','data','4217647uINavy','permission_denied','no-cache','../../config','err','error_code'];_0x2b7a=function(){return _0x23a8e0;};return _0x2b7a();}module[_0x335675(0x167)]=i;
|
|
@@ -1,82 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const config = require('../../config');
|
|
4
|
-
const envUtils = require('../../utils/env');
|
|
5
|
-
const File = require('file-api').File;
|
|
6
|
-
const FormData = require('form-data');
|
|
7
|
-
const _ = require('lodash');
|
|
8
|
-
|
|
9
|
-
module.exports = async function (data, options, logger) {
|
|
10
|
-
const apiDomain = config.api_domain;
|
|
11
|
-
|
|
12
|
-
const uploadAppByChunk = (resumable, bufferData) => {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
try {
|
|
15
|
-
var file = new File({
|
|
16
|
-
name: 'www.zip', // required
|
|
17
|
-
buffer: bufferData,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
resumable.on('fileAdded', function () {
|
|
21
|
-
resumable.upload();
|
|
22
|
-
});
|
|
23
|
-
resumable.on('complete', function () {
|
|
24
|
-
return resolve();
|
|
25
|
-
});
|
|
26
|
-
resumable.on('fileError', function (file, message) {
|
|
27
|
-
return reject(new Error(`Error upload app: ${message}`));
|
|
28
|
-
});
|
|
29
|
-
resumable.on('cancel', function () {
|
|
30
|
-
return reject(new Error('Error upload app: cancel'));
|
|
31
|
-
});
|
|
32
|
-
resumable.on('fileSuccess', function (file, message) {
|
|
33
|
-
const resData = JSON.parse(message);
|
|
34
|
-
if (_.isNumber(resData.err) && resData.err < 0) {
|
|
35
|
-
return reject(new Error(`Error upload app: ${message}`));
|
|
36
|
-
}
|
|
37
|
-
return resolve(resData);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
resumable.addFile(file);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return reject(error);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const apiUploadAppByChunk = `${apiDomain}${config.path.uploadAppByChunk}`;
|
|
48
|
-
|
|
49
|
-
const { appName, appDesc, appBuffer, appConfig, identifier } = data;
|
|
50
|
-
const token = envUtils.getEnv(config.env.token);
|
|
51
|
-
|
|
52
|
-
const resumable = new Resumable({
|
|
53
|
-
...config.resumable_option,
|
|
54
|
-
target: apiUploadAppByChunk,
|
|
55
|
-
headers: {
|
|
56
|
-
Authorization: `Bearer ${token}`,
|
|
57
|
-
},
|
|
58
|
-
generateUniqueIdentifier: () => identifier,
|
|
59
|
-
});
|
|
60
|
-
const formData = new FormData();
|
|
61
|
-
formData.append('zipFile', appBuffer);
|
|
62
|
-
formData.append('name', appName);
|
|
63
|
-
formData.append('desc', appDesc);
|
|
64
|
-
formData.append('config', appConfig);
|
|
65
|
-
|
|
66
|
-
// Resumable.js isn't supported!
|
|
67
|
-
if (!resumable.support) {
|
|
68
|
-
logger.statusError('Does not support upload app');
|
|
69
|
-
} else {
|
|
70
|
-
let i = 0;
|
|
71
|
-
resumable.on('fileProgress', function (file) {
|
|
72
|
-
i = Math.round(file.progress() * 100) % (100 + 1);
|
|
73
|
-
const chunks = new Array(i + 1).join('|');
|
|
74
|
-
logger.statusText(
|
|
75
|
-
`Deploying Your App ${chalk.gray(
|
|
76
|
-
'\n' + chunks + ' ' + Math.round(file.progress() * 100) + '%'
|
|
77
|
-
)}`
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
return await uploadAppByChunk(resumable, appBuffer);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
1
|
+
'use strict';const _0xf4b41c=_0x1a29;(function(_0x4b6ca0,_0x5617a5){const _0x26944=_0x1a29,_0x2ad870=_0x4b6ca0();while(!![]){try{const _0x2359fc=-parseInt(_0x26944(0x9e))/0x1*(parseInt(_0x26944(0xb6))/0x2)+-parseInt(_0x26944(0xb9))/0x3*(-parseInt(_0x26944(0xa4))/0x4)+-parseInt(_0x26944(0xa7))/0x5*(-parseInt(_0x26944(0xaa))/0x6)+parseInt(_0x26944(0x91))/0x7+parseInt(_0x26944(0xa5))/0x8*(-parseInt(_0x26944(0xad))/0x9)+-parseInt(_0x26944(0xa2))/0xa+parseInt(_0x26944(0x9c))/0xb*(parseInt(_0x26944(0x97))/0xc);if(_0x2359fc===_0x5617a5)break;else _0x2ad870['push'](_0x2ad870['shift']());}catch(_0x10b5e2){_0x2ad870['push'](_0x2ad870['shift']());}}}(_0x57ae,0x5bc92));function _0x1a29(_0x11424e,_0x76a8b){const _0x57ae72=_0x57ae();return _0x1a29=function(_0x1a292d,_0x4e57b5){_0x1a292d=_0x1a292d-0x8f;let _0x1e6ce6=_0x57ae72[_0x1a292d];return _0x1e6ce6;},_0x1a29(_0x11424e,_0x76a8b);}const r=require(_0xf4b41c(0xa1)),e=require(_0xf4b41c(0xac)),n=require(_0xf4b41c(0x9a)),o=require('../../utils/env'),t=require('file-api')[_0xf4b41c(0xb2)],a=require('form-data'),u=require(_0xf4b41c(0x96));function _0x57ae(){const _0x1ae4b3=['resumable_option','config','../../utils/resumable','6493780nqjpTV','complete','4532UMSUrL','8zAJBlY','statusText','845ZDBLuE','support','addFile','13290xaimIx','name','chalk','5990958hVpIEB','Bearer\x20','fileSuccess','Error\x20upload\x20app:\x20','zipFile','File','api_domain','fileAdded','upload','134tsqEEq','round','isNumber','1416COLQCz','fileProgress','append','getEnv','path','err','progress','4796925vThTnf','gray','Does\x20not\x20support\x20upload\x20app','cancel','env','lodash','3100152ulrcJP','parse','fileError','../../config','desc','11nXEWVN','statusError','2414VjNJpq'];_0x57ae=function(){return _0x1ae4b3;};return _0x57ae();}module['exports']=async function(_0x47bfcd,_0x324601,_0x3713a9){const _0x241ff0=_0xf4b41c;let _0x2d3fba=n[_0x241ff0(0xb3)],_0x142a97=''+_0x2d3fba+n[_0x241ff0(0xbd)]['uploadAppByChunk'],{appName:_0x2aac7d,appDesc:_0x4cc1a0,appBuffer:_0x51b473,appConfig:_0x235629,identifier:_0x28d575}=_0x47bfcd,_0xe36d3c=o[_0x241ff0(0xbc)](n[_0x241ff0(0x95)]['token']),_0x313b4f=new r({...n[_0x241ff0(0x9f)],'target':_0x142a97,'headers':{'Authorization':_0x241ff0(0xae)+_0xe36d3c},'generateUniqueIdentifier':()=>_0x28d575}),_0x2eeeea=new a();if(_0x2eeeea['append'](_0x241ff0(0xb1),_0x51b473),_0x2eeeea[_0x241ff0(0xbb)](_0x241ff0(0xab),_0x2aac7d),_0x2eeeea[_0x241ff0(0xbb)](_0x241ff0(0x9b),_0x4cc1a0),_0x2eeeea['append'](_0x241ff0(0xa0),_0x235629),_0x313b4f[_0x241ff0(0xa8)])return _0x313b4f['on'](_0x241ff0(0xba),function(_0x51cd11){const _0x2f4c7b=_0x241ff0;let _0x2f4ded=Array(Math['round'](0x64*_0x51cd11[_0x2f4c7b(0x90)]())%0x65+0x1)['join']('|');_0x3713a9[_0x2f4c7b(0xa6)]('Deploying\x20Your\x20App\x20'+e[_0x2f4c7b(0x92)]('\x0a'+_0x2f4ded+'\x20'+Math[_0x2f4c7b(0xb7)](0x64*_0x51cd11['progress']())+'%'));}),await new Promise((_0x169442,_0x118e03)=>{const _0x19567e=_0x241ff0;try{var _0x19ff6f=new t({'name':'www.zip','buffer':_0x51b473});_0x313b4f['on'](_0x19567e(0xb4),function(){const _0x10ef95=_0x19567e;_0x313b4f[_0x10ef95(0xb5)]();}),_0x313b4f['on'](_0x19567e(0xa3),function(){return _0x169442();}),_0x313b4f['on'](_0x19567e(0x99),function(_0x1ad92b,_0x128030){return _0x118e03(Error('Error\x20upload\x20app:\x20'+_0x128030));}),_0x313b4f['on'](_0x19567e(0x94),function(){return _0x118e03(Error('Error\x20upload\x20app:\x20cancel'));}),_0x313b4f['on'](_0x19567e(0xaf),function(_0x5f0c14,_0x26f5ff){const _0x3d73ee=_0x19567e;let _0x29b488=JSON[_0x3d73ee(0x98)](_0x26f5ff);return u[_0x3d73ee(0xb8)](_0x29b488[_0x3d73ee(0x8f)])&&_0x29b488[_0x3d73ee(0x8f)]<0x0?_0x118e03(Error(_0x3d73ee(0xb0)+_0x26f5ff)):_0x169442(_0x29b488);}),_0x313b4f[_0x19567e(0xa9)](_0x19ff6f);}catch(_0x36c4d0){return _0x118e03(_0x36c4d0);}});_0x3713a9[_0x241ff0(0x9d)](_0x241ff0(0x93));};
|