zmp-cli 3.15.6 → 3.15.8
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 +37 -0
- package/build/index.js +1 -184
- package/config/index.js +1 -44
- package/create/index.js +1 -230
- package/create/utils/generate-app-config.js +1 -34
- package/create/utils/generate-npm-scripts.js +1 -26
- package/create/utils/get-options.js +1 -204
- package/create/utils/npm-scripts.js +1 -62
- package/deploy/index.js +1 -149
- 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 +13 -40
- package/start/frame/index.html +264 -254
- 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/init-zmp-ui.js +0 -216
- package/create/templates/app-parameters.js +0 -33
- package/create/templates/common/css/icons.css +0 -60
- package/create/templates/common/icons/512x512.png +0 -0
- package/create/templates/common/icons/apple-touch-icon.png +0 -0
- package/create/templates/common/icons/favicon.png +0 -0
- package/create/templates/common/postcss.config.js +0 -5
- package/create/templates/common/splash-2732x2732.png +0 -0
- package/create/templates/common/tailwind/postcss.config.js +0 -5
- package/create/templates/common/tailwind/tailwind.config.js +0 -9
- package/create/templates/common/tailwind/tailwind.css +0 -3
- package/create/templates/common/webpack/build.js +0 -41
- package/create/templates/copy-assets.js +0 -158
- package/create/templates/core/babel.config.js +0 -11
- package/create/templates/core/copy-assets.js +0 -83
- package/create/templates/core/generate-home-page.js +0 -143
- package/create/templates/core/generate-root.js +0 -283
- package/create/templates/core/generate-routes.js +0 -155
- package/create/templates/core/generate-scripts.js +0 -94
- package/create/templates/core/pages/404.html +0 -20
- package/create/templates/core/pages/about.html +0 -26
- package/create/templates/core/pages/catalog.html +0 -40
- package/create/templates/core/pages/dynamic-route.html +0 -115
- package/create/templates/core/pages/form.html +0 -258
- package/create/templates/core/pages/left-page-1.html +0 -24
- package/create/templates/core/pages/left-page-2.html +0 -23
- package/create/templates/core/pages/product.html +0 -36
- package/create/templates/core/pages/request-and-load.html +0 -35
- package/create/templates/core/pages/settings.html +0 -252
- package/create/templates/create-folders.js +0 -30
- package/create/templates/dist/generate-styles.dev.js +0 -46
- package/create/templates/generate-config-xml.js +0 -18
- package/create/templates/generate-index.js +0 -49
- package/create/templates/generate-manifest.js +0 -49
- package/create/templates/generate-recoil.js +0 -56
- package/create/templates/generate-routes.js +0 -16
- package/create/templates/generate-scripts.js +0 -16
- package/create/templates/generate-service-worker.js +0 -126
- package/create/templates/generate-store.js +0 -88
- package/create/templates/generate-styles.js +0 -110
- package/create/templates/generate-webpack-config.js +0 -335
- package/create/templates/generate-zmp-custom.js +0 -81
- package/create/templates/react/babel.config.js +0 -12
- package/create/templates/react/components/app-items.jsx +0 -44
- package/create/templates/react/components/navbar-back.jsx +0 -25
- package/create/templates/react/components/user-card.jsx +0 -18
- package/create/templates/react/copy-assets.js +0 -85
- package/create/templates/react/dist/generate-scripts.dev.js +0 -23
- package/create/templates/react/generate-home-page.js +0 -111
- package/create/templates/react/generate-root.js +0 -84
- package/create/templates/react/generate-routes.js +0 -16
- package/create/templates/react/generate-scripts.js +0 -68
- package/create/templates/react/pages/404.js +0 -27
- package/create/templates/react/pages/about.js +0 -52
- package/create/templates/react/pages/catalog.js +0 -112
- package/create/templates/react/pages/dynamic-route.js +0 -80
- package/create/templates/react/pages/form.js +0 -152
- package/create/templates/react/pages/index copy.js +0 -17
- package/create/templates/react/pages/index.js +0 -17
- package/create/templates/react/pages/settings.js +0 -76
- package/create/templates/react/pages/user.js +0 -56
- package/create/templates/react/vite.config.js +0 -11
- package/create/templates/react-typescript/_tsconfig.json +0 -33
- package/create/templates/react-typescript/components/app-items.js +0 -53
- package/create/templates/react-typescript/components/index.js +0 -9
- package/create/templates/react-typescript/components/navbar-back.js +0 -40
- package/create/templates/react-typescript/components/user-card.js +0 -32
- package/create/templates/react-typescript/copy-assets.js +0 -94
- package/create/templates/react-typescript/dist/generate-scripts.dev.js +0 -23
- package/create/templates/react-typescript/generate-home-page.js +0 -113
- package/create/templates/react-typescript/generate-root.js +0 -81
- package/create/templates/react-typescript/generate-routes.js +0 -12
- package/create/templates/react-typescript/generate-scripts.js +0 -67
- package/create/templates/react-typescript/pages/404.js +0 -27
- package/create/templates/react-typescript/pages/about.js +0 -52
- package/create/templates/react-typescript/pages/catalog.js +0 -112
- package/create/templates/react-typescript/pages/dynamic-route.js +0 -80
- package/create/templates/react-typescript/pages/form.js +0 -152
- package/create/templates/react-typescript/pages/index.js +0 -17
- package/create/templates/react-typescript/pages/settings.js +0 -76
- package/create/templates/react-typescript/pages/user.js +0 -56
- package/create/templates/react-typescript/vite.config.js +0 -21
- package/create/templates/svelte/babel.config.js +0 -10
- package/create/templates/svelte/copy-assets.js +0 -47
- package/create/templates/svelte/generate-home-page.js +0 -158
- package/create/templates/svelte/generate-root.js +0 -235
- package/create/templates/svelte/generate-routes.js +0 -91
- package/create/templates/svelte/generate-scripts.js +0 -47
- package/create/templates/svelte/pages/404.svelte +0 -10
- package/create/templates/svelte/pages/about.svelte +0 -16
- package/create/templates/svelte/pages/catalog.svelte +0 -31
- package/create/templates/svelte/pages/dynamic-route.svelte +0 -34
- package/create/templates/svelte/pages/form.svelte +0 -175
- package/create/templates/svelte/pages/left-page-1.svelte +0 -13
- package/create/templates/svelte/pages/left-page-2.svelte +0 -12
- package/create/templates/svelte/pages/product.svelte +0 -21
- package/create/templates/svelte/pages/request-and-load.svelte +0 -21
- package/create/templates/svelte/pages/settings.svelte +0 -175
- package/create/templates/vue/babel.config.js +0 -10
- package/create/templates/vue/components/header.vue +0 -28
- package/create/templates/vue/components/sun-and-moon.vue +0 -34
- package/create/templates/vue/copy-assets.js +0 -67
- package/create/templates/vue/generate-home-page.js +0 -56
- package/create/templates/vue/generate-root.js +0 -50
- package/create/templates/vue/generate-routes.js +0 -7
- package/create/templates/vue/generate-scripts.js +0 -63
- package/create/templates/vue/global-components.d.ts +0 -121
- package/create/templates/vue/icons/moon.svg +0 -3
- package/create/templates/vue/icons/sun.svg +0 -3
- package/create/templates/vue/pages/404.vue +0 -12
- package/create/templates/vue/pages/about.vue +0 -15
- package/create/templates/vue/pages/catalog.vue +0 -39
- package/create/templates/vue/pages/dynamic-route.vue +0 -34
- package/create/templates/vue/pages/form.vue +0 -162
- package/create/templates/vue/pages/left-page-1.vue +0 -14
- package/create/templates/vue/pages/left-page-2.vue +0 -11
- package/create/templates/vue/pages/product.vue +0 -31
- package/create/templates/vue/pages/request-and-load.vue +0 -25
- package/create/templates/vue/pages/settings.vue +0 -18
- package/create/templates/vue/vite.config.js +0 -11
- package/create/templates/zaui/_tsconfig.json +0 -33
- package/create/templates/zaui/babel.config.js +0 -12
- package/create/templates/zaui/components/user-card.jsx +0 -16
- package/create/templates/zaui/copy-assets.js +0 -90
- package/create/templates/zaui/generate-home-page.js +0 -117
- package/create/templates/zaui/generate-root.js +0 -53
- package/create/templates/zaui/generate-routes.js +0 -10
- package/create/templates/zaui/generate-scripts.js +0 -39
- package/create/templates/zaui/generate-user-card.js +0 -55
- package/create/templates/zaui/pages/about.js +0 -129
- package/create/templates/zaui/pages/form.js +0 -123
- package/create/templates/zaui/pages/index.js +0 -9
- package/create/templates/zaui/pages/user.js +0 -109
- package/create/templates/zaui/vite.config.js +0 -11
- package/create/utils/colors.js +0 -94
- package/create/utils/dist/get-options.dev.js +0 -277
- package/create/utils/generate-gitignore.js +0 -43
- package/create/utils/generate-package-json.js +0 -132
- package/create/utils/generate-readme.js +0 -28
- package/create/utils/indent.js +0 -31
- package/create/utils/string.js +0 -13
- package/create/utils/styles-extension.js +0 -9
- package/create/utils/template-if.js +0 -9
- package/deploy/dist/index.dev.js +0 -227
- package/deploy/utils/dist/request-upload.dev.js +0 -62
- package/deploy/utils/dist/upload-app.dev.js +0 -113
- package/dist/bundle.js +0 -1
- package/dist/index.dev.js +0 -352
- package/jsconfig.json +0 -8
- package/login/dist/index.dev.js +0 -223
- package/login/utils/dist/zalo-login.dev.js +0 -41
- 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/start/generate-hr-config.js +0 -59
- 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
|
@@ -1,204 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const inquirer = require('inquirer');
|
|
3
|
-
var chalk = require('chalk');
|
|
4
|
-
const { projectFramework } = require('../../utils/constants');
|
|
5
|
-
|
|
6
|
-
const moreOptionsText = chalk.italic(
|
|
7
|
-
`\t- Including Tailwind CSS\n\t- Including Recoil (React only)`
|
|
8
|
-
);
|
|
9
|
-
const questions = [
|
|
10
|
-
{
|
|
11
|
-
type: 'list',
|
|
12
|
-
name: 'newProject',
|
|
13
|
-
message: 'What action you want to do?',
|
|
14
|
-
choices: [
|
|
15
|
-
{ name: 'Create a new ZMP project', value: true },
|
|
16
|
-
{ name: 'Using ZMP to deploy only', value: false },
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'input',
|
|
21
|
-
name: 'name',
|
|
22
|
-
message: 'App (project) name:',
|
|
23
|
-
default: 'My App',
|
|
24
|
-
validate(input) {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
if (!input) reject(new Error('App name is required'));
|
|
27
|
-
else resolve(true);
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'list',
|
|
33
|
-
name: 'package',
|
|
34
|
-
when: (opts) => opts.newProject,
|
|
35
|
-
message: 'Choose an UI library',
|
|
36
|
-
choices: [
|
|
37
|
-
{
|
|
38
|
-
name: 'zmp-ui',
|
|
39
|
-
value: 'zmp-ui',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
// Framework
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
type: 'list',
|
|
47
|
-
name: 'framework',
|
|
48
|
-
when: (opts) => opts.package == 'zmp-ui',
|
|
49
|
-
message: 'What type of framework/library do you prefer?',
|
|
50
|
-
choices: [
|
|
51
|
-
{
|
|
52
|
-
name: 'ReactJS',
|
|
53
|
-
value: projectFramework.REACT,
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: 'React Typescript',
|
|
57
|
-
value: projectFramework.REACT_TYPESCRIPT,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
// Template
|
|
62
|
-
{
|
|
63
|
-
type: 'list',
|
|
64
|
-
name: 'cssPreProcessor',
|
|
65
|
-
when: (opts) => opts.newProject,
|
|
66
|
-
message: 'Do you want to setup CSS Pre-Processor',
|
|
67
|
-
default: false,
|
|
68
|
-
choices: [
|
|
69
|
-
{
|
|
70
|
-
name: 'No, i am good with CSS',
|
|
71
|
-
value: false,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'Less',
|
|
75
|
-
value: 'less',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'SCSS (SASS)',
|
|
79
|
-
value: 'scss',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'Stylus',
|
|
83
|
-
value: 'stylus',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
// Template
|
|
88
|
-
{
|
|
89
|
-
type: 'list',
|
|
90
|
-
name: 'template',
|
|
91
|
-
when: (opts) => opts.package === 'zmp-ui',
|
|
92
|
-
message: 'Choose starter template:',
|
|
93
|
-
choices: [
|
|
94
|
-
{
|
|
95
|
-
name: 'Blank',
|
|
96
|
-
value: 'blank',
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: 'Single View',
|
|
100
|
-
value: 'single-view',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
// Color
|
|
105
|
-
{
|
|
106
|
-
type: 'list',
|
|
107
|
-
name: 'themingCustomColor',
|
|
108
|
-
when: (opts) => opts.newProject && opts.package !== 'zmp-ui',
|
|
109
|
-
message: 'Do you want to specify custom theme color?',
|
|
110
|
-
choices: [
|
|
111
|
-
{
|
|
112
|
-
name: 'No, use default color theme',
|
|
113
|
-
value: false,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 'Yes, i want to specify my brand color',
|
|
117
|
-
value: true,
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
type: 'input',
|
|
123
|
-
name: 'themingColor',
|
|
124
|
-
message: 'Enter custom theme color in HEX format (e.g. ff0000)',
|
|
125
|
-
when: (opts) => opts.themingCustomColor === true,
|
|
126
|
-
validate(input) {
|
|
127
|
-
return new Promise((resolve, reject) => {
|
|
128
|
-
const num = input.replace(/#/g, '');
|
|
129
|
-
if (num.length === 3 || num.length === 6) resolve(true);
|
|
130
|
-
else reject(new Error("It doesn't look like a correct HEX number"));
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
filter(input) {
|
|
134
|
-
return input.replace(/#/g, '');
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
type: 'list',
|
|
139
|
-
name: 'moreOptions',
|
|
140
|
-
when: (opts) => opts.newProject,
|
|
141
|
-
message: `More Options?\n${moreOptionsText}`,
|
|
142
|
-
default: false,
|
|
143
|
-
choices: [
|
|
144
|
-
{
|
|
145
|
-
name: 'No, I want to complete initializing process now',
|
|
146
|
-
value: false,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: 'Yes, I want to get more options',
|
|
150
|
-
value: true,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
-
type: 'list',
|
|
157
|
-
name: 'includeTailwind',
|
|
158
|
-
when: (opts) => opts.moreOptions,
|
|
159
|
-
message: 'Do you want to include Tailwind CSS?',
|
|
160
|
-
default: true,
|
|
161
|
-
choices: [
|
|
162
|
-
{
|
|
163
|
-
name: 'Yes, I want to iclude Tailwind CSS',
|
|
164
|
-
value: true,
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: 'No',
|
|
168
|
-
value: false,
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
},
|
|
172
|
-
];
|
|
173
|
-
|
|
174
|
-
module.exports = function getOptions() {
|
|
175
|
-
const listQuestion = questions;
|
|
176
|
-
return inquirer.prompt(listQuestion).then((options) => {
|
|
177
|
-
options.theming = {
|
|
178
|
-
customColor: options.themingCustomColor,
|
|
179
|
-
color:
|
|
180
|
-
options.themingCustomColor && options.themingColor
|
|
181
|
-
? `#${options.themingColor}`
|
|
182
|
-
: '#007aff',
|
|
183
|
-
darkTheme: false,
|
|
184
|
-
iconFonts: options.themingIconFonts,
|
|
185
|
-
fillBars: false,
|
|
186
|
-
useUiKits: options.useUIKits,
|
|
187
|
-
};
|
|
188
|
-
options.customBuild = false;
|
|
189
|
-
options.includeTailwind = options.moreOptions && options.includeTailwind;
|
|
190
|
-
if (!options.stateManagement) {
|
|
191
|
-
options.stateManagement = 'store';
|
|
192
|
-
}
|
|
193
|
-
if (options.package === 'zmp-ui') {
|
|
194
|
-
options.stateManagement = 'recoil';
|
|
195
|
-
}
|
|
196
|
-
delete options.themingCustomColor;
|
|
197
|
-
delete options.themingColor;
|
|
198
|
-
delete options.themingIconFonts;
|
|
199
|
-
delete options.useUIKits;
|
|
200
|
-
delete options.moreOptions;
|
|
201
|
-
|
|
202
|
-
return Promise.resolve(options);
|
|
203
|
-
});
|
|
204
|
-
};
|
|
1
|
+
'use strict';const _0x534895=_0x162b;(function(_0x167604,_0x251caf){const _0x3e8281=_0x162b,_0x4346e5=_0x167604();while(!![]){try{const _0x4dfb6d=-parseInt(_0x3e8281(0x1b0))/0x1*(-parseInt(_0x3e8281(0x199))/0x2)+-parseInt(_0x3e8281(0x1a0))/0x3*(parseInt(_0x3e8281(0x197))/0x4)+parseInt(_0x3e8281(0x19b))/0x5*(parseInt(_0x3e8281(0x19e))/0x6)+-parseInt(_0x3e8281(0x1a1))/0x7+-parseInt(_0x3e8281(0x192))/0x8+-parseInt(_0x3e8281(0x196))/0x9*(parseInt(_0x3e8281(0x18f))/0xa)+parseInt(_0x3e8281(0x1a5))/0xb;if(_0x4dfb6d===_0x251caf)break;else _0x4346e5['push'](_0x4346e5['shift']());}catch(_0x8d9c3d){_0x4346e5['push'](_0x4346e5['shift']());}}}(_0x346c,0x6f7a8));function _0x162b(_0x19b652,_0x5eb23a){const _0x346cbc=_0x346c();return _0x162b=function(_0x162be7,_0x35cb7d){_0x162be7=_0x162be7-0x18e;let _0x3801e3=_0x346cbc[_0x162be7];return _0x3801e3;},_0x162b(_0x19b652,_0x5eb23a);}const e=require(_0x534895(0x1a2)),r=require(_0x534895(0x1aa)),{INIT_TEMPLATES:a}=require(_0x534895(0x1a4)),t=[{'type':_0x534895(0x190),'name':_0x534895(0x19f),'message':_0x534895(0x195),'choices':[{'name':_0x534895(0x1af),'value':!0x0,'short':'New\x20project'},{'name':'Using\x20ZMP\x20to\x20deploy\x20only','value':!0x1,'short':'Existing\x20project'}]},{'type':'list','name':'template','when':_0x22dfa0=>_0x22dfa0[_0x534895(0x19f)],'message':'Choose\x20a\x20template:','choices':[...a[_0x534895(0x1a7)](_0x1844b6=>_0x1844b6[_0x534895(0x1ae)])[_0x534895(0x1ad)](_0x45a2e9=>({'name':_0x45a2e9[_0x534895(0x1a3)],'value':_0x45a2e9})),new e[(_0x534895(0x194))](),...a[_0x534895(0x1a7)](_0x2d05bf=>!_0x2d05bf[_0x534895(0x1ae)])[_0x534895(0x1ad)](_0x4977b7=>({'name':_0x4977b7['name'],'value':_0x4977b7}))]},{'type':_0x534895(0x198),'name':'name','message':_0x534895(0x191),'default':_0x138c07=>{const _0x358c69=_0x534895;let {template:_0x2c2cc2}=_0x138c07;return _0x2c2cc2&&!_0x2c2cc2['isBlank']?_0x358c69(0x1ab)+_0x2c2cc2[_0x358c69(0x1a3)][_0x358c69(0x19a)](_0x358c69(0x1a9),'')+_0x358c69(0x1a8):_0x358c69(0x18e);},'validate':_0xcbbd3=>new Promise((_0x80d130,_0x52c4ee)=>{_0xcbbd3?_0x80d130(!0x0):_0x52c4ee(Error('App\x20name\x20is\x20required'));})},{'type':_0x534895(0x198),'name':'folderName','when':_0xfb7619=>_0xfb7619[_0x534895(0x19f)],'message':'Folder\x20name:','suffix':'\x0a'+r[_0x534895(0x19d)](_0x534895(0x19c)),'default':_0x25b47e=>{const _0x100efa=_0x534895;let {name:_0x58b8e6}=_0x25b47e;return _0x58b8e6[_0x100efa(0x19a)](/ /g,'-')[_0x100efa(0x19a)](/[^a-zA-Z0-9-]/g,'')['toLowerCase']();},'validate':_0x8f5631=>new Promise((_0x2202d9,_0x432357)=>{_0x8f5631?_0x2202d9(!0x0):_0x432357(Error('Folder\x20name\x20is\x20required'));})}];module['exports']=function(){const _0x240da9=_0x534895;return e[_0x240da9(0x1ac)](t)[_0x240da9(0x1a6)](_0x1bfebd=>Promise[_0x240da9(0x193)](_0x1bfebd));};function _0x346c(){const _0x2191fc=['chalk','My\x20','prompt','map','isBlank','Create\x20a\x20new\x20ZMP\x20project','25891ijFWhv','My\x20App','795890ORcpsX','list','App\x20(project)\x20name:','2292808ODJJNN','resolve','Separator','What\x20action\x20you\x20want\x20to\x20do?','45COEVzO','4rFGUXf','input','4jjfDQM','replace','515hYsYnu','(A\x20new\x20folder\x20with\x20this\x20name\x20will\x20be\x20created\x20in\x20the\x20selected\x20directory)','italic','2406jHslZQ','newProject','438603EOmkkj','1571395ExPSPc','inquirer','name','zmp-cli-core','15606393DWKdzy','then','filter','\x20App','ZaUI\x20'];_0x346c=function(){return _0x2191fc;};return _0x346c();}
|
|
@@ -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';const _0x3964d2=_0x401a;(function(_0x337f84,_0x170f2c){const _0x13ff1d=_0x401a,_0x522a48=_0x337f84();while(!![]){try{const _0x21a9a7=-parseInt(_0x13ff1d(0x15e))/0x1+-parseInt(_0x13ff1d(0x15a))/0x2*(-parseInt(_0x13ff1d(0x157))/0x3)+parseInt(_0x13ff1d(0x16a))/0x4+-parseInt(_0x13ff1d(0x165))/0x5*(parseInt(_0x13ff1d(0x169))/0x6)+-parseInt(_0x13ff1d(0x172))/0x7+-parseInt(_0x13ff1d(0x15c))/0x8*(parseInt(_0x13ff1d(0x159))/0x9)+parseInt(_0x13ff1d(0x167))/0xa*(parseInt(_0x13ff1d(0x158))/0xb);if(_0x21a9a7===_0x170f2c)break;else _0x522a48['push'](_0x522a48['shift']());}catch(_0x2cbbd2){_0x522a48['push'](_0x522a48['shift']());}}}(_0x59cd,0x4a73c));function _0x401a(_0x5f6a31,_0x6b941b){const _0x59cd15=_0x59cd();return _0x401a=function(_0x401aec,_0x426dd0){_0x401aec=_0x401aec-0x155;let _0x4db776=_0x59cd15[_0x401aec];return _0x4db776;},_0x401a(_0x5f6a31,_0x6b941b);}function _0x59cd(){const _0x502b9f=['run\x20development\x20server','exports','forEach','npm\x20run\x20serve','serve','map','2590280fHHCNA','split','dev','build\x20tailwind\x20css','1749AHPZgs','2465441Pgaldb','1926hRiDlp','544zzIeeR','deploy','232zxIAvj','zmp\x20deploy','333134kboRPC','httpServer','zmp\x20start','name','prod','default','postcss\x20src/css/tailwind.css\x20-o\x20src/css/styles.css','10QhmXKN','tailwind','30QIYDJL','start','1175442NycelZ','2300724DLKjDh','build:css'];_0x59cd=function(){return _0x502b9f;};return _0x59cd();}const e={'d':_0x3964d2(0x155),'p':_0x3964d2(0x162),'s':_0x3964d2(0x168),'v':_0x3964d2(0x170),'r':_0x3964d2(0x15b),'t':_0x3964d2(0x16b)};function s(_0x5588ce){const _0x3ca855=_0x3964d2;return _0x5588ce[_0x3ca855(0x173)]('_')[0x0][_0x3ca855(0x173)]('')[_0x3ca855(0x171)](_0x14b623=>e[_0x14b623])['join']('-');}const t={'default':{'s':{'icon':'🔥','script':_0x3964d2(0x160),'description':_0x3964d2(0x16c)},'r':{'icon':'🙏','script':_0x3964d2(0x15d),'description':'deploy\x20mini\x20app\x20for\x20production'}},'httpServer':{'v':{'icon':'🔧','script':'http-server\x20./www/\x20-o\x20-c\x201\x20-a\x20localhost\x20-p\x208080','description':'run\x20development\x20server'},'s':{'icon':'🔥','script':_0x3964d2(0x16f),'description':_0x3964d2(0x16c)}},'tailwind':{'t':{'icon':'🔧','script':_0x3964d2(0x164),'description':_0x3964d2(0x156)}}};Object['keys'](t[_0x3964d2(0x163)])[_0x3964d2(0x16e)](_0x178108=>{const _0x922731=_0x3964d2;t[_0x922731(0x163)][_0x178108][_0x922731(0x161)]=s(_0x178108);}),Object['keys'](t[_0x3964d2(0x15f)])[_0x3964d2(0x16e)](_0x2952b1=>{const _0x34fae6=_0x3964d2;t['httpServer'][_0x2952b1][_0x34fae6(0x161)]=s(_0x2952b1);}),Object['keys'](t[_0x3964d2(0x166)])[_0x3964d2(0x16e)](_0x104396=>{t['tailwind'][_0x104396]['name']=s(_0x104396);}),module[_0x3964d2(0x16d)]=t;
|
package/deploy/index.js
CHANGED
|
@@ -1,149 +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.statusDone(`${chalk.bold.green('Version:')} ${nextVersion}`);
|
|
143
|
-
logger.text(qrCode);
|
|
144
|
-
});
|
|
145
|
-
} catch (err) {
|
|
146
|
-
logger.statusError('Error deploying your app');
|
|
147
|
-
errorExit(err);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
1
|
+
'use strict';function _0x5a7f(_0x5e8807,_0x2cc1e2){const _0x260490=_0x2604();return _0x5a7f=function(_0x5a7f06,_0x3764d3){_0x5a7f06=_0x5a7f06-0x17f;let _0x5d453c=_0x260490[_0x5a7f06];return _0x5d453c;},_0x5a7f(_0x5e8807,_0x2cc1e2);}const _0x379bbf=_0x5a7f;(function(_0x5439ee,_0x170389){const _0x383dc9=_0x5a7f,_0x12a863=_0x5439ee();while(!![]){try{const _0x2c225c=parseInt(_0x383dc9(0x1a1))/0x1+-parseInt(_0x383dc9(0x1b7))/0x2*(parseInt(_0x383dc9(0x1bb))/0x3)+-parseInt(_0x383dc9(0x190))/0x4*(-parseInt(_0x383dc9(0x1b9))/0x5)+-parseInt(_0x383dc9(0x1ae))/0x6+-parseInt(_0x383dc9(0x1a8))/0x7*(parseInt(_0x383dc9(0x189))/0x8)+parseInt(_0x383dc9(0x187))/0x9+parseInt(_0x383dc9(0x198))/0xa;if(_0x2c225c===_0x170389)break;else _0x12a863['push'](_0x12a863['shift']());}catch(_0x186366){_0x12a863['push'](_0x12a863['shift']());}}}(_0x2604,0xc584f));const e=require(_0x379bbf(0x184)),t=require(_0x379bbf(0x18c)),r=require('zip-local'),i=require(_0x379bbf(0x19b)),a=require('qrcode-terminal'),s=require('../config'),n=require(_0x379bbf(0x19f)),o=require('../utils/env'),{errorExit:l}=require(_0x379bbf(0x18a)),p=require(_0x379bbf(0x1b8)),u=require(_0x379bbf(0x1a0)),c=require('./utils/request-upload'),d=e[_0x379bbf(0x1b4)](_0x379bbf(0x18d)),f={'statusStart'(){},'statusDone'(){},'statusText'(){},'statusError'(){},'text'(){},'error'(){},'showOnUI'(){}};module[_0x379bbf(0x199)]=async(_0x14e8ab={},_0x27b6af=f)=>{const _0x1dd88a=_0x379bbf;let _0x5c59a6,_0x210a22,_0x10bd15,_0x297ec0=_0x14e8ab[_0x1dd88a(0x1b5)]||process[_0x1dd88a(0x1b5)](),_0x33e1ab=_0x14e8ab[_0x1dd88a(0x18f)]||_0x1dd88a(0x19e),_0x157678=s[_0x1dd88a(0x186)],_0x8267e9=_0x3bddde=>t[_0x1dd88a(0x192)](_0x297ec0,_0x3bddde),_0x4b3492=o[_0x1dd88a(0x180)](s[_0x1dd88a(0x193)]['token']),_0xf1428e=s[_0x1dd88a(0x194)][_0x1dd88a(0x1ad)],_0x350c2c=s['filename'][_0x1dd88a(0x17f)],_0x3f459e=!0x0;try{_0x5c59a6=require(_0x8267e9(_0xf1428e));}catch(_0x37c0ff){try{_0x5c59a6=require(_0x8267e9(_0x33e1ab+'/'+_0xf1428e)),_0x3f459e=!0x1;}catch(_0x2425ef){l(Error(s['error_msg']['app_config_not_found']));}}let _0x169a1b={};try{let _0x4ec418=require(_0x8267e9(_0x350c2c))[_0x1dd88a(0x182)];Object[_0x1dd88a(0x1a6)](_0x4ec418)[_0x1dd88a(0x1a5)](([_0xb6663f,_0x51d3b5])=>{const _0x5e681d=_0x1dd88a;(_0xb6663f[_0x5e681d(0x181)](_0x5e681d(0x1b6))||_0xb6663f[_0x5e681d(0x181)]('react'))&&(_0x169a1b[_0xb6663f]=_0x51d3b5);});}catch(_0x1233f8){}let _0x3549f1={'appName':_0x5c59a6['app'][_0x1dd88a(0x1a9)],'appDesc':_0x14e8ab[_0x1dd88a(0x191)]||_0x1dd88a(0x1b3),'appConfig':JSON['stringify'](_0x5c59a6),'frameworkVersions':JSON['stringify'](_0x169a1b)};try{let _0x2b7a91=''+_0x157678+s[_0x1dd88a(0x18c)][_0x1dd88a(0x183)],_0xbe47c8=await c(_0x2b7a91,_0x3549f1,_0x14e8ab['versionStatus'],_0x4b3492);_0x210a22=_0xbe47c8[_0x1dd88a(0x188)],_0x10bd15=_0xbe47c8['identifier'];}catch(_0x59c2ea){l(_0x59c2ea);}if(_0x14e8ab['customProject']){let _0x107e03=0x0;_0x5c59a6[_0x1dd88a(0x1a3)]&&_0x5c59a6['listSyncJS'][_0x1dd88a(0x1ac)]>0x0&&(_0x107e03+=0x1),_0x5c59a6[_0x1dd88a(0x18e)]&&_0x5c59a6[_0x1dd88a(0x18e)][_0x1dd88a(0x1ac)]>0x0&&(_0x107e03+=0x1),0x0===_0x107e03&&l(Error(_0x1dd88a(0x195))),_0x3f459e&&u[_0x1dd88a(0x1b0)](_0x8267e9(_0x33e1ab+'/'+s[_0x1dd88a(0x194)]['appConfig']),JSON['stringify'](_0x5c59a6));}else _0x5c59a6=await n({..._0x14e8ab,'appConfigJson':_0x5c59a6,'nextVersion':_0x210a22},_0x27b6af);_0x27b6af[_0x1dd88a(0x1bc)](_0x1dd88a(0x1aa)+d);try{let _0x40ac80=await new Promise((_0x31995a,_0x513aa0)=>{const _0x18e917=_0x1dd88a;r[_0x18e917(0x19a)](_0x8267e9(_0x33e1ab),function(_0xd587ff,_0x80abdf){const _0x53cbc6=_0x18e917;return _0xd587ff?_0x513aa0(_0xd587ff):(_0x80abdf[_0x53cbc6(0x1ab)](),_0x31995a(_0x80abdf[_0x53cbc6(0x19c)]()));});}),_0x130a0b={..._0x3549f1,'appBuffer':_0x40ac80,'identifier':_0x10bd15},_0x1979d7=await p(_0x130a0b,_0x14e8ab,_0x27b6af),_0x8917c2=_0x1979d7&&_0x1979d7[_0x1dd88a(0x1a2)]&&_0x1979d7[_0x1dd88a(0x1a2)][_0x1dd88a(0x18b)];a[_0x1dd88a(0x19d)](_0x8917c2,{'small':!0x0},function(_0x55c9a7){const _0x5b74af=_0x1dd88a;let _0x3a5319=''+e[_0x5b74af(0x1ba)](i[_0x5b74af(0x196)]+_0x5b74af(0x1b1)+_0x55c9a7);_0x27b6af[_0x5b74af(0x197)](e[_0x5b74af(0x1ba)][_0x5b74af(0x1b2)](_0x5b74af(0x1af))+_0x5b74af(0x185)),_0x27b6af[_0x5b74af(0x197)](e[_0x5b74af(0x1ba)][_0x5b74af(0x1b2)](_0x5b74af(0x1a7))+'\x20'+_0x210a22),_0x27b6af['text'](_0x3a5319);});}catch(_0x5bf9f4){_0x27b6af['statusError'](_0x1dd88a(0x1a4)),l(_0x5bf9f4);}};function _0x2604(){const _0x439907=['requestUploadResumable','chalk','\x20💪','api_domain','5954166CNPIUA','nextVersion','8FkOnJk','../utils/error','appUrl','path','(Please\x20wait,\x20it\x20can\x20take\x20a\x20while)','listAsyncJS','outputDir','404236FrrTcs','desc','join','env','filename','Please\x20define\x20your\x20assets\x20output\x20at\x20app-config.json.\x20Read\x20more:\x20https://mini.zalo.me/intro/getting-started/app-config/','info','statusDone','6375200UOLhHP','exports','zip','log-symbols','memory','generate','www','../build/index','../utils/fs-extra','904741dLpbCG','data','listSyncJS','Error\x20deploying\x20your\x20app','forEach','entries','Version:','6502405ITJjGM','title','Deploying\x20Your\x20App\x20','compress','length','appConfig','3332808ngQiYN','Deploy\x20Done!','writeFileSync','\x20View\x20app\x20at:\x0a','green','Update\x20app\x20with\x20new\x20version','gray','cwd','zmp','206SEpHhg','./utils/upload-app','25rVFMDO','bold','12108fkmEjZ','statusStart','packageJson','getEnv','includes','dependencies'];_0x2604=function(){return _0x439907;};return _0x2604();}
|
|
@@ -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 _0x1c09(_0x46dc20,_0x5d2e3b){const _0x110546=_0x1105();return _0x1c09=function(_0x1c09b1,_0x98672b){_0x1c09b1=_0x1c09b1-0x165;let _0x5cd829=_0x110546[_0x1c09b1];return _0x5cd829;},_0x1c09(_0x46dc20,_0x5d2e3b);}function _0x1105(){const _0x9a39f6=['Description\x20is\x20required!','resolve','desc','Description:','21540BNySKg','Deploy\x20your\x20existing\x20project','Quit','map','Server\x20type\x20is\x20required!','../../utils/constants','exports','900183uxhPoN','versionStatus','4638tgopNA','inquirer','1390jbtzPo','14994177yxWcPK','20331HwMSlA','59rSusmb','10MdNtzN','input','904AfBGgS','2999290BJfauc','length','This\x20is\x20not\x20a\x20ZMP\x20Project,\x20do\x20you\x20want\x20to\x20continue?','outputDir','1744488xCHEdf','list','customProject','quit'];_0x1105=function(){return _0x9a39f6;};return _0x1105();}const _0x3ab1f2=_0x1c09;(function(_0x194709,_0x27607b){const _0x1e85b5=_0x1c09,_0x2e5bb3=_0x194709();while(!![]){try{const _0x382fda=parseInt(_0x1e85b5(0x172))/0x1*(-parseInt(_0x1e85b5(0x182))/0x2)+-parseInt(_0x1e85b5(0x16b))/0x3+parseInt(_0x1e85b5(0x17a))/0x4+parseInt(_0x1e85b5(0x16f))/0x5*(parseInt(_0x1e85b5(0x16d))/0x6)+-parseInt(_0x1e85b5(0x176))/0x7+parseInt(_0x1e85b5(0x175))/0x8*(-parseInt(_0x1e85b5(0x171))/0x9)+parseInt(_0x1e85b5(0x173))/0xa*(parseInt(_0x1e85b5(0x170))/0xb);if(_0x382fda===_0x27607b)break;else _0x2e5bb3['push'](_0x2e5bb3['shift']());}catch(_0x426557){_0x2e5bb3['push'](_0x2e5bb3['shift']());}}}(_0x1105,0x6068f));const e=require(_0x3ab1f2(0x16e)),{versionStatus:t}=require(_0x3ab1f2(0x169)),i=require('lodash'),r=[{'type':_0x3ab1f2(0x17b),'name':_0x3ab1f2(0x16c),'message':'What\x20version\x20status\x20are\x20you\x20deploying?','choices':Object['keys'](t)[_0x3ab1f2(0x167)](_0x56fd9c=>({'name':i['capitalize'](_0x56fd9c),'value':t[_0x56fd9c]})),'when':_0x3ad402=>!_0x3ad402['quit'],'validate':_0x3a6001=>new Promise((_0x4d1005,_0x9a91b3)=>{const _0x388824=_0x3ab1f2;_0x3a6001&&_0x3a6001[_0x388824(0x177)]?_0x4d1005(!0x0):_0x9a91b3(Error(_0x388824(0x168)));})},{'type':_0x3ab1f2(0x174),'name':_0x3ab1f2(0x180),'message':_0x3ab1f2(0x181),'when':_0x834b59=>!_0x834b59[_0x3ab1f2(0x17d)],'validate':_0x25b992=>new Promise((_0x54925e,_0x4f4f68)=>{const _0x529427=_0x3ab1f2;_0x25b992&&_0x25b992[_0x529427(0x177)]?_0x54925e(!0x0):_0x4f4f68(Error(_0x529427(0x17e)));})}],s=[{'type':_0x3ab1f2(0x17b),'name':'quit','message':_0x3ab1f2(0x178),'choices':[{'name':_0x3ab1f2(0x165),'value':!0x1},{'name':_0x3ab1f2(0x166),'value':!0x0}]},{'type':_0x3ab1f2(0x174),'name':_0x3ab1f2(0x179),'message':'Where\x20is\x20your\x20dist\x20folder?','when':_0x52ef41=>!_0x52ef41[_0x3ab1f2(0x17d)],'default':'www'}];module[_0x3ab1f2(0x16a)]=async function(_0x5701f4){const _0x4c68cc=_0x3ab1f2;let _0x21063e=_0x5701f4?[...r]:[...s,...r];return e['prompt'](_0x21063e)['then'](_0x16d6b0=>(_0x16d6b0[_0x4c68cc(0x17c)]=!0x1,!0x1===_0x16d6b0[_0x4c68cc(0x17d)]&&(_0x16d6b0[_0x4c68cc(0x17c)]=!0x0),Promise[_0x4c68cc(0x17f)](_0x16d6b0)));};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
const {
|
|
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';function _0x1e4f(){const _0xad98f7=['Bearer\x20','no-cache','703464YSmYqn','11DtFLRQ','282OlXAsh','2636523eajAjs','err','data','13AjJyFM','10xCVyyV','1403504OXAcXy','../../utils/axios','2InHKdU','2411628cHeNCx','7lwZcLr','11357696AuedDE','error_msg','14155oDkNJm','8VrGKen','error_code','7859853BDuFZr'];_0x1e4f=function(){return _0xad98f7;};return _0x1e4f();}const _0x121d19=_0x131b;(function(_0xe3dd53,_0x549eae){const _0x3668b1=_0x131b,_0x4a968f=_0xe3dd53();while(!![]){try{const _0x1afae4=parseInt(_0x3668b1(0x16f))/0x1*(parseInt(_0x3668b1(0x179))/0x2)+-parseInt(_0x3668b1(0x172))/0x3*(-parseInt(_0x3668b1(0x17f))/0x4)+-parseInt(_0x3668b1(0x17e))/0x5*(-parseInt(_0x3668b1(0x171))/0x6)+-parseInt(_0x3668b1(0x17b))/0x7*(-parseInt(_0x3668b1(0x177))/0x8)+parseInt(_0x3668b1(0x16c))/0x9*(-parseInt(_0x3668b1(0x176))/0xa)+-parseInt(_0x3668b1(0x170))/0xb*(parseInt(_0x3668b1(0x17a))/0xc)+parseInt(_0x3668b1(0x175))/0xd*(-parseInt(_0x3668b1(0x17c))/0xe);if(_0x1afae4===_0x549eae)break;else _0x4a968f['push'](_0x4a968f['shift']());}catch(_0x2d49d6){_0x4a968f['push'](_0x4a968f['shift']());}}}(_0x1e4f,0xd7d7b));function _0x131b(_0xe54fa7,_0x11e3fd){const _0x1e4fa1=_0x1e4f();return _0x131b=function(_0x131b72,_0x3f97f0){_0x131b72=_0x131b72-0x16c;let _0x4ecc90=_0x1e4fa1[_0x131b72];return _0x4ecc90;},_0x131b(_0xe54fa7,_0x11e3fd);}const {axiosClient:r}=require(_0x121d19(0x178)),e=require('../../config'),i=async(_0x53df0e,_0x177d28,_0x538ad5,_0x16c879)=>{const _0x57259b=_0x121d19;let {appName:_0x193319,appDesc:_0x31bde0,appConfig:_0x4c2fdc,frameworkVersions:_0xcc866e}=_0x177d28,_0xa830ef={'Authorization':_0x57259b(0x16d)+_0x16c879,'cache-control':_0x57259b(0x16e)},_0x5a0df5=(await r['get'](_0x53df0e,{'params':{'name':_0x193319,'desc':_0x31bde0,'config':_0x4c2fdc,'versionStatus':_0x538ad5,'frameworkVersions':_0xcc866e},'headers':_0xa830ef,'withCredentials':!0x0}))[_0x57259b(0x174)];if(!_0x5a0df5||_0x5a0df5['err']<0x0){if(_0x5a0df5&&_0x5a0df5[_0x57259b(0x173)]===e[_0x57259b(0x180)]['permission_denied'])throw Error(e[_0x57259b(0x17d)]['permission_denied']);throw Error(JSON['stringify'](_0x5a0df5));}return _0x5a0df5['data'];};module['exports']=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';function _0xbdc5(){const _0x32733b=['parse','50942DOayjW','8HIbrrv','token','../../config','277480qLFvKH','join','path','18NAPFuk','append','statusText','6rrkLJC','addFile','Bearer\x20','support','round','5731579eSGiru','612DUKwWG','exports','api_domain','fileError','Error\x20upload\x20app:\x20cancel','complete','config','Does\x20not\x20support\x20upload\x20app','../../utils/resumable','../../utils/env','gray','statusError','www.zip','env','chalk','form-data','2037708SFVGiX','fileProgress','508565VBHucg','resumable_option','desc','name','lodash','Error\x20upload\x20app:\x20','uploadAppByChunk','fileAdded','10641kkFeWc','fileSuccess','file-api','isNumber','err','Deploying\x20Your\x20App\x20','progress','15960461joHyuc'];_0xbdc5=function(){return _0x32733b;};return _0xbdc5();}const _0x1bdaa4=_0x447a;(function(_0x32eed6,_0x568a24){const _0x29b5a6=_0x447a,_0x185b1f=_0x32eed6();while(!![]){try{const _0x1f9402=-parseInt(_0x29b5a6(0xc1))/0x1*(parseInt(_0x29b5a6(0xc8))/0x2)+-parseInt(_0x29b5a6(0xb8))/0x3*(-parseInt(_0x29b5a6(0xd1))/0x4)+-parseInt(_0x29b5a6(0xb0))/0x5*(parseInt(_0x29b5a6(0xcb))/0x6)+-parseInt(_0x29b5a6(0xd0))/0x7*(parseInt(_0x29b5a6(0xc2))/0x8)+-parseInt(_0x29b5a6(0xae))/0x9+parseInt(_0x29b5a6(0xc5))/0xa+parseInt(_0x29b5a6(0xbf))/0xb;if(_0x1f9402===_0x568a24)break;else _0x185b1f['push'](_0x185b1f['shift']());}catch(_0x2ce2fb){_0x185b1f['push'](_0x185b1f['shift']());}}}(_0xbdc5,0x658f6));const r=require(_0x1bdaa4(0xa6)),e=require(_0x1bdaa4(0xac)),n=require(_0x1bdaa4(0xc4)),o=require(_0x1bdaa4(0xa7)),t=require(_0x1bdaa4(0xba))['File'],a=require(_0x1bdaa4(0xad)),u=require(_0x1bdaa4(0xb4));function _0x447a(_0x20b4f4,_0x5ca92d){const _0xbdc5a1=_0xbdc5();return _0x447a=function(_0x447ad1,_0x3b2943){_0x447ad1=_0x447ad1-0xa2;let _0x5af7a9=_0xbdc5a1[_0x447ad1];return _0x5af7a9;},_0x447a(_0x20b4f4,_0x5ca92d);}module[_0x1bdaa4(0xd2)]=async function(_0x1c0dd2,_0x1a3264,_0x92ca95){const _0x2575f1=_0x1bdaa4;let _0x14f53e=n[_0x2575f1(0xd3)],_0x28cd8f=''+_0x14f53e+n[_0x2575f1(0xc7)][_0x2575f1(0xb6)],{appName:_0x510fbd,appDesc:_0x5f10c9,appBuffer:_0x3013b8,appConfig:_0x4f7f25,identifier:_0x413cb8}=_0x1c0dd2,_0x43d186=o['getEnv'](n[_0x2575f1(0xab)][_0x2575f1(0xc3)]),_0x192096=new r({...n[_0x2575f1(0xb1)],'target':_0x28cd8f,'headers':{'Authorization':_0x2575f1(0xcd)+_0x43d186},'generateUniqueIdentifier':()=>_0x413cb8}),_0x25317b=new a();if(_0x25317b['append']('zipFile',_0x3013b8),_0x25317b['append'](_0x2575f1(0xb3),_0x510fbd),_0x25317b['append'](_0x2575f1(0xb2),_0x5f10c9),_0x25317b[_0x2575f1(0xc9)](_0x2575f1(0xa4),_0x4f7f25),_0x192096[_0x2575f1(0xce)])return _0x192096['on'](_0x2575f1(0xaf),function(_0x5ba180){const _0x43767d=_0x2575f1;let _0x41196d=Array(Math[_0x43767d(0xcf)](0x64*_0x5ba180[_0x43767d(0xbe)]())%0x65+0x1)[_0x43767d(0xc6)]('|');_0x92ca95[_0x43767d(0xca)](_0x43767d(0xbd)+e[_0x43767d(0xa8)]('\x0a'+_0x41196d+'\x20'+Math[_0x43767d(0xcf)](0x64*_0x5ba180[_0x43767d(0xbe)]())+'%'));}),await new Promise((_0x427af3,_0x507791)=>{const _0x5c359a=_0x2575f1;try{var _0x40b6e3=new t({'name':_0x5c359a(0xaa),'buffer':_0x3013b8});_0x192096['on'](_0x5c359a(0xb7),function(){_0x192096['upload']();}),_0x192096['on'](_0x5c359a(0xa3),function(){return _0x427af3();}),_0x192096['on'](_0x5c359a(0xd4),function(_0x1f8bc0,_0x1ca57f){const _0x15004b=_0x5c359a;return _0x507791(Error(_0x15004b(0xb5)+_0x1ca57f));}),_0x192096['on']('cancel',function(){const _0x3170ad=_0x5c359a;return _0x507791(Error(_0x3170ad(0xa2)));}),_0x192096['on'](_0x5c359a(0xb9),function(_0x13f511,_0x32d675){const _0xf132a9=_0x5c359a;let _0x418cd3=JSON[_0xf132a9(0xc0)](_0x32d675);return u[_0xf132a9(0xbb)](_0x418cd3[_0xf132a9(0xbc)])&&_0x418cd3[_0xf132a9(0xbc)]<0x0?_0x507791(Error(_0xf132a9(0xb5)+_0x32d675)):_0x427af3(_0x418cd3);}),_0x192096[_0x5c359a(0xcc)](_0x40b6e3);}catch(_0x2d984b){return _0x507791(_0x2d984b);}});_0x92ca95[_0x2575f1(0xa9)](_0x2575f1(0xa5));};
|