Showing
6 changed files
with
139 additions
and
53 deletions
1 | 1 | #!/usr/bin/env node |
2 | - | |
2 | +const path = require('path') | |
3 | 3 | const execSync = require('child_process').execSync; |
4 | 4 | |
5 | -execSync(`npx cross-env NODE_ENV=development vite --force --config ./config/vite.config.js`, { stdio: 'inherit' }); | |
5 | +execSync(`npx cross-env NODE_ENV=development vite --force --config ${path.resolve( | |
6 | + __dirname, | |
7 | + "../config/vite.config.js" | |
8 | +)}`, { stdio: 'inherit' }); | |
9 | + | ... | ... |
config/lessVariable.js
0 → 100644
1 | +const lessVariable = `@qx-prefix: qx; | |
2 | +//品牌色 | |
3 | +@B1: ~'var(--@{qx-prefix}-brand-1)'; | |
4 | +@B2: ~'var(--@{qx-prefix}-brand-2)'; //背景 | |
5 | +@B3: ~'var(--@{qx-prefix}-brand-3)'; | |
6 | +@B4: ~'var(--@{qx-prefix}-brand-4)'; | |
7 | +@B5: ~'var(--@{qx-prefix}-brand-5)'; | |
8 | +@B6: ~'var(--@{qx-prefix}-brand-6)'; | |
9 | +@B7: ~'var(--@{qx-prefix}-brand-7)'; //hover | |
10 | +@B8: ~'var(--@{qx-prefix}-brand-8)'; //主题色 | |
11 | +@B9: ~'var(--@{qx-prefix}-brand-9)'; //active | |
12 | +@B10: ~'var(--@{qx-prefix}-brand-10)'; | |
13 | + | |
14 | +@body-bg: ~'var(--@{qx-prefix}-body-bg)'; | |
15 | + | |
16 | +//中性色 | |
17 | +@neutral-color: #242835; | |
18 | +@N1: overlay(rgba(255, 255, 255, 0.98), @neutral-color); //背景色 | |
19 | +@N2: overlay(rgba(255, 255, 255, 0.97), @neutral-color); //背景色 | |
20 | +@N3: overlay(rgba(255, 255, 255, 0.95), @neutral-color); //边框、线色 | |
21 | +@N4: overlay(rgba(255, 255, 255, 0.9), @neutral-color); //边框、线色 | |
22 | +@N5: overlay(rgba(255, 255, 255, 0.8), @neutral-color); //辅助,置灰信息 | |
23 | +@N6: overlay(rgba(255, 255, 255, 0.6), @neutral-color); //置灰信息 | |
24 | +@N7: overlay(rgba(255, 255, 255, 0.4), @neutral-color); //辅助信息 | |
25 | +@N8: overlay(rgba(255, 255, 255, 0.2), @neutral-color); //正文二级,次强调 | |
26 | +@N9: @neutral-color; //正文,强调 | |
27 | + | |
28 | +@success-color: #00a870; | |
29 | +@S1: overlay(rgba(255, 255, 255, 0.8), @success-color); | |
30 | +@S2: overlay(rgba(255, 255, 255, 0.2), @success-color); | |
31 | +@S3: @success-color; | |
32 | + | |
33 | +@E3: #e34d59; | |
34 | +@E2: overlay(rgba(255, 255, 255, 0.2), @E3); | |
35 | +@E1: overlay(rgba(255, 255, 255, 0.8), @E3); | |
36 | + | |
37 | +@W3: #ed7b2f; | |
38 | +@W2: overlay(rgba(255, 255, 255, 0.2), @W3); | |
39 | +@W1: overlay(rgba(255, 255, 255, 0.8), @W3);` | |
40 | + | |
41 | +module.exports = lessVariable | ... | ... |
... | ... | @@ -2,11 +2,12 @@ const { defineConfig } = require('vite'); |
2 | 2 | const process = require('process'); |
3 | 3 | import { viteExternalsPlugin } from 'vite-plugin-externals'; |
4 | 4 | const path = require('path'); |
5 | -const { cwd } = require('process'); | |
5 | +const lessVariable = require('./lessVariable') | |
6 | +const cwd = process.cwd() | |
6 | 7 | |
7 | 8 | module.exports = defineConfig({ |
8 | 9 | server: { |
9 | - proxy: path.resolve(cwd(), './proxy'), | |
10 | + proxy: path.resolve(cwd, './proxy'), | |
10 | 11 | }, |
11 | 12 | define: { |
12 | 13 | // By default, Vite doesn't include shims for NodeJS/ |
... | ... | @@ -26,16 +27,16 @@ module.exports = defineConfig({ |
26 | 27 | preprocessorOptions: { |
27 | 28 | less: { |
28 | 29 | javascriptEnabled: true, |
29 | - additionalData: `@import '@/styles/variable.less';`, | |
30 | + additionalData: `${lessVariable}`, | |
30 | 31 | }, |
31 | 32 | }, |
32 | 33 | }, |
33 | 34 | plugins: [ |
34 | 35 | new viteExternalsPlugin({ |
35 | - react: 'React', | |
36 | - 'react-dom': 'ReactDOM', | |
37 | - dayjs: 'dayjs', | |
38 | - antd: 'antd', | |
36 | + // react: 'React', | |
37 | + // 'react-dom': 'ReactDOM', | |
38 | + // dayjs: 'dayjs', | |
39 | + // antd: 'antd', | |
39 | 40 | }), |
40 | 41 | ], |
41 | 42 | }); | ... | ... |
... | ... | @@ -5,49 +5,10 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); |
5 | 5 | const WebpackBar = require("webpackbar"); |
6 | 6 | const MiniCssExtractPlugin = require("mini-css-extract-plugin"); |
7 | 7 | const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); |
8 | +const lessVariable = require('./lessVariable') | |
8 | 9 | |
9 | 10 | const cwd = process.cwd(); |
10 | 11 | |
11 | -const lessVariable = `@qx-prefix: qx; | |
12 | -//品牌色 | |
13 | -@B1: ~'var(--@{qx-prefix}-brand-1)'; | |
14 | -@B2: ~'var(--@{qx-prefix}-brand-2)'; //背景 | |
15 | -@B3: ~'var(--@{qx-prefix}-brand-3)'; | |
16 | -@B4: ~'var(--@{qx-prefix}-brand-4)'; | |
17 | -@B5: ~'var(--@{qx-prefix}-brand-5)'; | |
18 | -@B6: ~'var(--@{qx-prefix}-brand-6)'; | |
19 | -@B7: ~'var(--@{qx-prefix}-brand-7)'; //hover | |
20 | -@B8: ~'var(--@{qx-prefix}-brand-8)'; //主题色 | |
21 | -@B9: ~'var(--@{qx-prefix}-brand-9)'; //active | |
22 | -@B10: ~'var(--@{qx-prefix}-brand-10)'; | |
23 | - | |
24 | -@body-bg: ~'var(--@{qx-prefix}-body-bg)'; | |
25 | - | |
26 | -//中性色 | |
27 | -@neutral-color: #242835; | |
28 | -@N1: overlay(rgba(255, 255, 255, 0.98), @neutral-color); //背景色 | |
29 | -@N2: overlay(rgba(255, 255, 255, 0.97), @neutral-color); //背景色 | |
30 | -@N3: overlay(rgba(255, 255, 255, 0.95), @neutral-color); //边框、线色 | |
31 | -@N4: overlay(rgba(255, 255, 255, 0.9), @neutral-color); //边框、线色 | |
32 | -@N5: overlay(rgba(255, 255, 255, 0.8), @neutral-color); //辅助,置灰信息 | |
33 | -@N6: overlay(rgba(255, 255, 255, 0.6), @neutral-color); //置灰信息 | |
34 | -@N7: overlay(rgba(255, 255, 255, 0.4), @neutral-color); //辅助信息 | |
35 | -@N8: overlay(rgba(255, 255, 255, 0.2), @neutral-color); //正文二级,次强调 | |
36 | -@N9: @neutral-color; //正文,强调 | |
37 | - | |
38 | -@success-color: #00a870; | |
39 | -@S1: overlay(rgba(255, 255, 255, 0.8), @success-color); | |
40 | -@S2: overlay(rgba(255, 255, 255, 0.2), @success-color); | |
41 | -@S3: @success-color; | |
42 | - | |
43 | -@E3: #e34d59; | |
44 | -@E2: overlay(rgba(255, 255, 255, 0.2), @E3); | |
45 | -@E1: overlay(rgba(255, 255, 255, 0.8), @E3); | |
46 | - | |
47 | -@W3: #ed7b2f; | |
48 | -@W2: overlay(rgba(255, 255, 255, 0.2), @W3); | |
49 | -@W1: overlay(rgba(255, 255, 255, 0.8), @W3);` | |
50 | - | |
51 | 12 | module.exports = { |
52 | 13 | output: { |
53 | 14 | filename: './js/[name]-[contenthash].js', | ... | ... |
1 | 1 | { |
2 | 2 | "name": "@qx/cli", |
3 | - "version": "3.0.0-alpha.19", | |
3 | + "version": "3.0.0-alpha.24", | |
4 | 4 | "lockfileVersion": 3, |
5 | 5 | "requires": true, |
6 | 6 | "packages": { |
7 | 7 | "": { |
8 | 8 | "name": "@qx/cli", |
9 | - "version": "3.0.0-alpha.19", | |
9 | + "version": "3.0.0-alpha.24", | |
10 | 10 | "license": "ISC", |
11 | 11 | "dependencies": { |
12 | 12 | "@babel/preset-env": "^7.23.3", |
... | ... | @@ -38,6 +38,9 @@ |
38 | 38 | }, |
39 | 39 | "bin": { |
40 | 40 | "qx-cli": "bin/index.js" |
41 | + }, | |
42 | + "devDependencies": { | |
43 | + "vite-plugin-externals": "^0.6.2" | |
41 | 44 | } |
42 | 45 | }, |
43 | 46 | "node_modules/@ampproject/remapping": { |
... | ... | @@ -3704,6 +3707,12 @@ |
3704 | 3707 | "errno": "cli.js" |
3705 | 3708 | } |
3706 | 3709 | }, |
3710 | + "node_modules/es-module-lexer": { | |
3711 | + "version": "0.4.1", | |
3712 | + "resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-0.4.1.tgz", | |
3713 | + "integrity": "sha512-ooYciCUtfw6/d2w56UVeqHPcoCFAiJdz5XOkYpv/Txl1HMUozpXjz/2RIQgqwKdXNDPSF1W7mJCFse3G+HDyAA==", | |
3714 | + "dev": true | |
3715 | + }, | |
3707 | 3716 | "node_modules/esbuild": { |
3708 | 3717 | "version": "0.18.20", |
3709 | 3718 | "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.18.20.tgz", |
... | ... | @@ -4061,6 +4070,20 @@ |
4061 | 4070 | "is-callable": "^1.1.3" |
4062 | 4071 | } |
4063 | 4072 | }, |
4073 | + "node_modules/fs-extra": { | |
4074 | + "version": "10.1.0", | |
4075 | + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-10.1.0.tgz", | |
4076 | + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", | |
4077 | + "dev": true, | |
4078 | + "dependencies": { | |
4079 | + "graceful-fs": "^4.2.0", | |
4080 | + "jsonfile": "^6.0.1", | |
4081 | + "universalify": "^2.0.0" | |
4082 | + }, | |
4083 | + "engines": { | |
4084 | + "node": ">=12" | |
4085 | + } | |
4086 | + }, | |
4064 | 4087 | "node_modules/fsevents": { |
4065 | 4088 | "version": "2.3.3", |
4066 | 4089 | "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", |
... | ... | @@ -4662,6 +4685,18 @@ |
4662 | 4685 | "node": ">=6" |
4663 | 4686 | } |
4664 | 4687 | }, |
4688 | + "node_modules/jsonfile": { | |
4689 | + "version": "6.1.0", | |
4690 | + "resolved": "https://registry.npmmirror.com/jsonfile/-/jsonfile-6.1.0.tgz", | |
4691 | + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", | |
4692 | + "dev": true, | |
4693 | + "dependencies": { | |
4694 | + "universalify": "^2.0.0" | |
4695 | + }, | |
4696 | + "optionalDependencies": { | |
4697 | + "graceful-fs": "^4.1.6" | |
4698 | + } | |
4699 | + }, | |
4665 | 4700 | "node_modules/kind-of": { |
4666 | 4701 | "version": "6.0.3", |
4667 | 4702 | "resolved": "https://registry.npmmirror.com/kind-of/-/kind-of-6.0.3.tgz", |
... | ... | @@ -4795,6 +4830,15 @@ |
4795 | 4830 | "yallist": "^3.0.2" |
4796 | 4831 | } |
4797 | 4832 | }, |
4833 | + "node_modules/magic-string": { | |
4834 | + "version": "0.25.9", | |
4835 | + "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz", | |
4836 | + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", | |
4837 | + "dev": true, | |
4838 | + "dependencies": { | |
4839 | + "sourcemap-codec": "^1.4.8" | |
4840 | + } | |
4841 | + }, | |
4798 | 4842 | "node_modules/make-dir": { |
4799 | 4843 | "version": "2.1.0", |
4800 | 4844 | "resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-2.1.0.tgz", |
... | ... | @@ -6366,6 +6410,13 @@ |
6366 | 6410 | "source-map": "^0.6.0" |
6367 | 6411 | } |
6368 | 6412 | }, |
6413 | + "node_modules/sourcemap-codec": { | |
6414 | + "version": "1.4.8", | |
6415 | + "resolved": "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", | |
6416 | + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", | |
6417 | + "deprecated": "Please use @jridgewell/sourcemap-codec instead", | |
6418 | + "dev": true | |
6419 | + }, | |
6369 | 6420 | "node_modules/std-env": { |
6370 | 6421 | "version": "3.4.3", |
6371 | 6422 | "resolved": "https://registry.npmmirror.com/std-env/-/std-env-3.4.3.tgz", |
... | ... | @@ -6750,6 +6801,15 @@ |
6750 | 6801 | "node": ">=4" |
6751 | 6802 | } |
6752 | 6803 | }, |
6804 | + "node_modules/universalify": { | |
6805 | + "version": "2.0.1", | |
6806 | + "resolved": "https://registry.npmmirror.com/universalify/-/universalify-2.0.1.tgz", | |
6807 | + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", | |
6808 | + "dev": true, | |
6809 | + "engines": { | |
6810 | + "node": ">= 10.0.0" | |
6811 | + } | |
6812 | + }, | |
6753 | 6813 | "node_modules/update-browserslist-db": { |
6754 | 6814 | "version": "1.0.13", |
6755 | 6815 | "resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", |
... | ... | @@ -6910,6 +6970,24 @@ |
6910 | 6970 | } |
6911 | 6971 | } |
6912 | 6972 | }, |
6973 | + "node_modules/vite-plugin-externals": { | |
6974 | + "version": "0.6.2", | |
6975 | + "resolved": "https://registry.npmmirror.com/vite-plugin-externals/-/vite-plugin-externals-0.6.2.tgz", | |
6976 | + "integrity": "sha512-R5oVY8xDJjLXLTs2XDYzvYbc/RTZuIwOx2xcFbYf+/VXB6eJuatDgt8jzQ7kZ+IrgwQhe6tU8U2fTyy72C25CQ==", | |
6977 | + "dev": true, | |
6978 | + "dependencies": { | |
6979 | + "acorn": "^8.4.0", | |
6980 | + "es-module-lexer": "^0.4.1", | |
6981 | + "fs-extra": "^10.0.0", | |
6982 | + "magic-string": "^0.25.7" | |
6983 | + }, | |
6984 | + "engines": { | |
6985 | + "node": "^14.18.0 || >=16.0.0" | |
6986 | + }, | |
6987 | + "peerDependencies": { | |
6988 | + "vite": ">=2.0.0" | |
6989 | + } | |
6990 | + }, | |
6913 | 6991 | "node_modules/vm-browserify": { |
6914 | 6992 | "version": "1.1.2", |
6915 | 6993 | "resolved": "https://registry.npmmirror.com/vm-browserify/-/vm-browserify-1.1.2.tgz", | ... | ... |
... | ... | @@ -35,10 +35,11 @@ |
35 | 35 | "style-loader": "^3.3.3", |
36 | 36 | "thread-loader": "^4.0.2", |
37 | 37 | "url-loader": "^4.1.1", |
38 | - "vite": "^4.5.0", | |
38 | + "vite": "^4.4.9", | |
39 | 39 | "webpack": "^5.89.0", |
40 | 40 | "webpack-cli": "^5.1.4", |
41 | 41 | "webpack-merge": "^5.10.0", |
42 | - "webpackbar": "^5.0.2" | |
42 | + "webpackbar": "^5.0.2", | |
43 | + "vite-plugin-externals": "^0.6.2" | |
43 | 44 | } |
44 | 45 | } | ... | ... |