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.
Files changed (225) hide show
  1. package/README.md +37 -0
  2. package/build/index.js +1 -184
  3. package/config/index.js +1 -44
  4. package/create/index.js +1 -230
  5. package/create/utils/generate-app-config.js +1 -34
  6. package/create/utils/generate-npm-scripts.js +1 -26
  7. package/create/utils/get-options.js +1 -204
  8. package/create/utils/npm-scripts.js +1 -62
  9. package/deploy/index.js +1 -149
  10. package/deploy/utils/get-options.js +1 -69
  11. package/deploy/utils/request-upload.js +1 -34
  12. package/deploy/utils/upload-app.js +1 -82
  13. package/index.js +1 -319
  14. package/login/index.js +1 -169
  15. package/login/utils/get-options.js +1 -58
  16. package/login/utils/zalo-login.js +1 -32
  17. package/migrate/icons/update-icon-v3.js +1 -19
  18. package/migrate/index.js +1 -60
  19. package/migrate/utils/get-options.js +1 -46
  20. package/migrate/utils/migrate-react.js +1 -33
  21. package/package.json +13 -40
  22. package/start/frame/index.html +264 -254
  23. package/start/index.js +1 -382
  24. package/sync/index-to-app-config.js +1 -146
  25. package/sync/index.js +1 -55
  26. package/utils/axios.js +1 -15
  27. package/utils/check-update.js +1 -53
  28. package/utils/constants.js +1 -20
  29. package/utils/env.js +1 -39
  30. package/utils/error.js +1 -16
  31. package/utils/find-files-by-ext.js +1 -27
  32. package/utils/find-free-port.js +1 -11
  33. package/utils/fs-extra.js +1 -90
  34. package/utils/generate-pages-map.js +1 -17
  35. package/utils/get-app-info.js +1 -22
  36. package/utils/get-current-project.js +1 -25
  37. package/utils/get-ip.js +1 -19
  38. package/utils/log.js +1 -19
  39. package/utils/node-blob.js +1 -106
  40. package/utils/resumable.d.js +1 -0
  41. package/utils/resumable.js +1 -1204
  42. package/utils/spinner.js +1 -25
  43. package/utils/tunnel.js +1 -36
  44. package/.editorconfig +0 -15
  45. package/.eslintignore +0 -8
  46. package/.eslintrc.js +0 -10
  47. package/.vscode/launch.json +0 -23
  48. package/LICENSE +0 -21
  49. package/README.git.md +0 -37
  50. package/assets/index.js +0 -147
  51. package/build/dist/index.dev.js +0 -217
  52. package/config/dist/index.dev.js +0 -48
  53. package/create/init-zmp-ui.js +0 -216
  54. package/create/templates/app-parameters.js +0 -33
  55. package/create/templates/common/css/icons.css +0 -60
  56. package/create/templates/common/icons/512x512.png +0 -0
  57. package/create/templates/common/icons/apple-touch-icon.png +0 -0
  58. package/create/templates/common/icons/favicon.png +0 -0
  59. package/create/templates/common/postcss.config.js +0 -5
  60. package/create/templates/common/splash-2732x2732.png +0 -0
  61. package/create/templates/common/tailwind/postcss.config.js +0 -5
  62. package/create/templates/common/tailwind/tailwind.config.js +0 -9
  63. package/create/templates/common/tailwind/tailwind.css +0 -3
  64. package/create/templates/common/webpack/build.js +0 -41
  65. package/create/templates/copy-assets.js +0 -158
  66. package/create/templates/core/babel.config.js +0 -11
  67. package/create/templates/core/copy-assets.js +0 -83
  68. package/create/templates/core/generate-home-page.js +0 -143
  69. package/create/templates/core/generate-root.js +0 -283
  70. package/create/templates/core/generate-routes.js +0 -155
  71. package/create/templates/core/generate-scripts.js +0 -94
  72. package/create/templates/core/pages/404.html +0 -20
  73. package/create/templates/core/pages/about.html +0 -26
  74. package/create/templates/core/pages/catalog.html +0 -40
  75. package/create/templates/core/pages/dynamic-route.html +0 -115
  76. package/create/templates/core/pages/form.html +0 -258
  77. package/create/templates/core/pages/left-page-1.html +0 -24
  78. package/create/templates/core/pages/left-page-2.html +0 -23
  79. package/create/templates/core/pages/product.html +0 -36
  80. package/create/templates/core/pages/request-and-load.html +0 -35
  81. package/create/templates/core/pages/settings.html +0 -252
  82. package/create/templates/create-folders.js +0 -30
  83. package/create/templates/dist/generate-styles.dev.js +0 -46
  84. package/create/templates/generate-config-xml.js +0 -18
  85. package/create/templates/generate-index.js +0 -49
  86. package/create/templates/generate-manifest.js +0 -49
  87. package/create/templates/generate-recoil.js +0 -56
  88. package/create/templates/generate-routes.js +0 -16
  89. package/create/templates/generate-scripts.js +0 -16
  90. package/create/templates/generate-service-worker.js +0 -126
  91. package/create/templates/generate-store.js +0 -88
  92. package/create/templates/generate-styles.js +0 -110
  93. package/create/templates/generate-webpack-config.js +0 -335
  94. package/create/templates/generate-zmp-custom.js +0 -81
  95. package/create/templates/react/babel.config.js +0 -12
  96. package/create/templates/react/components/app-items.jsx +0 -44
  97. package/create/templates/react/components/navbar-back.jsx +0 -25
  98. package/create/templates/react/components/user-card.jsx +0 -18
  99. package/create/templates/react/copy-assets.js +0 -85
  100. package/create/templates/react/dist/generate-scripts.dev.js +0 -23
  101. package/create/templates/react/generate-home-page.js +0 -111
  102. package/create/templates/react/generate-root.js +0 -84
  103. package/create/templates/react/generate-routes.js +0 -16
  104. package/create/templates/react/generate-scripts.js +0 -68
  105. package/create/templates/react/pages/404.js +0 -27
  106. package/create/templates/react/pages/about.js +0 -52
  107. package/create/templates/react/pages/catalog.js +0 -112
  108. package/create/templates/react/pages/dynamic-route.js +0 -80
  109. package/create/templates/react/pages/form.js +0 -152
  110. package/create/templates/react/pages/index copy.js +0 -17
  111. package/create/templates/react/pages/index.js +0 -17
  112. package/create/templates/react/pages/settings.js +0 -76
  113. package/create/templates/react/pages/user.js +0 -56
  114. package/create/templates/react/vite.config.js +0 -11
  115. package/create/templates/react-typescript/_tsconfig.json +0 -33
  116. package/create/templates/react-typescript/components/app-items.js +0 -53
  117. package/create/templates/react-typescript/components/index.js +0 -9
  118. package/create/templates/react-typescript/components/navbar-back.js +0 -40
  119. package/create/templates/react-typescript/components/user-card.js +0 -32
  120. package/create/templates/react-typescript/copy-assets.js +0 -94
  121. package/create/templates/react-typescript/dist/generate-scripts.dev.js +0 -23
  122. package/create/templates/react-typescript/generate-home-page.js +0 -113
  123. package/create/templates/react-typescript/generate-root.js +0 -81
  124. package/create/templates/react-typescript/generate-routes.js +0 -12
  125. package/create/templates/react-typescript/generate-scripts.js +0 -67
  126. package/create/templates/react-typescript/pages/404.js +0 -27
  127. package/create/templates/react-typescript/pages/about.js +0 -52
  128. package/create/templates/react-typescript/pages/catalog.js +0 -112
  129. package/create/templates/react-typescript/pages/dynamic-route.js +0 -80
  130. package/create/templates/react-typescript/pages/form.js +0 -152
  131. package/create/templates/react-typescript/pages/index.js +0 -17
  132. package/create/templates/react-typescript/pages/settings.js +0 -76
  133. package/create/templates/react-typescript/pages/user.js +0 -56
  134. package/create/templates/react-typescript/vite.config.js +0 -21
  135. package/create/templates/svelte/babel.config.js +0 -10
  136. package/create/templates/svelte/copy-assets.js +0 -47
  137. package/create/templates/svelte/generate-home-page.js +0 -158
  138. package/create/templates/svelte/generate-root.js +0 -235
  139. package/create/templates/svelte/generate-routes.js +0 -91
  140. package/create/templates/svelte/generate-scripts.js +0 -47
  141. package/create/templates/svelte/pages/404.svelte +0 -10
  142. package/create/templates/svelte/pages/about.svelte +0 -16
  143. package/create/templates/svelte/pages/catalog.svelte +0 -31
  144. package/create/templates/svelte/pages/dynamic-route.svelte +0 -34
  145. package/create/templates/svelte/pages/form.svelte +0 -175
  146. package/create/templates/svelte/pages/left-page-1.svelte +0 -13
  147. package/create/templates/svelte/pages/left-page-2.svelte +0 -12
  148. package/create/templates/svelte/pages/product.svelte +0 -21
  149. package/create/templates/svelte/pages/request-and-load.svelte +0 -21
  150. package/create/templates/svelte/pages/settings.svelte +0 -175
  151. package/create/templates/vue/babel.config.js +0 -10
  152. package/create/templates/vue/components/header.vue +0 -28
  153. package/create/templates/vue/components/sun-and-moon.vue +0 -34
  154. package/create/templates/vue/copy-assets.js +0 -67
  155. package/create/templates/vue/generate-home-page.js +0 -56
  156. package/create/templates/vue/generate-root.js +0 -50
  157. package/create/templates/vue/generate-routes.js +0 -7
  158. package/create/templates/vue/generate-scripts.js +0 -63
  159. package/create/templates/vue/global-components.d.ts +0 -121
  160. package/create/templates/vue/icons/moon.svg +0 -3
  161. package/create/templates/vue/icons/sun.svg +0 -3
  162. package/create/templates/vue/pages/404.vue +0 -12
  163. package/create/templates/vue/pages/about.vue +0 -15
  164. package/create/templates/vue/pages/catalog.vue +0 -39
  165. package/create/templates/vue/pages/dynamic-route.vue +0 -34
  166. package/create/templates/vue/pages/form.vue +0 -162
  167. package/create/templates/vue/pages/left-page-1.vue +0 -14
  168. package/create/templates/vue/pages/left-page-2.vue +0 -11
  169. package/create/templates/vue/pages/product.vue +0 -31
  170. package/create/templates/vue/pages/request-and-load.vue +0 -25
  171. package/create/templates/vue/pages/settings.vue +0 -18
  172. package/create/templates/vue/vite.config.js +0 -11
  173. package/create/templates/zaui/_tsconfig.json +0 -33
  174. package/create/templates/zaui/babel.config.js +0 -12
  175. package/create/templates/zaui/components/user-card.jsx +0 -16
  176. package/create/templates/zaui/copy-assets.js +0 -90
  177. package/create/templates/zaui/generate-home-page.js +0 -117
  178. package/create/templates/zaui/generate-root.js +0 -53
  179. package/create/templates/zaui/generate-routes.js +0 -10
  180. package/create/templates/zaui/generate-scripts.js +0 -39
  181. package/create/templates/zaui/generate-user-card.js +0 -55
  182. package/create/templates/zaui/pages/about.js +0 -129
  183. package/create/templates/zaui/pages/form.js +0 -123
  184. package/create/templates/zaui/pages/index.js +0 -9
  185. package/create/templates/zaui/pages/user.js +0 -109
  186. package/create/templates/zaui/vite.config.js +0 -11
  187. package/create/utils/colors.js +0 -94
  188. package/create/utils/dist/get-options.dev.js +0 -277
  189. package/create/utils/generate-gitignore.js +0 -43
  190. package/create/utils/generate-package-json.js +0 -132
  191. package/create/utils/generate-readme.js +0 -28
  192. package/create/utils/indent.js +0 -31
  193. package/create/utils/string.js +0 -13
  194. package/create/utils/styles-extension.js +0 -9
  195. package/create/utils/template-if.js +0 -9
  196. package/deploy/dist/index.dev.js +0 -227
  197. package/deploy/utils/dist/request-upload.dev.js +0 -62
  198. package/deploy/utils/dist/upload-app.dev.js +0 -113
  199. package/dist/bundle.js +0 -1
  200. package/dist/index.dev.js +0 -352
  201. package/jsconfig.json +0 -8
  202. package/login/dist/index.dev.js +0 -223
  203. package/login/utils/dist/zalo-login.dev.js +0 -41
  204. package/screenshots/wellcome.jpg +0 -0
  205. package/show-qr-app/assets/css/style.css +0 -87
  206. package/show-qr-app/assets/js/qrcode.min.js +0 -1
  207. package/show-qr-app/index.html +0 -57
  208. package/show-qr-app/package.json +0 -14
  209. package/start/dist/index.dev.js +0 -312
  210. package/start/generate-hr-config.js +0 -59
  211. package/ui/server.js +0 -194
  212. package/ui/www/css/app.css +0 -1
  213. package/ui/www/css/app.css.map +0 -1
  214. package/ui/www/fonts/ZMPIcons-Regular.eot +0 -0
  215. package/ui/www/fonts/ZMPIcons-Regular.ttf +0 -0
  216. package/ui/www/fonts/ZMPIcons-Regular.woff +0 -0
  217. package/ui/www/fonts/ZMPIcons-Regular.woff2 +0 -0
  218. package/ui/www/images/logo.png +0 -0
  219. package/ui/www/index.html +0 -1
  220. package/ui/www/js/app.js +0 -3
  221. package/ui/www/js/app.js.LICENSE.txt +0 -20
  222. package/ui/www/js/app.js.map +0 -1
  223. package/ui/www/static/icons/apple-touch-icon.png +0 -0
  224. package/ui/www/static/icons/favicon.png +0 -0
  225. package/utils/dist/get-app-info.dev.js +0 -54
@@ -1,39 +0,0 @@
1
- <template>
2
- <zmp-page name="catalog">
3
- <zmp-navbar title="Catalog"></zmp-navbar>
4
- <zmp-list>
5
- <zmp-list-item
6
- v-for="(product) in products"
7
- :key="product.id"
8
- :title="product.title"
9
- :link="`/product/${product.id}/`"
10
- ></zmp-list-item>
11
- </zmp-list>
12
- <zmp-block v-if="products.length === 3">
13
- <zmp-button fill @click="addProduct">Add Product</zmp-button>
14
- </zmp-block>
15
- </zmp-page>
16
- </template>
17
- <script>
18
- import { useStore } from 'zmp-vue';
19
- import store from '../store'
20
-
21
- export default {
22
- setup() {
23
- const products = useStore('products');
24
-
25
- const addProduct = () => {
26
- store.dispatch('addProduct', {
27
- id: '4',
28
- title: 'Apple iPhone 12',
29
- description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi tempora similique reiciendis, error nesciunt vero, blanditiis pariatur dolor, minima sed sapiente rerum, dolorem corrupti hic modi praesentium unde saepe perspiciatis.'
30
- });
31
- }
32
-
33
- return {
34
- products,
35
- addProduct,
36
- };
37
- }
38
- };
39
- </script>
@@ -1,34 +0,0 @@
1
- <template>
2
- <zmp-page>
3
- <zmp-navbar title="Dynamic Route" back-link="Back"></zmp-navbar>
4
- <zmp-block strong>
5
- <ul>
6
- <li><b>Url:</b> {{zmproute.url}}</li>
7
- <li><b>Path:</b> {{zmproute.path}}</li>
8
- <li><b>Hash:</b> {{zmproute.hash}}</li>
9
- <li><b>Params:</b>
10
- <ul>
11
- <li v-for="(value, key) in zmproute.params" :key="key"><b>{{key}}:</b> {{value}}</li>
12
- </ul>
13
- </li>
14
- <li><b>Query:</b>
15
- <ul>
16
- <li v-for="(value, key) in zmproute.query" :key="key"><b>{{key}}:</b> {{value}}</li>
17
- </ul>
18
- </li>
19
- <li><b>Route:</b> {{zmproute.route.path}}</li>
20
- </ul>
21
- </zmp-block>
22
- <zmp-block strong>
23
- <zmp-link @click="zmprouter.back()">Go back via Router API</zmp-link>
24
- </zmp-block>
25
- </zmp-page>
26
- </template>
27
- <script>
28
- export default {
29
- props: {
30
- zmproute: Object,
31
- zmprouter: Object,
32
- },
33
- };
34
- </script>
@@ -1,162 +0,0 @@
1
- <template>
2
- <zmp-page name="form">
3
- <zmp-navbar title="Form" back-link="Back"></zmp-navbar>
4
-
5
- <zmp-block-title>Form Example</zmp-block-title>
6
- <zmp-list no-hairlines-md>
7
- <zmp-list-input
8
- label="Name"
9
- type="text"
10
- placeholder="Your name"
11
- ></zmp-list-input>
12
-
13
- <zmp-list-input
14
- label="E-mail"
15
- type="email"
16
- placeholder="E-mail"
17
- ></zmp-list-input>
18
-
19
- <zmp-list-input
20
- label="URL"
21
- type="url"
22
- placeholder="URL"
23
- ></zmp-list-input>
24
-
25
- <zmp-list-input
26
- label="Password"
27
- type="password"
28
- placeholder="Password"
29
- ></zmp-list-input>
30
-
31
- <zmp-list-input
32
- label="Phone"
33
- type="tel"
34
- placeholder="Phone"
35
- ></zmp-list-input>
36
-
37
- <zmp-list-input
38
- label="Gender"
39
- type="select"
40
- >
41
- <option>Male</option>
42
- <option>Female</option>
43
- </zmp-list-input>
44
-
45
- <zmp-list-input
46
- label="Birth date"
47
- type="date"
48
- placeholder="Birth day"
49
- defaultValue="2014-04-30"
50
- ></zmp-list-input>
51
-
52
- <zmp-list-item
53
- title="Toggle"
54
- >
55
- <template #after>
56
- <zmp-toggle />
57
- </template>
58
- </zmp-list-item>
59
-
60
- <zmp-list-input
61
- label="Range"
62
- :input="false"
63
- >
64
- <template #input>
65
- <zmp-range :value="50" :min="0" :max="100" :step="1" />
66
- </template>
67
- </zmp-list-input>
68
-
69
- <zmp-list-input
70
- type="textarea"
71
- label="Textarea"
72
- placeholder="Bio"
73
- ></zmp-list-input>
74
- <zmp-list-input
75
- type="textarea"
76
- label="Resizable"
77
- placeholder="Bio"
78
- resizable
79
- ></zmp-list-input>
80
- </zmp-list>
81
-
82
- <zmp-block-title>Buttons</zmp-block-title>
83
- <zmp-block strong>
84
- <zmp-row tag="p">
85
- <zmp-button class="col">Button</zmp-button>
86
- <zmp-button class="col" fill>Fill</zmp-button>
87
- </zmp-row>
88
- <zmp-row tag="p">
89
- <zmp-button class="col" raised>Raised</zmp-button>
90
- <zmp-button class="col" raised fill>Raised Fill</zmp-button>
91
- </zmp-row>
92
- <zmp-row tag="p">
93
- <zmp-button class="col" round>Round</zmp-button>
94
- <zmp-button class="col" round fill>Round Fill</zmp-button>
95
- </zmp-row>
96
- <zmp-row tag="p">
97
- <zmp-button class="col" outline>Outline</zmp-button>
98
- <zmp-button class="col" round outline>Outline Round</zmp-button>
99
- </zmp-row>
100
- <zmp-row tag="p">
101
- <zmp-button class="col" small outline>Small</zmp-button>
102
- <zmp-button class="col" small round outline>Small Round</zmp-button>
103
- </zmp-row>
104
- <zmp-row tag="p">
105
- <zmp-button class="col" small fill>Small</zmp-button>
106
- <zmp-button class="col" small round fill>Small Round</zmp-button>
107
- </zmp-row>
108
- <zmp-row tag="p">
109
- <zmp-button class="col" large raised>Large</zmp-button>
110
- <zmp-button class="col" large fill raised>Large Fill</zmp-button>
111
- </zmp-row>
112
- <zmp-row tag="p">
113
- <zmp-button class="col" large fill raised color="red">Large Red</zmp-button>
114
- <zmp-button class="col" large fill raised color="green">Large Green</zmp-button>
115
- </zmp-row>
116
- </zmp-block>
117
-
118
- <zmp-block-title>Checkbox group</zmp-block-title>
119
- <zmp-list>
120
- <zmp-list-item
121
- checkbox
122
- name="my-checkbox"
123
- value="Books"
124
- title="Books"
125
- ></zmp-list-item>
126
- <zmp-list-item
127
- checkbox
128
- name="my-checkbox"
129
- value="Movies"
130
- title="Movies"
131
- ></zmp-list-item>
132
- <zmp-list-item
133
- checkbox
134
- name="my-checkbox"
135
- value="Food"
136
- title="Food"
137
- ></zmp-list-item>
138
- </zmp-list>
139
-
140
- <zmp-block-title>Radio buttons group</zmp-block-title>
141
- <zmp-list>
142
- <zmp-list-item
143
- radio
144
- name="radio"
145
- value="Books"
146
- title="Books"
147
- ></zmp-list-item>
148
- <zmp-list-item
149
- radio
150
- name="radio"
151
- value="Movies"
152
- title="Movies"
153
- ></zmp-list-item>
154
- <zmp-list-item
155
- radio
156
- name="radio"
157
- value="Food"
158
- title="Food"
159
- ></zmp-list-item>
160
- </zmp-list>
161
- </zmp-page>
162
- </template>
@@ -1,14 +0,0 @@
1
- <template>
2
- <zmp-page>
3
- <zmp-navbar title="Left Page 1" back-link="Back"></zmp-navbar>
4
- <zmp-block strong>
5
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit deserunt vel accusamus voluptatem neque! Laborum, et facilis at. Est dolorem, reprehenderit, sed repellendus at cum incidunt labore vel perferendis excepturi?</p>
6
- <p>Tempore accusantium quaerat officiis dolores ullam, perferendis labore assumenda. A sint quo necessitatibus temporibus ipsam adipisci et quos aliquid officiis, facilis nulla ut aperiam assumenda magnam blanditiis exercitationem facere non!</p>
7
- <p>Omnis accusamus harum, vero dolores itaque, asperiores laudantium eligendi ipsa, labore dignissimos unde temporibus eius assumenda, obcaecati fuga et. Et provident at consectetur vel temporibus ea nam, veritatis excepturi obcaecati.</p>
8
- <p>Aspernatur dolorum nostrum est sapiente deleniti in. Placeat itaque expedita dignissimos, suscipit tenetur necessitatibus sunt excepturi quisquam, doloremque repudiandae mollitia in. Nesciunt quo vel, dolorum magni nihil officia reprehenderit libero.</p>
9
- <p>Fugit nesciunt nobis at doloribus labore, voluptatem quis, distinctio, saepe illo adipisci qui molestias fugiat ut! Quasi animi possimus temporibus repudiandae quam aspernatur, recusandae libero, reiciendis distinctio cupiditate nesciunt a.</p>
10
- </zmp-block>
11
- </zmp-page>
12
- </template>
13
-
14
-
@@ -1,11 +0,0 @@
1
- <template>
2
- <zmp-page>
3
- <zmp-navbar title="Left Page 2" back-link="Back"></zmp-navbar>
4
- <zmp-block strong>
5
- <p>Maxime tempore, repellendus? Sequi saepe provident quas, neque assumenda dicta odit eaque nesciunt facere mollitia totam voluptate aspernatur vel corporis repudiandae commodi ad cumque repellendus. Saepe officia iure repellat repellendus.</p>
6
- <p>Ea maiores accusantium non fuga dicta, vero minus veniam! Ipsum eveniet vero voluptate veritatis aspernatur hic dicta adipisci, debitis. Sint quam aperiam repellat quis perspiciatis accusantium ipsum nulla soluta temporibus.</p>
7
- <p>Necessitatibus ipsum culpa doloremque, nostrum atque totam minima itaque! Blanditiis nobis nam repudiandae, ut nostrum voluptate accusantium atque, veniam libero quaerat corporis laborum earum rem nihil unde. Vitae cum, aliquam?</p>
8
- <p>Debitis aliquid nemo maxime recusandae, mollitia sed error vero. Atque molestiae rem necessitatibus nam voluptas quaerat, reiciendis, excepturi quis facilis, quod cupiditate vitae voluptate repudiandae! Unde impedit aut id ut?</p>
9
- </zmp-block>
10
- </zmp-page>
11
- </template>
@@ -1,31 +0,0 @@
1
- <template>
2
- <zmp-page name="product">
3
- <zmp-navbar :title="product.title" back-link="Back"></zmp-navbar>
4
- <zmp-block-title>About {{product.title}}</zmp-block-title>
5
- <zmp-block strong>
6
- {{product.description}}
7
- </zmp-block>
8
- </zmp-page>
9
- </template>
10
- <script>
11
- import { useStore } from 'zmp-vue';
12
-
13
- export default {
14
- props: {
15
- zmproute: Object,
16
- },
17
- setup(props) {
18
- const products = useStore('products');
19
- const productId = props.zmproute.params.id;
20
- let currentProduct;
21
- products.forEach(function (product) {
22
- if (product.id === productId) {
23
- currentProduct = product;
24
- }
25
- });
26
- return {
27
- product: currentProduct,
28
- };
29
- },
30
- };
31
- </script>
@@ -1,25 +0,0 @@
1
- <template>
2
- <zmp-page>
3
- <zmp-navbar :title="`${user.firstName} ${user.lastName}`" back-link="Back"></zmp-navbar>
4
- <zmp-block strong>
5
- {{user.about}}
6
- </zmp-block>
7
- <zmp-list>
8
- <zmp-list-item
9
- v-for="(link, index) in user.links"
10
- :key="index"
11
- :link="link.url"
12
- :title="link.title"
13
- external
14
- target="_blank"
15
- ></zmp-list-item>
16
- </zmp-list>
17
- </zmp-page>
18
- </template>
19
- <script>
20
- export default {
21
- props: {
22
- user: Object,
23
- }
24
- }
25
- </script>
@@ -1,18 +0,0 @@
1
- <template>
2
- <zmp-page bg-color="white">
3
- <zmp-box m="4">
4
- <zmp-title>Settings</zmp-title>
5
- <zmp-list>
6
- <zmp-list-item title="Show notifications">
7
- <zmp-toggle />
8
- </zmp-list-item>
9
- <zmp-list-item title="Auto update">
10
- <zmp-preloader />
11
- </zmp-list-item>
12
- <zmp-list-item title="Volume">
13
- <zmp-range style="width: 50%" />
14
- </zmp-list-item>
15
- </zmp-list>
16
- </zmp-box>
17
- </zmp-page>
18
- </template>
@@ -1,11 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import vue from '@vitejs/plugin-vue';
3
-
4
- // https://vitejs.dev/config/
5
- export default () => {
6
- return defineConfig({
7
- plugins: [vue()],
8
- root: './src',
9
- base: ''
10
- })
11
- }
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "noEmit": true,
4
- "target": "es6",
5
- "module": "esnext",
6
- "noImplicitAny": false,
7
- "preserveConstEnums": true,
8
- "jsx": "react",
9
- "lib": ["dom", "es5", "es6", "es7", "es2017"],
10
- "allowSyntheticDefaultImports": true,
11
- "esModuleInterop": true,
12
- "allowJs": true,
13
- "skipLibCheck": true,
14
- "declaration": false,
15
- "emitDecoratorMetadata": true,
16
- "experimentalDecorators": true,
17
- "forceConsistentCasingInFileNames": true,
18
- "moduleResolution": "node",
19
- "noEmitOnError": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noImplicitReturns": true,
22
- "noImplicitThis": true,
23
- "noUnusedLocals": false,
24
- "strict": true,
25
- "strictFunctionTypes": false,
26
- "pretty": true,
27
- "removeComments": true,
28
- "sourceMap": true,
29
- "resolveJsonModule": true
30
- },
31
- "exclude": ["node_modules"],
32
- "include": ["src"]
33
- }
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@babel/preset-react',
4
- [
5
- '@babel/preset-env',
6
- {
7
- modules: false,
8
- },
9
- ],
10
- ],
11
- plugins: ['@babel/plugin-transform-runtime'],
12
- };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { Avatar, Box, Text } from 'zmp-ui';
3
-
4
- const UserCard = ({ user }) => {
5
- return (
6
- <Box flex>
7
- <Avatar story='default' online src={user.avatar.startsWith('http') ? user.avatar : null}>{user.avatar}</Avatar>
8
- <Box ml={4}>
9
- <Text.Title>{user.name}</Text.Title>
10
- <Text>{user.id}</Text>
11
- </Box>
12
- </Box>
13
- )
14
- };
15
-
16
- export default UserCard;
@@ -1,90 +0,0 @@
1
- const path = require('path');
2
- const generateHomePage = require('./generate-home-page');
3
- const generateRoot = require('./generate-root');
4
- const generateRecoil = require('../generate-recoil');
5
- const generateUserCard = require('./generate-user-card');
6
- const copyPages = require('./pages');
7
- const { projectFramework } = require('../../../utils/constants');
8
- const fse = require('../../../utils/fs-extra');
9
-
10
- module.exports = (options) => {
11
- const cwd = options.cwd || process.cwd();
12
- const { template, stateManagement, framework } = options;
13
- const toCopy = [];
14
-
15
- // Copy Pages
16
-
17
- const ext = framework === projectFramework.REACT_TYPESCRIPT ?'tsx': 'jsx'
18
-
19
- let pages = [];
20
- if (template !== 'blank')
21
- pages.push(
22
- ...[
23
- { fileName: 'about', content: 'copyAbout' },
24
- { fileName: 'user', content: 'copyUser' },
25
- { fileName: 'form', content: 'copyForm' },
26
- ]
27
- );
28
-
29
-
30
- pages.forEach(({ fileName, content }) => {
31
- const dest = path.resolve(cwd, 'src', 'pages', `${fileName}.${ext}`);
32
- toCopy.push({
33
- content: copyPages[content](options),
34
- to: dest,
35
- });
36
- });
37
-
38
-
39
- toCopy.push({
40
- content: generateHomePage(options),
41
- to: path.resolve(cwd, 'src', 'pages', `index.${ext}`),
42
- });
43
-
44
- if(template !== 'blank') {
45
- toCopy.push({
46
- content: generateUserCard(options),
47
- to: path.resolve(cwd, 'src','components', `user-card.${ext}`)
48
- })
49
- }
50
-
51
-
52
- toCopy.push({
53
- content: generateRoot(options),
54
- to: path.resolve(cwd, 'src', 'components', `app.${ext}`),
55
- });
56
-
57
- if(framework === projectFramework.REACT_TYPESCRIPT){
58
- if (stateManagement === 'recoil') {
59
- toCopy.push({
60
- content: generateRecoil(options),
61
- to: path.resolve(cwd, 'src', 'state.ts'),
62
- });
63
- }
64
-
65
-
66
- }else {
67
- if (stateManagement === 'recoil') {
68
- toCopy.push({
69
- content: generateRecoil(options),
70
- to: path.resolve(cwd, 'src', 'state.js'),
71
- });
72
- }
73
-
74
- }
75
- const isTs = framework === projectFramework.REACT_TYPESCRIPT
76
-
77
- toCopy.push({
78
- content: fse.readFileSync(path.resolve(__dirname, 'vite.config.js'),'utf8'),
79
- to: path.resolve(cwd, `vite.config.${isTs ? 'ts':'js'}`),
80
- });
81
-
82
- if(framework === projectFramework.REACT_TYPESCRIPT){
83
- toCopy.push({
84
- from: path.resolve(__dirname, '_tsconfig.json'),
85
- to: path.resolve(cwd, 'tsconfig.json')
86
- })
87
- }
88
-
89
- return toCopy;
90
- };
@@ -1,117 +0,0 @@
1
- const { projectFramework } = require('../../../utils/constants');
2
- const indent = require('../../utils/indent');
3
- module.exports = (options) => {
4
- const { name, template, framework, stateManagement } = options;
5
- if(framework === projectFramework.REACT_TYPESCRIPT){
6
- return indent(
7
- 0,
8
- `
9
- import React from 'react';
10
- ${
11
- template === 'blank'
12
- ? `
13
- import { Page } from 'zmp-ui';
14
- `.trim()
15
- : `
16
- import {
17
- List,
18
- Page,
19
- Icon,
20
- useNavigate
21
- } from 'zmp-ui';${stateManagement === 'recoil' ? `
22
- import { useRecoilValue } from 'recoil';
23
- import { userInfo } from "zmp-sdk";
24
- import { userState } from '../state';` : ''}
25
- ${template !=='blank' ?`
26
- import UserCard from '../components/user-card';
27
- `:''}
28
- `.trim()
29
- }
30
-
31
- const HomePage:React.FunctionComponent = () => {
32
- ${template !== 'blank' ? (stateManagement === 'recoil' ? "const user = useRecoilValue<userInfo>(userState);" : "const user = useStore('user');") : ''}
33
- ${template !=='blank' ? `const navigate = useNavigate()`:''}
34
- return (
35
- ${template==='blank' ?`<Page className="page">
36
- Hello Zalo Mini App
37
- </Page> `.trim():
38
- `
39
- <Page className="page">
40
- <div className="section-container">
41
- <UserCard user={user}/>
42
- </div>
43
- <div className="section-container">
44
- <List >
45
- <List.Item suffix={<Icon icon="zi-arrow-right"/>}>
46
- <div onClick={()=>navigate('/about')}>About</div>
47
- </List.Item>
48
- <List.Item suffix={<Icon icon="zi-arrow-right"/>}>
49
- <div onClick={()=>navigate('/user')}>User</div>
50
- </List.Item>
51
- </List>
52
- </div>
53
- </Page>`.trim()
54
- }
55
- );
56
- }
57
-
58
- export default HomePage;
59
- `
60
- ).trim();
61
- }
62
- return indent(
63
- 0,
64
- `
65
- import React from 'react';
66
- ${
67
- template === 'blank'
68
- ? `
69
- import {
70
- Page
71
- } from 'zmp-ui';
72
- `.trim()
73
- : `
74
- import {
75
- List,
76
- Page,
77
- Icon,useNavigate
78
- } from 'zmp-ui';${stateManagement === 'recoil' ? `
79
- import { useRecoilValue } from 'recoil';
80
- import { userState } from '../state';` : ''}
81
- ${template !=='blank' ?`
82
- import UserCard from '../components/user-card';
83
- `:''}
84
- `.trim()
85
- }
86
-
87
- const HomePage = () => {
88
- ${template !== 'blank' ? (stateManagement === 'recoil' ? "const user = useRecoilValue(userState);" : "const user = useStore('user');") : ''}
89
- ${template !=='blank' ? `const navigate = useNavigate()`:''}
90
- return (
91
- ${template==='blank' ?`<Page className="page">
92
- Hello Zalo Mini App
93
- </Page> `.trim():
94
- `
95
- <Page className="page">
96
- <div className="section-container">
97
- <UserCard user={user}/>
98
- </div>
99
- <div className="section-container">
100
- <List >
101
- <List.Item suffix={<Icon icon="zi-arrow-right"/>}>
102
- <div onClick={()=>navigate('/about')}>About</div>
103
- </List.Item>
104
- <List.Item suffix={<Icon icon="zi-arrow-right"/>}>
105
- <div onClick={()=>navigate('/user')}>User</div>
106
- </List.Item>
107
- </List>
108
- </div>
109
- </Page>`.trim()
110
- }
111
- );
112
- }
113
-
114
- export default HomePage;
115
- `
116
- ).trim();
117
- };
@@ -1,53 +0,0 @@
1
- const templateIf = require('../../utils/template-if');
2
- const indent = require('../../utils/indent');
3
- const { capitalize } = require('../../utils/string')
4
- module.exports = (options) => {
5
- const { template, theming, stateManagement } = options;
6
-
7
- // Views
8
-
9
- const routes = []
10
- if(template ==='single-view'){
11
- routes.push('about','form','user')
12
- }
13
- return indent(
14
- 0,
15
- `
16
- import React from 'react';
17
- import { Route} from 'react-router-dom'
18
- ${['blank', 'single-view'].indexOf(template) >= 0
19
- ? `
20
- import { App, ZMPRouter, AnimationRoutes, SnackbarProvider } from 'zmp-ui';
21
- `.trim(): ''
22
- }
23
- ${templateIf(stateManagement === 'recoil', () => `import { RecoilRoot } from 'recoil';`,'')}
24
- import HomePage from '../pages';
25
- ${routes.length>0 ? routes.map((route) => ` import ${capitalize(route)} from '../pages/${route}';\n`).join('').trim():''}
26
-
27
-
28
- const MyApp = () => {
29
- ${`
30
- return (${stateManagement === 'recoil' ? `
31
- <RecoilRoot>` : ''}
32
- ${indent(stateManagement === 'recoil' ? 2 : 0, `<App ${theming.darkTheme ? 'themeDark' : ''}>`)}
33
- <SnackbarProvider>
34
- <ZMPRouter>
35
- <AnimationRoutes>
36
- <Route path="/" element={<HomePage></HomePage>}></Route>
37
- ${routes.length>0 ? routes.map((route) =>{
38
- const pageName = capitalize(route)
39
- return ` <Route path="/${route}" element={<${pageName}></${pageName}>}></Route>\n`
40
- }).join('').trim(): ''
41
- }
42
- </AnimationRoutes>
43
- </ZMPRouter>
44
- </SnackbarProvider>
45
- ${indent(stateManagement === 'recoil' ? 2 : 0, `</App>`)}${stateManagement === 'recoil' ? `
46
- </RecoilRoot>` : ''}
47
- );
48
- `.trim()}
49
- }
50
- export default MyApp;
51
- `
52
- ).trim();
53
- };