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,49 +1 @@
|
|
|
1
|
-
module.exports
|
|
2
|
-
const { name, theming } = options;
|
|
3
|
-
const iconsFolder = 'static';
|
|
4
|
-
const manifest = {
|
|
5
|
-
name,
|
|
6
|
-
short_name: name,
|
|
7
|
-
description: name,
|
|
8
|
-
lang: 'en-US',
|
|
9
|
-
start_url: '/',
|
|
10
|
-
display: 'standalone',
|
|
11
|
-
background_color:
|
|
12
|
-
theming.customColor && theming.color ? `${theming.color}` : '#EE350F',
|
|
13
|
-
theme_color:
|
|
14
|
-
theming.customColor && theming.color ? `${theming.color}` : '#EE350F',
|
|
15
|
-
icons: [
|
|
16
|
-
{
|
|
17
|
-
src: `/${iconsFolder}/icons/128x128.png`,
|
|
18
|
-
sizes: '128x128',
|
|
19
|
-
type: 'image/png',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
src: `/${iconsFolder}/icons/144x144.png`,
|
|
23
|
-
sizes: '144x144',
|
|
24
|
-
type: 'image/png',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
src: `/${iconsFolder}/icons/152x152.png`,
|
|
28
|
-
sizes: '152x152',
|
|
29
|
-
type: 'image/png',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
src: `/${iconsFolder}/icons/192x192.png`,
|
|
33
|
-
sizes: '192x192',
|
|
34
|
-
type: 'image/png',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
src: `/${iconsFolder}/icons/256x256.png`,
|
|
38
|
-
sizes: '256x256',
|
|
39
|
-
type: 'image/png',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
src: `/${iconsFolder}/icons/512x512.png`,
|
|
43
|
-
sizes: '512x512',
|
|
44
|
-
type: 'image/png',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
};
|
|
48
|
-
return JSON.stringify(manifest, null, 2);
|
|
49
|
-
};
|
|
1
|
+
"use strict";module.exports=s=>{let{name:o,theming:e}=s,n="static";return JSON.stringify({name:o,short_name:o,description:o,lang:"en-US",start_url:"/",display:"standalone",background_color:e.customColor&&e.color?`${e.color}`:"#EE350F",theme_color:e.customColor&&e.color?`${e.color}`:"#EE350F",icons:[{src:`/${n}/icons/128x128.png`,sizes:"128x128",type:"image/png"},{src:`/${n}/icons/144x144.png`,sizes:"144x144",type:"image/png"},{src:`/${n}/icons/152x152.png`,sizes:"152x152",type:"image/png"},{src:`/${n}/icons/192x192.png`,sizes:"192x192",type:"image/png"},{src:`/${n}/icons/256x256.png`,sizes:"256x256",type:"image/png"},{src:`/${n}/icons/512x512.png`,sizes:"512x512",type:"image/png"}]},null,2)};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const templateIf = require('../utils/template-if');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const { framework, template } = options;
|
|
6
|
-
|
|
7
|
-
const productState = `
|
|
1
|
+
"use strict";require("../utils/indent");const e=require("../utils/template-if");module.exports=i=>{let{framework:t,template:r}=i,a=`
|
|
8
2
|
|
|
9
3
|
export const productsState = atom({
|
|
10
4
|
key: "products",
|
|
@@ -25,10 +19,7 @@ export const productsState = atom({
|
|
|
25
19
|
description: 'Expedita sequi perferendis quod illum pariatur aliquam, alias laboriosam! Vero blanditiis placeat, mollitia necessitatibus reprehenderit. Labore dolores amet quos, accusamus earum asperiores officiis assumenda optio architecto quia neque, quae eum.'
|
|
26
20
|
},
|
|
27
21
|
]
|
|
28
|
-
});`;
|
|
29
|
-
|
|
30
|
-
if (framework === 'react-typescript') {
|
|
31
|
-
return `
|
|
22
|
+
});`;return"react-typescript"===t?`
|
|
32
23
|
import { atom } from "recoil";
|
|
33
24
|
import { userInfo } from 'zmp-sdk';
|
|
34
25
|
|
|
@@ -40,9 +31,7 @@ export const userState = atom<userInfo>({
|
|
|
40
31
|
avatar: 'ZA',
|
|
41
32
|
}
|
|
42
33
|
})
|
|
43
|
-
${
|
|
44
|
-
}
|
|
45
|
-
return `import { atom } from "recoil";
|
|
34
|
+
${e("tabs"===r,()=>a)}`:`import { atom } from "recoil";
|
|
46
35
|
|
|
47
36
|
export const userState = atom({
|
|
48
37
|
key: "user",
|
|
@@ -52,5 +41,4 @@ export const userState = atom({
|
|
|
52
41
|
avatar: 'ZA',
|
|
53
42
|
}
|
|
54
43
|
})
|
|
55
|
-
${
|
|
56
|
-
};
|
|
44
|
+
${e("tabs"===r,()=>a)}`};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const generateVueRoutes = require('./vue/generate-routes');
|
|
3
|
-
const generateReactRoutes = require('./react/generate-routes');
|
|
4
|
-
const generateReactTsRoutes = require('./react-typescript/generate-routes');
|
|
5
|
-
// const generateSvelteRoutes = require('./svelte/generate-routes');
|
|
6
|
-
|
|
7
|
-
module.exports = (options) => {
|
|
8
|
-
const { framework } = options;
|
|
9
|
-
// if (framework === 'core') return generateCoreRoutes(options);
|
|
10
|
-
if (framework === 'vue') return generateVueRoutes(options);
|
|
11
|
-
if (framework === 'react') return generateReactRoutes(options);
|
|
12
|
-
if (framework === 'react-typescript') return generateReactTsRoutes(options);
|
|
13
|
-
|
|
14
|
-
// if (framework === 'svelte') return generateSvelteRoutes(options);
|
|
15
|
-
return [];
|
|
16
|
-
};
|
|
1
|
+
"use strict";const e=require("./vue/generate-routes"),r=require("./react/generate-routes"),t=require("./react-typescript/generate-routes");module.exports=u=>{let{framework:s}=u;return"vue"===s?e(u):"react"===s?r(u):"react-typescript"===s?t(u):[]};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const generateVueScripts = require('./vue/generate-scripts');
|
|
3
|
-
const generateReactScripts = require('./react/generate-scripts');
|
|
4
|
-
const generateSvelteScripts = require('./svelte/generate-scripts');
|
|
5
|
-
const generateReactTsScripts = require('./react-typescript/generate-scripts');
|
|
6
|
-
const generateZauiScripts = require('./zaui/generate-scripts');
|
|
7
|
-
module.exports = (options) => {
|
|
8
|
-
const { framework, package } = options;
|
|
9
|
-
if (package === 'zmp-ui') return generateZauiScripts(options);
|
|
10
|
-
if (framework === 'core') return generateCoreScripts(options);
|
|
11
|
-
if (framework === 'vue') return generateVueScripts(options);
|
|
12
|
-
if (framework === 'react') return generateReactScripts(options);
|
|
13
|
-
if (framework === 'svelte') return generateSvelteScripts(options);
|
|
14
|
-
if (framework === 'react-typescript') return generateReactTsScripts(options);
|
|
15
|
-
return '';
|
|
16
|
-
};
|
|
1
|
+
"use strict";const e=require("./core/generate-scripts"),r=require("./vue/generate-scripts"),t=require("./react/generate-scripts"),s=require("./svelte/generate-scripts"),c=require("./react-typescript/generate-scripts"),i=require("./zaui/generate-scripts");module.exports=a=>{let{framework:p}=a;return"zmp-ui"===a.package?i(a):"core"===p?e(a):"vue"===p?r(a):"react"===p?t(a):"svelte"===p?s(a):"react-typescript"===p?c(a):""};
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const templateIf = require('../utils/template-if');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const { bundler, theming } = options;
|
|
6
|
-
return indent(0, `
|
|
1
|
+
"use strict";const s=require("../utils/indent"),o=require("../utils/template-if");module.exports=e=>{let{bundler:n,theming:r}=e;return s(0,`
|
|
7
2
|
// Import Workbox (https://developers.google.com/web/tools/workbox/)
|
|
8
3
|
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js');
|
|
9
4
|
|
|
@@ -24,7 +19,7 @@ module.exports = (options) => {
|
|
|
24
19
|
revision: '1',
|
|
25
20
|
url: 'css/app.css'
|
|
26
21
|
},
|
|
27
|
-
${
|
|
22
|
+
${o(r.iconFonts,()=>`
|
|
28
23
|
{
|
|
29
24
|
revision: '1',
|
|
30
25
|
url: 'css/icons.css'
|
|
@@ -42,7 +37,7 @@ module.exports = (options) => {
|
|
|
42
37
|
revision: '1',
|
|
43
38
|
url: 'app.js'
|
|
44
39
|
},
|
|
45
|
-
${
|
|
40
|
+
${o(r.iconFonts,()=>`
|
|
46
41
|
// Fonts
|
|
47
42
|
{
|
|
48
43
|
revision: '1',
|
|
@@ -122,5 +117,4 @@ module.exports = (options) => {
|
|
|
122
117
|
It is better to comment next line during development
|
|
123
118
|
*/
|
|
124
119
|
workbox.precaching.precacheAndRoute(self.__WB_MANIFEST || []);
|
|
125
|
-
`).trim();
|
|
126
|
-
};
|
|
120
|
+
`).trim()};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const templateIf = require('../utils/template-if');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = (options) => {
|
|
6
|
-
const { framework } = options;
|
|
7
|
-
if (framework === 'vue') {
|
|
8
|
-
return indent(0, `
|
|
1
|
+
"use strict";const e=require("../utils/indent");require("../utils/template-if"),module.exports=t=>{let{framework:r}=t;return"vue"===r?e(0,`
|
|
9
2
|
import { createStore } from 'zmp-core/lite';
|
|
10
3
|
const store = createStore({
|
|
11
4
|
state: {
|
|
@@ -35,10 +28,8 @@ module.exports = (options) => {
|
|
|
35
28
|
})
|
|
36
29
|
|
|
37
30
|
export default store;
|
|
38
|
-
`)
|
|
39
|
-
}
|
|
40
|
-
return indent(0, `
|
|
41
|
-
import { createStore } from 'zmp-core${framework === 'core' ? '' : '/lite'}';
|
|
31
|
+
`):e(0,`
|
|
32
|
+
import { createStore } from 'zmp-core${"core"===r?"":"/lite"}';
|
|
42
33
|
const store = createStore({
|
|
43
34
|
state: {
|
|
44
35
|
user: {
|
|
@@ -83,6 +74,4 @@ module.exports = (options) => {
|
|
|
83
74
|
})
|
|
84
75
|
|
|
85
76
|
export default store;
|
|
86
|
-
`
|
|
87
|
-
);
|
|
88
|
-
};
|
|
77
|
+
`)};
|
|
@@ -1,69 +1,25 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { colorThemeCSSProperties } = require('../utils/colors');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const { template, theming, package } = options;
|
|
6
|
-
const { customColor, color, fillBars } = theming;
|
|
7
|
-
|
|
8
|
-
let styles = '';
|
|
9
|
-
|
|
10
|
-
if (package === 'zmp-ui') {
|
|
11
|
-
return `
|
|
1
|
+
"use strict";const e=require("../utils/indent"),{colorThemeCSSProperties:i}=require("../utils/colors");module.exports=t=>{let{template:n,theming:o}=t,{customColor:a,color:r,fillBars:p}=o,l="";if("zmp-ui"===t.package)return`
|
|
12
2
|
.page {
|
|
13
3
|
padding: 16px 16px 96px 16px;
|
|
14
4
|
}
|
|
15
|
-
|
|
5
|
+
|
|
16
6
|
.section-container {
|
|
17
7
|
padding: 16px;
|
|
18
8
|
background: #ffffff;
|
|
19
9
|
border-radius: 8px;
|
|
20
10
|
margin-bottom: 24px;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let themeRgb = [0, 122, 255];
|
|
26
|
-
|
|
27
|
-
if (customColor && color) {
|
|
28
|
-
const customProps = colorThemeCSSProperties(`${color}`);
|
|
29
|
-
themeRgb = customProps['--zmp-theme-color-rgb']
|
|
30
|
-
.split(',')
|
|
31
|
-
.map((n) => n.trim());
|
|
32
|
-
styles += indent(
|
|
33
|
-
0,
|
|
34
|
-
`
|
|
11
|
+
}
|
|
12
|
+
`;if(a&&r){let t=i(`${r}`);t["--zmp-theme-color-rgb"].split(",").map(e=>e.trim()),l+=e(0,`
|
|
35
13
|
/* Custom color theme properties */
|
|
36
14
|
:root {
|
|
37
|
-
${Object.keys(
|
|
38
|
-
.filter(
|
|
39
|
-
(prop) =>
|
|
40
|
-
prop !== '--zmp-tabbar-fill-link-active-color' &&
|
|
41
|
-
prop !== '--zmp-tabbar-fill-link-active-border-color'
|
|
42
|
-
)
|
|
43
|
-
.map((prop) => `${prop}: ${customProps[prop]};`)
|
|
44
|
-
.join('\n ')}
|
|
15
|
+
${Object.keys(t).filter(e=>"--zmp-tabbar-fill-link-active-color"!==e&&"--zmp-tabbar-fill-link-active-border-color"!==e).map(e=>`${e}: ${t[e]};`).join("\n ")}
|
|
45
16
|
}
|
|
46
17
|
:root.theme-dark,:root .theme-dark {
|
|
47
|
-
${Object.keys(
|
|
48
|
-
.map((prop) => `${prop}: ${customProps[prop]};`)
|
|
49
|
-
.join('\n ')}
|
|
18
|
+
${Object.keys(t).map(e=>`${e}: ${t[e]};`).join("\n ")}
|
|
50
19
|
}
|
|
51
|
-
`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
if (fillBars) {
|
|
55
|
-
styles += indent(
|
|
56
|
-
0,
|
|
57
|
-
`
|
|
20
|
+
`)}return p&&(l+=e(0,`
|
|
58
21
|
/* Invert navigation bars to fill style */
|
|
59
|
-
`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (template === 'split-view') {
|
|
64
|
-
styles += indent(
|
|
65
|
-
0,
|
|
66
|
-
`
|
|
22
|
+
`)),"split-view"===n?l+=e(0,`
|
|
67
23
|
/* Left Panel right border when it is visible by breakpoint */
|
|
68
24
|
.panel-left.panel-in-breakpoint:before {
|
|
69
25
|
position: absolute;
|
|
@@ -95,16 +51,6 @@ module.exports = (options) => {
|
|
|
95
51
|
content: '';
|
|
96
52
|
z-index: 6000;
|
|
97
53
|
}
|
|
98
|
-
`
|
|
99
|
-
);
|
|
100
|
-
} else {
|
|
101
|
-
styles += indent(
|
|
102
|
-
0,
|
|
103
|
-
`
|
|
54
|
+
`):l+=e(0,`
|
|
104
55
|
/* Your app custom styles here */
|
|
105
|
-
`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return styles.trim();
|
|
110
|
-
};
|
|
56
|
+
`),l.trim()};
|
|
@@ -1,55 +1,19 @@
|
|
|
1
|
-
const indent
|
|
2
|
-
const templateIf = require('../utils/template-if');
|
|
3
|
-
|
|
4
|
-
module.exports = (options) => {
|
|
5
|
-
const { framework, type, webpack } = options;
|
|
6
|
-
|
|
7
|
-
let resolveExtensions = "['.js', '.json']";
|
|
8
|
-
if (framework === 'vue') {
|
|
9
|
-
resolveExtensions = "['.js', '.vue', '.json']";
|
|
10
|
-
}
|
|
11
|
-
if (framework === 'react') {
|
|
12
|
-
resolveExtensions = "['.js', '.jsx', '.json']";
|
|
13
|
-
}
|
|
14
|
-
if (framework === 'svelte') {
|
|
15
|
-
resolveExtensions = "['.mjs', '.js', '.svelte', '.json']";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const productionDevtool = webpack.productionSourceMap
|
|
19
|
-
? "'source-map'"
|
|
20
|
-
: false;
|
|
21
|
-
const developmentDevtool = webpack.developmentSourceMap ? "'eval'" : false;
|
|
22
|
-
const hashName = webpack.hashAssets ? '.[hash:6]' : '';
|
|
23
|
-
const assetsLoader = webpack.inlineAssets ? 'url-loader' : 'file-loader';
|
|
24
|
-
const preserveAssetsPaths = webpack.preserveAssetsPaths; // eslint-disable-line
|
|
25
|
-
|
|
26
|
-
return indent(
|
|
27
|
-
0,
|
|
28
|
-
`
|
|
1
|
+
"use strict";const e=require("../utils/indent"),t=require("../utils/template-if");module.exports=s=>{let{framework:r,type:o,webpack:n}=s,a="['.js', '.json']";"vue"===r&&(a="['.js', '.vue', '.json']"),"react"===r&&(a="['.js', '.jsx', '.json']"),"svelte"===r&&(a="['.mjs', '.js', '.svelte', '.json']");let i=!!n.productionSourceMap&&"'source-map'",l=!!n.developmentSourceMap&&"'eval'",u=n.hashAssets?".[hash:6]":"",p=n.inlineAssets?"url-loader":"file-loader",c=n.preserveAssetsPaths;return e(0,`
|
|
29
2
|
const webpack = require('webpack');
|
|
30
3
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
31
4
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
32
|
-
${
|
|
33
|
-
framework === 'vue',
|
|
34
|
-
() => `
|
|
5
|
+
${t("vue"===r,()=>`
|
|
35
6
|
const { VueLoaderPlugin } = require('vue-loader');
|
|
36
|
-
`
|
|
37
|
-
)
|
|
38
|
-
${templateIf(
|
|
39
|
-
framework === 'react',
|
|
40
|
-
() => `
|
|
7
|
+
`)}
|
|
8
|
+
${t("react"===r,()=>`
|
|
41
9
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
42
|
-
`
|
|
43
|
-
)}
|
|
10
|
+
`)}
|
|
44
11
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
45
12
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
46
13
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
47
|
-
${
|
|
48
|
-
type.indexOf('pwa') >= 0,
|
|
49
|
-
() => `
|
|
14
|
+
${t(o.indexOf("pwa")>=0,()=>`
|
|
50
15
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
|
51
|
-
`
|
|
52
|
-
)}
|
|
16
|
+
`)}
|
|
53
17
|
const path = require('path');
|
|
54
18
|
|
|
55
19
|
function resolvePath(dir) {
|
|
@@ -67,25 +31,22 @@ module.exports = (options) => {
|
|
|
67
31
|
},
|
|
68
32
|
output: {
|
|
69
33
|
path: resolvePath('www'),
|
|
70
|
-
filename: 'js/[name]${
|
|
71
|
-
chunkFilename: 'js/[name]${
|
|
34
|
+
filename: 'js/[name]${u}.js',
|
|
35
|
+
chunkFilename: 'js/[name]${u}.js',
|
|
72
36
|
publicPath: '',
|
|
73
37
|
hotUpdateChunkFilename: 'hot/hot-update.js',
|
|
74
38
|
hotUpdateMainFilename: 'hot/hot-update.json',
|
|
75
39
|
},
|
|
76
40
|
resolve: {
|
|
77
|
-
extensions: ${
|
|
41
|
+
extensions: ${a},
|
|
78
42
|
alias: {
|
|
79
43
|
'@': resolvePath('src'),
|
|
80
44
|
},
|
|
81
|
-
${
|
|
82
|
-
framework === 'svelte',
|
|
83
|
-
() => `
|
|
45
|
+
${t("svelte"===r,()=>`
|
|
84
46
|
mainFields: ['svelte', 'browser', 'module', 'main']
|
|
85
|
-
`
|
|
86
|
-
)}
|
|
47
|
+
`)}
|
|
87
48
|
},
|
|
88
|
-
devtool: env === 'production' ? ${
|
|
49
|
+
devtool: env === 'production' ? ${i} : ${l},
|
|
89
50
|
devServer: {
|
|
90
51
|
hot: true,
|
|
91
52
|
open: true,
|
|
@@ -104,32 +65,24 @@ module.exports = (options) => {
|
|
|
104
65
|
test: /\\.(mjs|js|jsx)$/,
|
|
105
66
|
include: [
|
|
106
67
|
resolvePath('src'),
|
|
107
|
-
${
|
|
108
|
-
framework === 'svelte',
|
|
109
|
-
() => `
|
|
68
|
+
${t("svelte"===r,()=>`
|
|
110
69
|
resolvePath('node_modules/svelte'),
|
|
111
|
-
`
|
|
112
|
-
)}
|
|
70
|
+
`)}
|
|
113
71
|
],
|
|
114
72
|
use: [
|
|
115
73
|
{
|
|
116
74
|
loader: require.resolve('babel-loader'),
|
|
117
|
-
${
|
|
118
|
-
framework === 'react',
|
|
119
|
-
() => `
|
|
75
|
+
${t("react"===r,()=>`
|
|
120
76
|
options: env === 'development' ? {
|
|
121
77
|
plugins: [
|
|
122
78
|
require.resolve('react-refresh/babel'),
|
|
123
79
|
]
|
|
124
80
|
} : {}
|
|
125
|
-
`
|
|
126
|
-
)}
|
|
81
|
+
`)}
|
|
127
82
|
},
|
|
128
83
|
]
|
|
129
84
|
},
|
|
130
|
-
${
|
|
131
|
-
framework === 'core',
|
|
132
|
-
() => `
|
|
85
|
+
${t("core"===r,()=>`
|
|
133
86
|
{
|
|
134
87
|
test: /\\.zmp.(html|js)$/,
|
|
135
88
|
use: [
|
|
@@ -137,11 +90,8 @@ module.exports = (options) => {
|
|
|
137
90
|
'zmp-loader',
|
|
138
91
|
],
|
|
139
92
|
},
|
|
140
|
-
`
|
|
141
|
-
)
|
|
142
|
-
${templateIf(
|
|
143
|
-
framework === 'svelte',
|
|
144
|
-
() => `
|
|
93
|
+
`)}
|
|
94
|
+
${t("svelte"===r,()=>`
|
|
145
95
|
{
|
|
146
96
|
test: /\\.svelte$/,
|
|
147
97
|
use: {
|
|
@@ -151,17 +101,13 @@ module.exports = (options) => {
|
|
|
151
101
|
},
|
|
152
102
|
},
|
|
153
103
|
},
|
|
154
|
-
`
|
|
155
|
-
)
|
|
156
|
-
${templateIf(
|
|
157
|
-
framework === 'vue',
|
|
158
|
-
() => `
|
|
104
|
+
`)}
|
|
105
|
+
${t("vue"===r,()=>`
|
|
159
106
|
{
|
|
160
107
|
test: /\\.vue$/,
|
|
161
108
|
use: 'vue-loader',
|
|
162
109
|
},
|
|
163
|
-
`
|
|
164
|
-
)}
|
|
110
|
+
`)}
|
|
165
111
|
{
|
|
166
112
|
test: /\\.css$/,
|
|
167
113
|
use: [
|
|
@@ -219,52 +165,37 @@ module.exports = (options) => {
|
|
|
219
165
|
},
|
|
220
166
|
{
|
|
221
167
|
test: /\\.(png|jpe?g|gif|svg)(\\?.*)?$/,
|
|
222
|
-
loader: '${
|
|
168
|
+
loader: '${p}',
|
|
223
169
|
options: {
|
|
224
170
|
limit: 10000,
|
|
225
|
-
name: '${
|
|
226
|
-
|
|
227
|
-
}[name]${hashName}.[ext]',
|
|
228
|
-
${templateIf(
|
|
229
|
-
preserveAssetsPaths,
|
|
230
|
-
() => `
|
|
171
|
+
name: '${c?"[path]":"images/"}[name]${u}.[ext]',
|
|
172
|
+
${t(c,()=>`
|
|
231
173
|
context: path.resolve(__dirname, '../src'),
|
|
232
|
-
`
|
|
233
|
-
)}
|
|
174
|
+
`)}
|
|
234
175
|
},
|
|
235
176
|
type: 'javascript/auto'
|
|
236
177
|
},
|
|
237
178
|
{
|
|
238
179
|
test: /\\.(mp4|webm|ogg|mp3|wav|flac|aac|m4a)(\\?.*)?$/,
|
|
239
|
-
loader: '${
|
|
180
|
+
loader: '${p}',
|
|
240
181
|
options: {
|
|
241
182
|
limit: 10000,
|
|
242
|
-
name: '${
|
|
243
|
-
|
|
244
|
-
}[name]${hashName}.[ext]',
|
|
245
|
-
${templateIf(
|
|
246
|
-
preserveAssetsPaths,
|
|
247
|
-
() => `
|
|
183
|
+
name: '${c?"[path]":"media/"}[name]${u}.[ext]',
|
|
184
|
+
${t(c,()=>`
|
|
248
185
|
context: path.resolve(__dirname, '../src'),
|
|
249
|
-
`
|
|
250
|
-
)}
|
|
186
|
+
`)}
|
|
251
187
|
},
|
|
252
188
|
type: 'javascript/auto'
|
|
253
189
|
},
|
|
254
190
|
{
|
|
255
191
|
test: /\\.(woff2?|eot|ttf|otf)(\\?.*)?$/,
|
|
256
|
-
loader: '${
|
|
192
|
+
loader: '${p}',
|
|
257
193
|
options: {
|
|
258
194
|
limit: 10000,
|
|
259
|
-
name: '${
|
|
260
|
-
|
|
261
|
-
}[name]${hashName}.[ext]',
|
|
262
|
-
${templateIf(
|
|
263
|
-
preserveAssetsPaths,
|
|
264
|
-
() => `
|
|
195
|
+
name: '${c?"[path]":"fonts/"}[name]${u}.[ext]',
|
|
196
|
+
${t(c,()=>`
|
|
265
197
|
context: path.resolve(__dirname, '../src'),
|
|
266
|
-
`
|
|
267
|
-
)}
|
|
198
|
+
`)}
|
|
268
199
|
},
|
|
269
200
|
type: 'javascript/auto'
|
|
270
201
|
},
|
|
@@ -275,21 +206,15 @@ module.exports = (options) => {
|
|
|
275
206
|
'process.env.NODE_ENV': JSON.stringify(env),
|
|
276
207
|
'process.env.TARGET': JSON.stringify(target),
|
|
277
208
|
}),
|
|
278
|
-
${
|
|
279
|
-
framework === 'vue',
|
|
280
|
-
() => `
|
|
209
|
+
${t("vue"===r,()=>`
|
|
281
210
|
new VueLoaderPlugin(),
|
|
282
|
-
`
|
|
283
|
-
)}
|
|
211
|
+
`)}
|
|
284
212
|
...(env === 'production' ? [
|
|
285
213
|
new CssMinimizerPlugin(),
|
|
286
214
|
] : [
|
|
287
215
|
// Development only plugins
|
|
288
216
|
new webpack.HotModuleReplacementPlugin(),
|
|
289
|
-
${
|
|
290
|
-
framework === 'react',
|
|
291
|
-
() => 'new ReactRefreshWebpackPlugin(),'
|
|
292
|
-
)}
|
|
217
|
+
${t("react"===r,()=>"new ReactRefreshWebpackPlugin(),")}
|
|
293
218
|
]),
|
|
294
219
|
new HtmlWebpackPlugin({
|
|
295
220
|
filename: './index.html',
|
|
@@ -298,16 +223,14 @@ module.exports = (options) => {
|
|
|
298
223
|
minify: env === 'production' ? {
|
|
299
224
|
collapseWhitespace: true,
|
|
300
225
|
removeComments: true,
|
|
301
|
-
removeRedundantAttributes: ${
|
|
302
|
-
framework === 'core' ? 'false' : 'true'
|
|
303
|
-
},
|
|
226
|
+
removeRedundantAttributes: ${"core"===r?"false":"true"},
|
|
304
227
|
removeScriptTypeAttributes: true,
|
|
305
228
|
removeStyleLinkTypeAttributes: true,
|
|
306
229
|
useShortDoctype: true
|
|
307
230
|
} : false,
|
|
308
231
|
}),
|
|
309
232
|
new MiniCssExtractPlugin({
|
|
310
|
-
filename: 'css/[name]${
|
|
233
|
+
filename: 'css/[name]${u}.css',
|
|
311
234
|
}),
|
|
312
235
|
new CopyWebpackPlugin({
|
|
313
236
|
patterns: [
|
|
@@ -316,20 +239,15 @@ module.exports = (options) => {
|
|
|
316
239
|
from: resolvePath('src/static'),
|
|
317
240
|
to: resolvePath('www/static'),
|
|
318
241
|
},
|
|
319
|
-
${
|
|
320
|
-
type.indexOf('pwa') >= 0,
|
|
321
|
-
() => `
|
|
242
|
+
${t(o.indexOf("pwa")>=0,()=>`
|
|
322
243
|
{
|
|
323
244
|
noErrorOnMissing: true,
|
|
324
245
|
from: resolvePath('src/manifest.json'),
|
|
325
246
|
to: resolvePath('www/manifest.json'),
|
|
326
247
|
},
|
|
327
|
-
`
|
|
328
|
-
)}
|
|
248
|
+
`)}
|
|
329
249
|
],
|
|
330
250
|
}),
|
|
331
251
|
],
|
|
332
252
|
};
|
|
333
|
-
`
|
|
334
|
-
).trim();
|
|
335
|
-
};
|
|
253
|
+
`).trim()};
|