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
|
@@ -1,50 +1,29 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = (options) => {
|
|
4
|
-
const {
|
|
5
|
-
name,
|
|
6
|
-
template,
|
|
7
|
-
} = options;
|
|
8
|
-
|
|
9
|
-
const isBlank = template === 'blank';
|
|
10
|
-
|
|
11
|
-
let description;
|
|
12
|
-
if (template === 'single-view' || template === 'blank') {
|
|
13
|
-
description = `
|
|
1
|
+
"use strict";const i=require("../../utils/indent");module.exports=a=>{let t;let{name:l,template:e}=a;return("single-view"===e||"blank"===e)&&(t=`
|
|
14
2
|
<p>Here is your blank ZMP app. Let's see what we have here.</p>
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
if (template === 'split-view') {
|
|
18
|
-
description = `
|
|
3
|
+
`),"split-view"===e&&(t=`
|
|
19
4
|
<p>This is an example of split view application layout, commonly used on tablets. The main approach of such kind of layout is that you can see different views at the same time.</p>
|
|
20
5
|
|
|
21
6
|
<p>Each view may have different layout, different navbar type (dynamic, fixed or static) or without navbar.</p>
|
|
22
7
|
|
|
23
8
|
<p>The fun thing is that you can easily control one view from another without any line of JavaScript just using "data-view" attribute on links.</p>
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
if (template === 'tabs') {
|
|
27
|
-
description = `
|
|
9
|
+
`),"tabs"===e&&(t=`
|
|
28
10
|
<p>This is an example of tabs-layout application. The main point of such tabbed layout is that each tab contains independent view with its own routing and navigation.</p>
|
|
29
11
|
|
|
30
12
|
<p>Each tab/view may have different layout, different navbar type (dynamic, fixed or static) or without navbar like this tab.</p>
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return indent(0, `
|
|
13
|
+
`),i(0,`
|
|
35
14
|
<div class="page" data-name="home">
|
|
36
15
|
<!-- Top Navbar -->
|
|
37
|
-
${
|
|
16
|
+
${"blank"===e?`
|
|
38
17
|
<div class="navbar navbar-large">
|
|
39
18
|
<div class="navbar-bg"></div>
|
|
40
19
|
<div class="navbar-inner sliding">
|
|
41
|
-
<div class="title">${
|
|
20
|
+
<div class="title">${l}</div>
|
|
42
21
|
<div class="title-large">
|
|
43
|
-
<div class="title-large-text">${
|
|
22
|
+
<div class="title-large-text">${l}</div>
|
|
44
23
|
</div>
|
|
45
24
|
</div>
|
|
46
25
|
</div>
|
|
47
|
-
`.trim()
|
|
26
|
+
`.trim():`
|
|
48
27
|
<div class="navbar navbar-large">
|
|
49
28
|
<div class="navbar-bg"></div>
|
|
50
29
|
<div class="navbar-inner">
|
|
@@ -54,7 +33,7 @@ module.exports = (options) => {
|
|
|
54
33
|
<i class="icon material-icons if-md">menu</i>
|
|
55
34
|
</a>
|
|
56
35
|
</div>
|
|
57
|
-
<div class="title sliding">${
|
|
36
|
+
<div class="title sliding">${l}</div>
|
|
58
37
|
<div class="right">
|
|
59
38
|
<a href="#" class="link icon-only panel-open" data-panel="right">
|
|
60
39
|
<i class="icon zmp-icons if-not-md">menu</i>
|
|
@@ -62,12 +41,12 @@ module.exports = (options) => {
|
|
|
62
41
|
</a>
|
|
63
42
|
</div>
|
|
64
43
|
<div class="title-large">
|
|
65
|
-
<div class="title-large-text">${
|
|
44
|
+
<div class="title-large-text">${l}</div>
|
|
66
45
|
</div>
|
|
67
46
|
</div>
|
|
68
47
|
</div>
|
|
69
48
|
`.trim()}
|
|
70
|
-
${
|
|
49
|
+
${"tabs"!==e?`
|
|
71
50
|
<!-- Toolbar-->
|
|
72
51
|
<div class="toolbar toolbar-bottom">
|
|
73
52
|
<div class="toolbar-inner">
|
|
@@ -75,13 +54,13 @@ module.exports = (options) => {
|
|
|
75
54
|
<a href="#" class="link">Right Link</a>
|
|
76
55
|
</div>
|
|
77
56
|
</div>
|
|
78
|
-
`.trim()
|
|
57
|
+
`.trim():""}
|
|
79
58
|
<!-- Scrollable page content-->
|
|
80
59
|
<div class="page-content">
|
|
81
60
|
<div class="block block-strong">
|
|
82
|
-
${
|
|
61
|
+
${t.trim()}
|
|
83
62
|
</div>
|
|
84
|
-
${
|
|
63
|
+
${"blank"===e?"":`
|
|
85
64
|
<div class="block-title">Navigation</div>
|
|
86
65
|
<div class="list">
|
|
87
66
|
<ul>
|
|
@@ -136,8 +115,7 @@ module.exports = (options) => {
|
|
|
136
115
|
</li>
|
|
137
116
|
</ul>
|
|
138
117
|
</div>
|
|
139
|
-
`.trim()
|
|
118
|
+
`.trim()}
|
|
140
119
|
</div>
|
|
141
120
|
</div>
|
|
142
|
-
`).trim();
|
|
143
|
-
};
|
|
121
|
+
`).trim()};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
const templateIf = require('../../utils/template-if');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const {
|
|
7
|
-
template,
|
|
8
|
-
bundler,
|
|
9
|
-
} = options;
|
|
10
|
-
|
|
11
|
-
// Panels
|
|
12
|
-
const leftPanelPlain = `
|
|
1
|
+
"use strict";const i=require("./generate-home-page"),a=require("../../utils/indent"),e=require("../../utils/template-if");module.exports=s=>{let{template:l,bundler:t}=s,n=`
|
|
13
2
|
<!-- Left panel with cover effect-->
|
|
14
3
|
<div class="panel panel-left panel-cover theme-dark panel-init">
|
|
15
4
|
<div class="view">
|
|
@@ -26,9 +15,7 @@ module.exports = (options) => {
|
|
|
26
15
|
</div>
|
|
27
16
|
</div>
|
|
28
17
|
</div>
|
|
29
|
-
`.trim()
|
|
30
|
-
|
|
31
|
-
const leftPanelWithView = `
|
|
18
|
+
`.trim(),v=`
|
|
32
19
|
<!-- Left panel with cover effect -->
|
|
33
20
|
<div class="panel panel-left panel-cover theme-dark panel-init" data-visible-breakpoint="960">
|
|
34
21
|
<div class="view view-init" data-name="left">
|
|
@@ -65,9 +52,7 @@ module.exports = (options) => {
|
|
|
65
52
|
</div>
|
|
66
53
|
</div>
|
|
67
54
|
</div>
|
|
68
|
-
|
|
69
|
-
const leftPanel = template === 'split-view' ? leftPanelWithView : leftPanelPlain;
|
|
70
|
-
const rightPanel = `
|
|
55
|
+
`,d=`
|
|
71
56
|
<!-- Right panel with reveal effect-->
|
|
72
57
|
<div class="panel panel-right panel-reveal theme-dark">
|
|
73
58
|
<div class="view">
|
|
@@ -84,24 +69,16 @@ module.exports = (options) => {
|
|
|
84
69
|
</div>
|
|
85
70
|
</div>
|
|
86
71
|
</div>
|
|
87
|
-
`.trim();
|
|
88
|
-
|
|
89
|
-
// Views
|
|
90
|
-
let views = '';
|
|
91
|
-
if (template === 'single-view' || template === 'split-view' || template === 'blank') {
|
|
92
|
-
views = indent(4, `
|
|
72
|
+
`.trim(),c="";("single-view"===l||"split-view"===l||"blank"===l)&&(c=a(4,`
|
|
93
73
|
<!-- Your main view, should have "view-main" class -->
|
|
94
|
-
${
|
|
74
|
+
${e("webpack"===t,()=>`
|
|
95
75
|
<div class="view view-main view-init safe-areas" data-url="/"></div>
|
|
96
|
-
`,
|
|
76
|
+
`,()=>`
|
|
97
77
|
<div class="view view-main view-init safe-areas">
|
|
98
|
-
${
|
|
78
|
+
${a(8,i(s)).trim()}
|
|
99
79
|
</div>
|
|
100
80
|
`)}
|
|
101
|
-
`)
|
|
102
|
-
}
|
|
103
|
-
if (template === 'tabs') {
|
|
104
|
-
views = indent(4, `
|
|
81
|
+
`)),"tabs"===l&&(c=a(4,`
|
|
105
82
|
<!-- Views/Tabs container -->
|
|
106
83
|
<div class="views tabs safe-areas">
|
|
107
84
|
<!-- Tabbar for switching views-tabs -->
|
|
@@ -126,13 +103,13 @@ module.exports = (options) => {
|
|
|
126
103
|
</div>
|
|
127
104
|
|
|
128
105
|
<!-- Your main view/tab, should have "view-main" class. It also has "tab-active" class -->
|
|
129
|
-
${
|
|
106
|
+
${e("webpack"===t,()=>`
|
|
130
107
|
<div id="view-home" class="view view-main view-init tab tab-active" data-url="/">
|
|
131
108
|
<!-- Home page will be loaded here dynamically from / route -->
|
|
132
109
|
</div>
|
|
133
|
-
`,
|
|
110
|
+
`,()=>`
|
|
134
111
|
<div id="view-home" class="view view-main view-init tab tab-active">
|
|
135
|
-
${
|
|
112
|
+
${a(8,i(s)).trim()}
|
|
136
113
|
</div>
|
|
137
114
|
`)}
|
|
138
115
|
|
|
@@ -146,15 +123,12 @@ module.exports = (options) => {
|
|
|
146
123
|
<!-- Settings page will be loaded here dynamically from /settings/ route -->
|
|
147
124
|
</div>
|
|
148
125
|
</div>
|
|
149
|
-
`);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
${
|
|
154
|
-
|
|
155
|
-
${leftPanel}
|
|
156
|
-
${rightPanel}
|
|
157
|
-
${views}
|
|
126
|
+
`));let r="blank"===l?`
|
|
127
|
+
${c}
|
|
128
|
+
`:`
|
|
129
|
+
${"split-view"===l?v:n}
|
|
130
|
+
${d}
|
|
131
|
+
${c}
|
|
158
132
|
|
|
159
133
|
<!-- Popup -->
|
|
160
134
|
<div class="popup" id="my-popup">
|
|
@@ -190,10 +164,10 @@ module.exports = (options) => {
|
|
|
190
164
|
<div class="item-inner">
|
|
191
165
|
<div class="item-title item-label">Username</div>
|
|
192
166
|
<div class="item-input-wrap">
|
|
193
|
-
${
|
|
167
|
+
${e(t,()=>`
|
|
194
168
|
<input type="text" name="username" placeholder="Your username" value="\${username}" @input="\${updateUsername}"/>
|
|
195
169
|
`)}
|
|
196
|
-
${
|
|
170
|
+
${e(!t,()=>`
|
|
197
171
|
<input type="text" name="username" placeholder="Your username"/>
|
|
198
172
|
`)}
|
|
199
173
|
</div>
|
|
@@ -203,10 +177,10 @@ module.exports = (options) => {
|
|
|
203
177
|
<div class="item-inner">
|
|
204
178
|
<div class="item-title item-label">Password</div>
|
|
205
179
|
<div class="item-input-wrap">
|
|
206
|
-
${
|
|
180
|
+
${e(t,()=>`
|
|
207
181
|
<input type="password" name="password" placeholder="Your password" value="\${password}" @input="\${updatePassword}"/>
|
|
208
182
|
`)}
|
|
209
|
-
${
|
|
183
|
+
${e(!t,()=>`
|
|
210
184
|
<input type="password" name="password" placeholder="Your password"/>
|
|
211
185
|
`)}
|
|
212
186
|
</div>
|
|
@@ -217,10 +191,10 @@ module.exports = (options) => {
|
|
|
217
191
|
<div class="list">
|
|
218
192
|
<ul>
|
|
219
193
|
<li>
|
|
220
|
-
${
|
|
194
|
+
${e(t,()=>`
|
|
221
195
|
<a href="#" class="item-link list-button login-button" @click="\${alertLoginData}">Sign In</a>
|
|
222
196
|
`)}
|
|
223
|
-
${
|
|
197
|
+
${e(!t,()=>`
|
|
224
198
|
<a href="#" class="item-link list-button login-button">Sign In</a>
|
|
225
199
|
`)}
|
|
226
200
|
</li>
|
|
@@ -231,14 +205,10 @@ module.exports = (options) => {
|
|
|
231
205
|
</div>
|
|
232
206
|
</div>
|
|
233
207
|
</div>
|
|
234
|
-
`;
|
|
235
|
-
|
|
236
|
-
if (bundler === 'webpack') {
|
|
237
|
-
if (template === 'blank') {
|
|
238
|
-
return indent(0, `
|
|
208
|
+
`;return"webpack"===t?"blank"===l?a(0,`
|
|
239
209
|
<template>
|
|
240
210
|
<div id="app">
|
|
241
|
-
${
|
|
211
|
+
${a(10,c)}
|
|
242
212
|
</div>
|
|
243
213
|
</template>
|
|
244
214
|
<script>
|
|
@@ -246,12 +216,10 @@ module.exports = (options) => {
|
|
|
246
216
|
return $render;
|
|
247
217
|
}
|
|
248
218
|
</script>
|
|
249
|
-
`)
|
|
250
|
-
}
|
|
251
|
-
return indent(0, `
|
|
219
|
+
`):a(0,`
|
|
252
220
|
<template>
|
|
253
221
|
<div id="app">
|
|
254
|
-
${
|
|
222
|
+
${a(10,r)}
|
|
255
223
|
</div>
|
|
256
224
|
</template>
|
|
257
225
|
<script>
|
|
@@ -277,7 +245,4 @@ module.exports = (options) => {
|
|
|
277
245
|
return $render;
|
|
278
246
|
}
|
|
279
247
|
</script>
|
|
280
|
-
`);
|
|
281
|
-
}
|
|
282
|
-
return htmlTemplate;
|
|
283
|
-
};
|
|
248
|
+
`):r};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const {
|
|
6
|
-
bundler, template,
|
|
7
|
-
} = options;
|
|
8
|
-
|
|
9
|
-
let routes;
|
|
10
|
-
if (template === 'blank') {
|
|
11
|
-
if (bundler === 'webpack') {
|
|
12
|
-
routes = indent(0, `
|
|
1
|
+
"use strict";const t=require("../../utils/template-if"),e=require("../../utils/indent");module.exports=a=>{let o;let{bundler:p,template:m}=a;return o="blank"===m?"webpack"===p?e(0,`
|
|
13
2
|
import HomePage from './pages/home.zmp.html';
|
|
14
3
|
|
|
15
4
|
var routes = [
|
|
@@ -18,32 +7,27 @@ module.exports = (options) => {
|
|
|
18
7
|
component: HomePage,
|
|
19
8
|
},
|
|
20
9
|
];
|
|
21
|
-
`)
|
|
22
|
-
} else {
|
|
23
|
-
routes = indent(0, `
|
|
10
|
+
`):e(0,`
|
|
24
11
|
var routes = [
|
|
25
12
|
{
|
|
26
13
|
path: '/',
|
|
27
14
|
url: './index.html',
|
|
28
15
|
},
|
|
29
16
|
];
|
|
30
|
-
`)
|
|
31
|
-
}
|
|
32
|
-
} else if (bundler === 'webpack') {
|
|
33
|
-
routes = indent(0, `
|
|
17
|
+
`):"webpack"===p?e(0,`
|
|
34
18
|
import HomePage from './pages/home.zmp.html';
|
|
35
19
|
import AboutPage from './pages/about.zmp.html';
|
|
36
20
|
import FormPage from './pages/form.zmp.html';
|
|
37
|
-
${
|
|
21
|
+
${t("tabs"===m,()=>`
|
|
38
22
|
import CatalogPage from './pages/catalog.zmp.html';
|
|
39
23
|
import ProductPage from './pages/product.zmp.html';
|
|
40
24
|
import SettingsPage from './pages/settings.zmp.html';
|
|
41
25
|
`)}
|
|
42
|
-
${
|
|
26
|
+
${t("split-view"===m,()=>`
|
|
43
27
|
import LeftPage1 from './pages/left-page-1.zmp.html';
|
|
44
28
|
import LeftPage2 from './pages/left-page-2.zmp.html';
|
|
45
29
|
`)}
|
|
46
|
-
${
|
|
30
|
+
${t("blank"!==m,()=>`
|
|
47
31
|
import DynamicRoutePage from './pages/dynamic-route.zmp.html';
|
|
48
32
|
import NotFoundPage from './pages/404.zmp.html';
|
|
49
33
|
`)}
|
|
@@ -61,7 +45,7 @@ module.exports = (options) => {
|
|
|
61
45
|
path: '/form/',
|
|
62
46
|
component: FormPage,
|
|
63
47
|
},
|
|
64
|
-
${
|
|
48
|
+
${t("tabs"===m,()=>`
|
|
65
49
|
{
|
|
66
50
|
path: '/catalog/',
|
|
67
51
|
component: CatalogPage,
|
|
@@ -75,7 +59,7 @@ module.exports = (options) => {
|
|
|
75
59
|
component: SettingsPage,
|
|
76
60
|
},
|
|
77
61
|
`)}
|
|
78
|
-
${
|
|
62
|
+
${t("split-view"===m,()=>`
|
|
79
63
|
{
|
|
80
64
|
path: '/left-page-1/',
|
|
81
65
|
component: LeftPage1,
|
|
@@ -94,9 +78,7 @@ module.exports = (options) => {
|
|
|
94
78
|
component: NotFoundPage,
|
|
95
79
|
},
|
|
96
80
|
];
|
|
97
|
-
`)
|
|
98
|
-
} else {
|
|
99
|
-
routes = indent(0, `
|
|
81
|
+
`):e(0,`
|
|
100
82
|
var routes = [
|
|
101
83
|
{
|
|
102
84
|
path: '/',
|
|
@@ -110,7 +92,7 @@ module.exports = (options) => {
|
|
|
110
92
|
path: '/form/',
|
|
111
93
|
url: './pages/form.html',
|
|
112
94
|
},
|
|
113
|
-
${
|
|
95
|
+
${t("tabs"===m,()=>`
|
|
114
96
|
{
|
|
115
97
|
path: '/catalog/',
|
|
116
98
|
componentUrl: './pages/catalog.html',
|
|
@@ -124,7 +106,7 @@ module.exports = (options) => {
|
|
|
124
106
|
url: './pages/settings.html',
|
|
125
107
|
},
|
|
126
108
|
`)}
|
|
127
|
-
${
|
|
109
|
+
${t("split-view"===m,()=>`
|
|
128
110
|
{
|
|
129
111
|
path: '/left-page-1/',
|
|
130
112
|
url: './pages/left-page-1.html',
|
|
@@ -144,12 +126,4 @@ module.exports = (options) => {
|
|
|
144
126
|
url: './pages/404.html',
|
|
145
127
|
},
|
|
146
128
|
];
|
|
147
|
-
`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (bundler) {
|
|
151
|
-
routes += '\nexport default routes;';
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return routes;
|
|
155
|
-
};
|
|
129
|
+
`),p&&(o+="\nexport default routes;"),o};
|
|
@@ -1,79 +1,35 @@
|
|
|
1
|
-
const
|
|
2
|
-
const indent = require('../../utils/indent');
|
|
3
|
-
const appParameters = require('../app-parameters');
|
|
4
|
-
const stylesExtension = require('../../utils/styles-extension');
|
|
5
|
-
|
|
6
|
-
module.exports = (options) => {
|
|
7
|
-
const {
|
|
8
|
-
bundler,
|
|
9
|
-
type,
|
|
10
|
-
cssPreProcessor,
|
|
11
|
-
theming,
|
|
12
|
-
customBuild,
|
|
13
|
-
template,
|
|
14
|
-
} = options;
|
|
15
|
-
|
|
16
|
-
let scripts = '';
|
|
17
|
-
|
|
18
|
-
if (bundler) {
|
|
19
|
-
scripts += indent(
|
|
20
|
-
0,
|
|
21
|
-
`
|
|
1
|
+
"use strict";const r=require("../../utils/template-if"),e=require("../../utils/indent"),o=require("../app-parameters"),s=require("../../utils/styles-extension");module.exports=m=>{let{bundler:n,type:p,cssPreProcessor:t,theming:i,customBuild:a,template:l}=m,c="";return n?c+=e(0,`
|
|
22
2
|
import $ from 'zmp-dom';
|
|
23
|
-
${
|
|
24
|
-
customBuild,
|
|
25
|
-
() => `
|
|
3
|
+
${r(a,()=>`
|
|
26
4
|
import ZMP from './zmp-custom.js';
|
|
27
|
-
`,
|
|
28
|
-
() => `
|
|
5
|
+
`,()=>`
|
|
29
6
|
import ZMP from 'zmp-framework/core/bundle';
|
|
30
|
-
`
|
|
31
|
-
)}
|
|
7
|
+
`)}
|
|
32
8
|
|
|
33
9
|
// Import ZMP Styles
|
|
34
|
-
${
|
|
35
|
-
customBuild,
|
|
36
|
-
() => `
|
|
10
|
+
${r(a,()=>`
|
|
37
11
|
import '../css/zmp-custom.less';
|
|
38
|
-
`,
|
|
39
|
-
() => `
|
|
12
|
+
`,()=>`
|
|
40
13
|
import 'zmp-framework/zmp-bundle.min.css';
|
|
41
|
-
`
|
|
42
|
-
)}
|
|
14
|
+
`)}
|
|
43
15
|
|
|
44
16
|
// Import Icons and App Custom Styles
|
|
45
|
-
${
|
|
46
|
-
theming.iconFonts,
|
|
47
|
-
() => `
|
|
17
|
+
${r(i.iconFonts,()=>`
|
|
48
18
|
import '../css/icons.css';
|
|
49
|
-
`
|
|
50
|
-
)}
|
|
51
|
-
import '../css/app.${stylesExtension(cssPreProcessor)}';
|
|
19
|
+
`)}
|
|
20
|
+
import '../css/app.${s(t)}';
|
|
52
21
|
// Import Store
|
|
53
22
|
import store from '../store.js';
|
|
54
23
|
|
|
55
24
|
// Import main app component
|
|
56
25
|
import App from '../app.zmp.html';
|
|
57
|
-
`
|
|
58
|
-
);
|
|
59
|
-
} else {
|
|
60
|
-
scripts += indent(
|
|
61
|
-
0,
|
|
62
|
-
`
|
|
26
|
+
`):c+=e(0,`
|
|
63
27
|
var $ = Dom7;
|
|
64
|
-
`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
scripts += indent(
|
|
69
|
-
0,
|
|
70
|
-
`
|
|
28
|
+
`),(c+=e(0,`
|
|
71
29
|
var app = new ZMP({
|
|
72
|
-
${
|
|
30
|
+
${e(6,o(m)).trim()}
|
|
73
31
|
});
|
|
74
|
-
${
|
|
75
|
-
!bundler && template !== 'blank',
|
|
76
|
-
() => `
|
|
32
|
+
${r(!n&&"blank"!==l,()=>`
|
|
77
33
|
// Login Screen Demo
|
|
78
34
|
$('#my-login-screen .login-button').on('click', function () {
|
|
79
35
|
var username = $('#my-login-screen [name="username"]').val();
|
|
@@ -85,10 +41,5 @@ module.exports = (options) => {
|
|
|
85
41
|
// Alert username and password
|
|
86
42
|
app.dialog.alert('Username: ' + username + '<br/>Password: ' + password);
|
|
87
43
|
});
|
|
88
|
-
`
|
|
89
|
-
|
|
90
|
-
`
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
return scripts.trim();
|
|
94
|
-
};
|
|
44
|
+
`)}
|
|
45
|
+
`)).trim()};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fse = require('../../utils/fs-extra');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const cwd = options.cwd || process.cwd();
|
|
6
|
-
const { framework } = options;
|
|
7
|
-
|
|
8
|
-
const srcFolder = 'src';
|
|
9
|
-
|
|
10
|
-
const folders = [
|
|
11
|
-
`./${srcFolder}`,
|
|
12
|
-
`./${srcFolder}/static`,
|
|
13
|
-
`./${srcFolder}/css`,
|
|
14
|
-
`./${srcFolder}/pages`,
|
|
15
|
-
`./public`,
|
|
16
|
-
'./assets-src',
|
|
17
|
-
];
|
|
18
|
-
if (folders.indexOf('./www') < 0) {
|
|
19
|
-
folders.push('./www');
|
|
20
|
-
}
|
|
21
|
-
if (framework !== 'core') {
|
|
22
|
-
folders.push(...[`./${srcFolder}/components`]);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
folders.push(`./${srcFolder}/static/icons`);
|
|
26
|
-
|
|
27
|
-
folders.forEach((f) => {
|
|
28
|
-
fse.mkdirSync(path.resolve(cwd, f));
|
|
29
|
-
});
|
|
30
|
-
};
|
|
1
|
+
"use strict";const s=require("path"),c=require("../../utils/fs-extra");module.exports=r=>{let e=r.cwd||process.cwd(),{framework:t}=r,i=["./src","./src/static","./src/css","./src/pages","./public","./assets-src"];0>i.indexOf("./www")&&i.push("./www"),"core"!==t&&i.push("./src/components"),i.push("./src/static/icons"),i.forEach(r=>{c.mkdirSync(s.resolve(e,r))})};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
module.exports = () => {
|
|
4
|
-
return indent(
|
|
5
|
-
4,
|
|
6
|
-
`
|
|
1
|
+
"use strict";const e=require("../utils/indent");module.exports=()=>e(4,`
|
|
7
2
|
<allow-navigation href="*" />
|
|
8
3
|
<preference name="DisallowOverscroll" value="true" />
|
|
9
4
|
<preference name="BackupWebStorage" value="local" />
|
|
@@ -13,6 +8,4 @@ module.exports = () => {
|
|
|
13
8
|
<preference name="Suppresses3DTouchGesture" value="true" />
|
|
14
9
|
<preference name="Allow3DTouchLinkPreview" value="false" />
|
|
15
10
|
<preference name="AllowInlineMediaPlayback" value="true" />
|
|
16
|
-
`
|
|
17
|
-
);
|
|
18
|
-
};
|
|
11
|
+
`);
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const { projectFramework } = require('../../utils/constants');
|
|
3
|
-
const generateCoreRoot = require('./core/generate-root.js');
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const { name, framework, theming } = options;
|
|
7
|
-
const srcFolder = '/src/';
|
|
8
|
-
const iconsAssetsFolder = 'static';
|
|
9
|
-
|
|
10
|
-
const rootContent = framework === 'core' ? generateCoreRoot(options) : '';
|
|
11
|
-
const scripts = `
|
|
1
|
+
"use strict";const{projectFramework:e}=require("../../utils/constants"),t=require("./core/generate-root.js");module.exports=i=>{let{name:o,framework:a,theming:c}=i,n="/src/",r="core"===a?t(i):"",l=`
|
|
12
2
|
<!-- built script files will be auto injected -->
|
|
13
|
-
${
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: ''
|
|
17
|
-
}
|
|
18
|
-
${
|
|
19
|
-
framework === projectFramework.REACT_TYPESCRIPT
|
|
20
|
-
? `<script type="module" src="${srcFolder}app.ts"></script>`
|
|
21
|
-
: ''
|
|
22
|
-
}
|
|
23
|
-
`.trim();
|
|
24
|
-
|
|
25
|
-
return `
|
|
3
|
+
${a===e.REACT||a===e.VUE?`<script type="module" src="${n}app.js"></script>`:""}
|
|
4
|
+
${a===e.REACT_TYPESCRIPT?`<script type="module" src="${n}app.ts"></script>`:""}
|
|
5
|
+
`.trim();return`
|
|
26
6
|
<!DOCTYPE html>
|
|
27
7
|
<html>
|
|
28
8
|
<head>
|
|
@@ -30,20 +10,15 @@ module.exports = (options) => {
|
|
|
30
10
|
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">
|
|
31
11
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
|
|
32
12
|
|
|
33
|
-
<meta name="theme-color" content="${
|
|
34
|
-
theming.customColor && theming.color ? `${theming.color}` : '#007aff'
|
|
35
|
-
}">
|
|
13
|
+
<meta name="theme-color" content="${c.customColor&&c.color?`${c.color}`:"#007aff"}">
|
|
36
14
|
<meta name="format-detection" content="telephone=no">
|
|
37
15
|
<meta name="msapplication-tap-highlight" content="no">
|
|
38
|
-
<link rel="icon" href="${
|
|
39
|
-
<title>${
|
|
16
|
+
<link rel="icon" href="${n}static/icons/favicon.png">
|
|
17
|
+
<title>${o}</title>
|
|
40
18
|
</head>
|
|
41
19
|
<body>
|
|
42
|
-
<div id="app"${
|
|
43
|
-
|
|
44
|
-
}>${rootContent}</div>
|
|
45
|
-
${scripts}
|
|
20
|
+
<div id="app"${"core"===a&&c.darkTheme?'class="theme-dark"':""}>${r}</div>
|
|
21
|
+
${l}
|
|
46
22
|
</body>
|
|
47
23
|
</html>
|
|
48
|
-
`.trim();
|
|
49
|
-
};
|
|
24
|
+
`.trim()};
|