zmp-cli 3.15.6 → 3.15.7
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 -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 +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/templates/react/dist/generate-scripts.dev.js +0 -23
- package/create/templates/react-typescript/dist/generate-scripts.dev.js +0 -23
- package/create/utils/dist/get-options.dev.js +0 -277
- 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/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,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var templateIf = require('../../utils/template-if');
|
|
4
|
-
|
|
5
|
-
var indent = require('../../utils/indent');
|
|
6
|
-
|
|
7
|
-
var stylesExtension = require('../../utils/styles-extension');
|
|
8
|
-
|
|
9
|
-
module.exports = function (options) {
|
|
10
|
-
var cssPreProcessor = options.cssPreProcessor,
|
|
11
|
-
theming = options.theming,
|
|
12
|
-
customBuild = options.customBuild,
|
|
13
|
-
includeTailwind = options.includeTailwind;
|
|
14
|
-
var scripts = '';
|
|
15
|
-
scripts += indent(0, "\n // Import React and ReactDOM\n import React from 'react';\n import { createRoot } from 'react-dom/client';\n\n // Import ZMP\n import ZMP from '".concat(customBuild ? './zmp-custom.js' : 'zmp-framework/core/lite-bundle', "';\n\n // Import ZMP-React Plugin\n import ZMPReact from 'zmp-framework/react';").concat(includeTailwind ? "\n\n // Import tailwind styles\n import './css/tailwind.css';\n " : '', "\n\n // Import ZMP Styles\n ").concat(templateIf(customBuild, function () {
|
|
16
|
-
return "\n import './css/zmp-custom.less';\n ";
|
|
17
|
-
}, function () {
|
|
18
|
-
return "\n import 'zmp-framework/".concat(theming.useUiKits ? 'zmp-bundle.min.css' : 'zmp.min.css', "';\n ");
|
|
19
|
-
}), "\n\n // Import Icons and App Custom Styles\n ").concat(templateIf(theming.iconFonts, function () {
|
|
20
|
-
return "\n import './css/icons.css';\n ";
|
|
21
|
-
}), "\n import './css/app.").concat(stylesExtension(cssPreProcessor), "';\n\n // Import App Component\n import App from './components/app.jsx';\n import appConfig from '../app-config.json';\n\n if (!window.APP_CONFIG) {\n window.APP_CONFIG = appConfig;\n }\n\n // Init ZMP React Plugin\n ZMP.use(ZMPReact)\n\n // Mount React App\n const root = createRoot(document.getElementById('app'));\n root.render(React.createElement(App));\n "));
|
|
22
|
-
return scripts.trim();
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var templateIf = require('../../utils/template-if');
|
|
4
|
-
|
|
5
|
-
var indent = require('../../utils/indent');
|
|
6
|
-
|
|
7
|
-
var stylesExtension = require('../../utils/styles-extension');
|
|
8
|
-
|
|
9
|
-
module.exports = function (options) {
|
|
10
|
-
var cssPreProcessor = options.cssPreProcessor,
|
|
11
|
-
theming = options.theming,
|
|
12
|
-
customBuild = options.customBuild,
|
|
13
|
-
includeTailwind = options.includeTailwind;
|
|
14
|
-
var scripts = '';
|
|
15
|
-
scripts += indent(0, "\n // Import React and ReactDOM\n import React from 'react';\n import { createRoot } from 'react-dom/client';\n\n // Import ZMP\n import ZMP from '".concat(customBuild ? './zmp-custom.js' : 'zmp-framework/core/lite-bundle', "';\n\n // Import ZMP-React Plugin\n import ZMPReact from 'zmp-framework/react';").concat(includeTailwind ? "\n\n // Import tailwind styles\n import './css/tailwind.css';\n " : '', "\n\n // Import ZMP Styles\n ").concat(templateIf(customBuild, function () {
|
|
16
|
-
return "\n import './css/zmp-custom.less';\n ";
|
|
17
|
-
}, function () {
|
|
18
|
-
return "\n import 'zmp-framework/".concat(theming.useUiKits ? 'zmp-bundle.min.css' : 'zmp.min.css', "';\n ");
|
|
19
|
-
}), "\n\n // Import Icons and App Custom Styles\n ").concat(templateIf(theming.iconFonts, function () {
|
|
20
|
-
return "\n import './css/icons.css';\n ";
|
|
21
|
-
}), "\n import './css/app.").concat(stylesExtension(cssPreProcessor), "';\n\n // Import App Component\n import App from './components/app';\n import appConfig from '../app-config.json';\n\n if (!(window as any).APP_CONFIG) {\n (window as any).APP_CONFIG = appConfig\n }\n\n // Init ZMP React Plugin\n ZMP.use(ZMPReact)\n\n // Mount React App\n const root = createRoot(document.getElementById('app')!);\n root.render(React.createElement(App));\n "));
|
|
22
|
-
return scripts.trim();
|
|
23
|
-
};
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/* eslint no-param-reassign: ["off"] */
|
|
4
|
-
var inquirer = require('inquirer');
|
|
5
|
-
|
|
6
|
-
var chalk = require('chalk');
|
|
7
|
-
|
|
8
|
-
var moreOptionsText = chalk.italic("\t- Including Tailwind CSS\n\t- Including Recoil (React only)");
|
|
9
|
-
var questions = [{
|
|
10
|
-
type: 'list',
|
|
11
|
-
name: 'newProject',
|
|
12
|
-
message: 'What action you want to do?',
|
|
13
|
-
choices: [{
|
|
14
|
-
name: 'Create a new ZMP project',
|
|
15
|
-
value: true
|
|
16
|
-
}, {
|
|
17
|
-
name: 'Using ZMP to deploy only',
|
|
18
|
-
value: false
|
|
19
|
-
}]
|
|
20
|
-
}, {
|
|
21
|
-
type: 'input',
|
|
22
|
-
name: 'name',
|
|
23
|
-
message: 'App (project) name:',
|
|
24
|
-
"default": 'My App',
|
|
25
|
-
validate: function validate(input) {
|
|
26
|
-
return new Promise(function (resolve, reject) {
|
|
27
|
-
if (!input) reject(new Error('App name is required'));else resolve(true);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
type: 'list',
|
|
32
|
-
name: 'package',
|
|
33
|
-
when: function when(opts) {
|
|
34
|
-
return opts.newProject;
|
|
35
|
-
},
|
|
36
|
-
message: 'Choose an UI library / UI framework:',
|
|
37
|
-
choices: [{
|
|
38
|
-
name: 'zmp-ui',
|
|
39
|
-
value: 'zmp-ui'
|
|
40
|
-
}]
|
|
41
|
-
}, // Framework
|
|
42
|
-
{
|
|
43
|
-
type: 'list',
|
|
44
|
-
name: 'framework',
|
|
45
|
-
when: function when(opts) {
|
|
46
|
-
return opts["package"] == 'zmp-framework';
|
|
47
|
-
},
|
|
48
|
-
message: 'What type of framework do you prefer?',
|
|
49
|
-
choices: [{
|
|
50
|
-
name: 'ZMP with React',
|
|
51
|
-
value: 'react'
|
|
52
|
-
}, {
|
|
53
|
-
name: 'ZMP with React (TypeScript)',
|
|
54
|
-
value: 'react-typescript'
|
|
55
|
-
}, {
|
|
56
|
-
name: 'ZMP with Vue.js',
|
|
57
|
-
value: 'vue'
|
|
58
|
-
}, {
|
|
59
|
-
name: 'ZMP Core',
|
|
60
|
-
value: 'core',
|
|
61
|
-
disabled: true
|
|
62
|
-
}]
|
|
63
|
-
}, {
|
|
64
|
-
type: 'list',
|
|
65
|
-
name: 'language',
|
|
66
|
-
when: function when(opts) {
|
|
67
|
-
return opts["package"] == 'zmp-ui';
|
|
68
|
-
},
|
|
69
|
-
message: 'What language do you prefer?',
|
|
70
|
-
choices: [{
|
|
71
|
-
name: 'ReactJS',
|
|
72
|
-
value: 'react'
|
|
73
|
-
}]
|
|
74
|
-
}, {
|
|
75
|
-
type: 'list',
|
|
76
|
-
name: 'useUIKits',
|
|
77
|
-
when: function when(opts) {
|
|
78
|
-
return opts["package"] === 'zmp-framework' && opts.framework !== 'vue';
|
|
79
|
-
},
|
|
80
|
-
message: 'Do you want to use Zalo UI kits style?',
|
|
81
|
-
"default": true,
|
|
82
|
-
choices: [{
|
|
83
|
-
name: 'Yes, i want to use UI kits style',
|
|
84
|
-
value: true
|
|
85
|
-
}, {
|
|
86
|
-
name: 'No, i want to use only styles with minimal required set of components',
|
|
87
|
-
value: false
|
|
88
|
-
}]
|
|
89
|
-
}, // Template
|
|
90
|
-
{
|
|
91
|
-
type: 'list',
|
|
92
|
-
name: 'template',
|
|
93
|
-
when: function when(opts) {
|
|
94
|
-
return opts.newProject && opts["package"] === 'zmp-framework' && opts.useUIKits && opts.framework !== 'vue';
|
|
95
|
-
},
|
|
96
|
-
message: 'Choose starter template:',
|
|
97
|
-
choices: [{
|
|
98
|
-
name: 'Blank',
|
|
99
|
-
value: 'blank'
|
|
100
|
-
}, {
|
|
101
|
-
name: 'Single View',
|
|
102
|
-
value: 'single-view'
|
|
103
|
-
}, {
|
|
104
|
-
name: 'Tabs Layout',
|
|
105
|
-
value: 'tabs'
|
|
106
|
-
}]
|
|
107
|
-
}, // Template
|
|
108
|
-
{
|
|
109
|
-
type: 'list',
|
|
110
|
-
name: 'template',
|
|
111
|
-
when: function when(opts) {
|
|
112
|
-
return opts.newProject && opts["package"] === 'zmp-framework' && !opts.useUIKits && opts.framework !== 'vue';
|
|
113
|
-
},
|
|
114
|
-
message: 'Choose starter template:',
|
|
115
|
-
choices: [{
|
|
116
|
-
name: 'Blank',
|
|
117
|
-
value: 'blank'
|
|
118
|
-
}]
|
|
119
|
-
}, {
|
|
120
|
-
type: 'list',
|
|
121
|
-
name: 'cssPreProcessor',
|
|
122
|
-
when: function when(opts) {
|
|
123
|
-
return opts.newProject;
|
|
124
|
-
},
|
|
125
|
-
message: 'Do you want to setup CSS Pre-Processor',
|
|
126
|
-
"default": false,
|
|
127
|
-
choices: [{
|
|
128
|
-
name: 'No, i am good with CSS',
|
|
129
|
-
value: false
|
|
130
|
-
}, {
|
|
131
|
-
name: 'Less',
|
|
132
|
-
value: 'less'
|
|
133
|
-
}, {
|
|
134
|
-
name: 'SCSS (SASS)',
|
|
135
|
-
value: 'scss'
|
|
136
|
-
}, {
|
|
137
|
-
name: 'Stylus',
|
|
138
|
-
value: 'stylus'
|
|
139
|
-
}]
|
|
140
|
-
}, // Template
|
|
141
|
-
{
|
|
142
|
-
type: 'list',
|
|
143
|
-
name: 'template',
|
|
144
|
-
when: function when(opts) {
|
|
145
|
-
return opts["package"] === 'zmp-ui';
|
|
146
|
-
},
|
|
147
|
-
message: 'Choose starter template:',
|
|
148
|
-
choices: [{
|
|
149
|
-
name: 'Blank',
|
|
150
|
-
value: 'blank'
|
|
151
|
-
}, {
|
|
152
|
-
name: 'Single View',
|
|
153
|
-
value: 'single-view'
|
|
154
|
-
}]
|
|
155
|
-
}, // Color
|
|
156
|
-
{
|
|
157
|
-
type: 'list',
|
|
158
|
-
name: 'themingCustomColor',
|
|
159
|
-
when: function when(opts) {
|
|
160
|
-
return opts.newProject && opts["package"] !== 'zmp-ui';
|
|
161
|
-
},
|
|
162
|
-
message: 'Do you want to specify custom theme color?',
|
|
163
|
-
choices: [{
|
|
164
|
-
name: 'No, use default color theme',
|
|
165
|
-
value: false
|
|
166
|
-
}, {
|
|
167
|
-
name: 'Yes, i want to specify my brand color',
|
|
168
|
-
value: true
|
|
169
|
-
}]
|
|
170
|
-
}, {
|
|
171
|
-
type: 'input',
|
|
172
|
-
name: 'themingColor',
|
|
173
|
-
message: 'Enter custom theme color in HEX format (e.g. ff0000)',
|
|
174
|
-
when: function when(opts) {
|
|
175
|
-
return opts.themingCustomColor === true;
|
|
176
|
-
},
|
|
177
|
-
validate: function validate(input) {
|
|
178
|
-
return new Promise(function (resolve, reject) {
|
|
179
|
-
var num = input.replace(/#/g, '');
|
|
180
|
-
if (num.length === 3 || num.length === 6) resolve(true);else reject(new Error("It doesn't look like a correct HEX number"));
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
filter: function filter(input) {
|
|
184
|
-
return input.replace(/#/g, '');
|
|
185
|
-
}
|
|
186
|
-
}, {
|
|
187
|
-
type: 'list',
|
|
188
|
-
name: 'themingIconFonts',
|
|
189
|
-
when: function when(opts) {
|
|
190
|
-
return opts.newProject && opts["package"] !== 'zmp-ui';
|
|
191
|
-
},
|
|
192
|
-
message: 'Do you want to include ZMP Icons and Material Icons icon fonts?',
|
|
193
|
-
"default": true,
|
|
194
|
-
choices: [{
|
|
195
|
-
name: 'Yes, include icon fonts',
|
|
196
|
-
value: true
|
|
197
|
-
}, {
|
|
198
|
-
name: 'No, i want to use my own custom icons',
|
|
199
|
-
value: false
|
|
200
|
-
}]
|
|
201
|
-
}, {
|
|
202
|
-
type: 'list',
|
|
203
|
-
name: 'moreOptions',
|
|
204
|
-
when: function when(opts) {
|
|
205
|
-
return opts.newProject;
|
|
206
|
-
},
|
|
207
|
-
message: "More Options?\n".concat(moreOptionsText),
|
|
208
|
-
"default": false,
|
|
209
|
-
choices: [{
|
|
210
|
-
name: 'No, I want to complete initializing process now',
|
|
211
|
-
value: false
|
|
212
|
-
}, {
|
|
213
|
-
name: 'Yes, I want to get more options',
|
|
214
|
-
value: true
|
|
215
|
-
}]
|
|
216
|
-
}, {
|
|
217
|
-
type: 'list',
|
|
218
|
-
name: 'includeTailwind',
|
|
219
|
-
when: function when(opts) {
|
|
220
|
-
return opts.moreOptions;
|
|
221
|
-
},
|
|
222
|
-
message: 'Do you want to include Tailwind CSS?',
|
|
223
|
-
"default": true,
|
|
224
|
-
choices: [{
|
|
225
|
-
name: 'Yes, I want to iclude Tailwind CSS',
|
|
226
|
-
value: true
|
|
227
|
-
}, {
|
|
228
|
-
name: 'No',
|
|
229
|
-
value: false
|
|
230
|
-
}]
|
|
231
|
-
}, {
|
|
232
|
-
type: 'list',
|
|
233
|
-
name: 'stateManagement',
|
|
234
|
-
when: function when(opts) {
|
|
235
|
-
return opts.moreOptions && (opts.framework === 'react' || opts.framework === 'react-typescript');
|
|
236
|
-
},
|
|
237
|
-
message: 'Which state management library would you like to use?',
|
|
238
|
-
"default": 'store',
|
|
239
|
-
choices: [{
|
|
240
|
-
name: 'ZMP Store (Redux pattern)',
|
|
241
|
-
value: 'store'
|
|
242
|
-
}, {
|
|
243
|
-
name: 'Recoil',
|
|
244
|
-
value: 'recoil'
|
|
245
|
-
}]
|
|
246
|
-
}];
|
|
247
|
-
|
|
248
|
-
module.exports = function getOptions() {
|
|
249
|
-
var listQuestion = questions;
|
|
250
|
-
return inquirer.prompt(listQuestion).then(function (options) {
|
|
251
|
-
options.theming = {
|
|
252
|
-
customColor: options.themingCustomColor,
|
|
253
|
-
color: options.themingCustomColor && options.themingColor ? "#".concat(options.themingColor) : '#007aff',
|
|
254
|
-
darkTheme: false,
|
|
255
|
-
iconFonts: options.themingIconFonts,
|
|
256
|
-
fillBars: false,
|
|
257
|
-
useUiKits: options.useUIKits
|
|
258
|
-
};
|
|
259
|
-
options.customBuild = false;
|
|
260
|
-
options.includeTailwind = options.moreOptions && options.includeTailwind;
|
|
261
|
-
|
|
262
|
-
if (!options.stateManagement) {
|
|
263
|
-
options.stateManagement = 'store';
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (options["package"] === 'zmp-ui') {
|
|
267
|
-
options.stateManagement = 'recoil';
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
delete options.themingCustomColor;
|
|
271
|
-
delete options.themingColor;
|
|
272
|
-
delete options.themingIconFonts;
|
|
273
|
-
delete options.useUIKits;
|
|
274
|
-
delete options.moreOptions;
|
|
275
|
-
return Promise.resolve(options);
|
|
276
|
-
});
|
|
277
|
-
};
|
package/deploy/dist/index.dev.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/* eslint no-console: off */
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
15
|
-
|
|
16
|
-
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
-
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
|
-
var chalk = require('chalk');
|
|
21
|
-
|
|
22
|
-
var path = require('path');
|
|
23
|
-
|
|
24
|
-
var zipper = require('zip-local');
|
|
25
|
-
|
|
26
|
-
var logSymbols = require('log-symbols');
|
|
27
|
-
|
|
28
|
-
var qrcode = require('qrcode-terminal');
|
|
29
|
-
|
|
30
|
-
var config = require('../config');
|
|
31
|
-
|
|
32
|
-
var buildApp = require('../build/index');
|
|
33
|
-
|
|
34
|
-
var envUtils = require('../utils/env');
|
|
35
|
-
|
|
36
|
-
var uploadApp = require('./utils/upload-app');
|
|
37
|
-
|
|
38
|
-
var fse = require('../utils/fs-extra');
|
|
39
|
-
|
|
40
|
-
var requestUpload = require('./utils/request-upload');
|
|
41
|
-
|
|
42
|
-
var waitText = chalk.gray('(Please wait, it can take a while)');
|
|
43
|
-
var defaultLogger = {
|
|
44
|
-
statusStart: function statusStart() {},
|
|
45
|
-
statusDone: function statusDone() {},
|
|
46
|
-
statusText: function statusText() {},
|
|
47
|
-
statusError: function statusError() {},
|
|
48
|
-
text: function text() {},
|
|
49
|
-
error: function error() {},
|
|
50
|
-
showOnUI: function showOnUI() {}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
module.exports = function _callee() {
|
|
54
|
-
var options,
|
|
55
|
-
logger,
|
|
56
|
-
_ref,
|
|
57
|
-
_ref$exitOnError,
|
|
58
|
-
exitOnError,
|
|
59
|
-
cwd,
|
|
60
|
-
outputDir,
|
|
61
|
-
apiDomain,
|
|
62
|
-
resolvePath,
|
|
63
|
-
errorExit,
|
|
64
|
-
token,
|
|
65
|
-
appConfigFilename,
|
|
66
|
-
packageJsonFilename,
|
|
67
|
-
appConfigJson,
|
|
68
|
-
packageJson,
|
|
69
|
-
frameworkVersions,
|
|
70
|
-
dependencies,
|
|
71
|
-
dataRequest,
|
|
72
|
-
nextVersion,
|
|
73
|
-
identifier,
|
|
74
|
-
urlRequestUpload,
|
|
75
|
-
requestUploadData,
|
|
76
|
-
flag,
|
|
77
|
-
buffer,
|
|
78
|
-
uploadData,
|
|
79
|
-
uploadRes,
|
|
80
|
-
appURL,
|
|
81
|
-
_args = arguments;
|
|
82
|
-
|
|
83
|
-
return regeneratorRuntime.async(function _callee$(_context) {
|
|
84
|
-
while (1) {
|
|
85
|
-
switch (_context.prev = _context.next) {
|
|
86
|
-
case 0:
|
|
87
|
-
errorExit = function _ref4(err) {
|
|
88
|
-
logger.error(err.stderr || err);
|
|
89
|
-
if (exitOnError) process.exit(1);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
93
|
-
logger = _args.length > 1 && _args[1] !== undefined ? _args[1] : defaultLogger;
|
|
94
|
-
_ref = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}, _ref$exitOnError = _ref.exitOnError, exitOnError = _ref$exitOnError === void 0 ? true : _ref$exitOnError;
|
|
95
|
-
cwd = options.cwd || process.cwd();
|
|
96
|
-
outputDir = options.outputDir || 'www';
|
|
97
|
-
apiDomain = config.api_domain;
|
|
98
|
-
|
|
99
|
-
resolvePath = function resolvePath(dir) {
|
|
100
|
-
return path.join(cwd, dir);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
token = envUtils.getEnv(config.env.token);
|
|
104
|
-
appConfigFilename = config.filename.appConfig;
|
|
105
|
-
packageJsonFilename = config.filename.packageJson;
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
appConfigJson = require(resolvePath(appConfigFilename));
|
|
109
|
-
} catch (err) {
|
|
110
|
-
errorExit(new Error(config.error_msg.app_config_not_found));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
frameworkVersions = {};
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
packageJson = require(resolvePath(packageJsonFilename));
|
|
117
|
-
dependencies = packageJson.dependencies;
|
|
118
|
-
Object.entries(dependencies).forEach(function (_ref2) {
|
|
119
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
120
|
-
key = _ref3[0],
|
|
121
|
-
value = _ref3[1];
|
|
122
|
-
|
|
123
|
-
if (key.includes('zmp') || key.includes('react')) {
|
|
124
|
-
frameworkVersions[key] = value;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
} catch (err) {// pass
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
dataRequest = {
|
|
131
|
-
appName: appConfigJson.app.title,
|
|
132
|
-
appDesc: options.desc || 'Update app with new version',
|
|
133
|
-
appConfig: JSON.stringify(appConfigJson),
|
|
134
|
-
frameworkVersions: JSON.stringify(frameworkVersions)
|
|
135
|
-
};
|
|
136
|
-
_context.prev = 15;
|
|
137
|
-
urlRequestUpload = "".concat(apiDomain).concat(config.path.requestUploadResumable);
|
|
138
|
-
_context.next = 19;
|
|
139
|
-
return regeneratorRuntime.awrap(requestUpload(urlRequestUpload, dataRequest, options.versionStatus, token));
|
|
140
|
-
|
|
141
|
-
case 19:
|
|
142
|
-
requestUploadData = _context.sent;
|
|
143
|
-
nextVersion = requestUploadData.nextVersion;
|
|
144
|
-
identifier = requestUploadData.identifier;
|
|
145
|
-
_context.next = 27;
|
|
146
|
-
break;
|
|
147
|
-
|
|
148
|
-
case 24:
|
|
149
|
-
_context.prev = 24;
|
|
150
|
-
_context.t0 = _context["catch"](15);
|
|
151
|
-
errorExit(_context.t0);
|
|
152
|
-
|
|
153
|
-
case 27:
|
|
154
|
-
if (!options.customProject) {
|
|
155
|
-
_context.next = 35;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
flag = 0;
|
|
160
|
-
if (appConfigJson.listSyncJS && appConfigJson.listSyncJS.length > 0) flag += 1;
|
|
161
|
-
if (appConfigJson.listAsyncJS && appConfigJson.listAsyncJS.length > 0) flag += 1;
|
|
162
|
-
|
|
163
|
-
if (flag === 0) {
|
|
164
|
-
errorExit(new Error('Please define your assets output at app-config.json. Read more: https:/'));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
fse.writeFileSync(resolvePath("".concat(outputDir, "/").concat(config.filename.appConfig)), JSON.stringify(appConfigJson));
|
|
168
|
-
_context.next = 38;
|
|
169
|
-
break;
|
|
170
|
-
|
|
171
|
-
case 35:
|
|
172
|
-
_context.next = 37;
|
|
173
|
-
return regeneratorRuntime.awrap(buildApp(_objectSpread({}, options, {
|
|
174
|
-
appConfigJson: appConfigJson,
|
|
175
|
-
nextVersion: nextVersion
|
|
176
|
-
}), logger));
|
|
177
|
-
|
|
178
|
-
case 37:
|
|
179
|
-
appConfigJson = _context.sent;
|
|
180
|
-
|
|
181
|
-
case 38:
|
|
182
|
-
logger.statusStart("Deploying Your App ".concat(waitText));
|
|
183
|
-
_context.prev = 39;
|
|
184
|
-
_context.next = 42;
|
|
185
|
-
return regeneratorRuntime.awrap(new Promise(function (resolve, reject) {
|
|
186
|
-
zipper.zip(resolvePath(outputDir), function (zipError, zipped) {
|
|
187
|
-
if (zipError) return reject(zipError);
|
|
188
|
-
zipped.compress();
|
|
189
|
-
return resolve(zipped.memory());
|
|
190
|
-
});
|
|
191
|
-
}));
|
|
192
|
-
|
|
193
|
-
case 42:
|
|
194
|
-
buffer = _context.sent;
|
|
195
|
-
uploadData = _objectSpread({}, dataRequest, {
|
|
196
|
-
appBuffer: buffer,
|
|
197
|
-
identifier: identifier
|
|
198
|
-
});
|
|
199
|
-
_context.next = 46;
|
|
200
|
-
return regeneratorRuntime.awrap(uploadApp(uploadData, options, logger));
|
|
201
|
-
|
|
202
|
-
case 46:
|
|
203
|
-
uploadRes = _context.sent;
|
|
204
|
-
appURL = uploadRes && uploadRes.data && uploadRes.data.appUrl;
|
|
205
|
-
qrcode.generate(appURL, {
|
|
206
|
-
small: true
|
|
207
|
-
}, function (qrcode) {
|
|
208
|
-
var qrCode = "".concat(chalk.bold("".concat(logSymbols.info, " View app at:\n").concat(qrcode)));
|
|
209
|
-
logger.statusDone("".concat(chalk.bold.green('Deploy Done!'), " \uD83D\uDCAA"));
|
|
210
|
-
logger.text(qrCode);
|
|
211
|
-
});
|
|
212
|
-
_context.next = 55;
|
|
213
|
-
break;
|
|
214
|
-
|
|
215
|
-
case 51:
|
|
216
|
-
_context.prev = 51;
|
|
217
|
-
_context.t1 = _context["catch"](39);
|
|
218
|
-
logger.statusError('Error deploying your app');
|
|
219
|
-
errorExit(_context.t1);
|
|
220
|
-
|
|
221
|
-
case 55:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context.stop();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}, null, null, [[15, 24], [39, 51]]);
|
|
227
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var axios = require('axios')["default"];
|
|
4
|
-
|
|
5
|
-
var config = require('../../config');
|
|
6
|
-
|
|
7
|
-
var requestUpload = function requestUpload(url, appData, versionStatus, token) {
|
|
8
|
-
var appName, appDesc, appConfig, frameworkVersions, params, headers, res, resData;
|
|
9
|
-
return regeneratorRuntime.async(function requestUpload$(_context) {
|
|
10
|
-
while (1) {
|
|
11
|
-
switch (_context.prev = _context.next) {
|
|
12
|
-
case 0:
|
|
13
|
-
appName = appData.appName, appDesc = appData.appDesc, appConfig = appData.appConfig, frameworkVersions = appData.frameworkVersions;
|
|
14
|
-
params = {
|
|
15
|
-
name: appName,
|
|
16
|
-
desc: appDesc,
|
|
17
|
-
config: appConfig,
|
|
18
|
-
versionStatus: versionStatus,
|
|
19
|
-
frameworkVersions: frameworkVersions
|
|
20
|
-
};
|
|
21
|
-
headers = {
|
|
22
|
-
Authorization: "Bearer ".concat(token),
|
|
23
|
-
'cache-control': 'no-cache'
|
|
24
|
-
};
|
|
25
|
-
_context.next = 5;
|
|
26
|
-
return regeneratorRuntime.awrap(axios.get(url, {
|
|
27
|
-
params: params,
|
|
28
|
-
headers: headers,
|
|
29
|
-
withCredentials: true
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
case 5:
|
|
33
|
-
res = _context.sent;
|
|
34
|
-
resData = res.data;
|
|
35
|
-
|
|
36
|
-
if (!(!resData || resData.err < 0)) {
|
|
37
|
-
_context.next = 11;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!(resData && resData.err === config.error_code.permission_denied)) {
|
|
42
|
-
_context.next = 10;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
throw new Error(config.error_msg.permission_denied);
|
|
47
|
-
|
|
48
|
-
case 10:
|
|
49
|
-
throw new Error(JSON.stringify(resData));
|
|
50
|
-
|
|
51
|
-
case 11:
|
|
52
|
-
return _context.abrupt("return", resData.data);
|
|
53
|
-
|
|
54
|
-
case 12:
|
|
55
|
-
case "end":
|
|
56
|
-
return _context.stop();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
module.exports = requestUpload;
|