@gct-paas/build 0.1.4-dev.4 → 0.1.4-dev.5
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/dist/vite/gct-opts.interface.cjs +1 -0
- package/dist/vite/gct-opts.interface.d.ts +18 -0
- package/dist/vite/index.cjs +8 -1
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/vite-config/vite-project-config.cjs +94 -0
- package/dist/vite/vite-config/vite-project-config.d.ts +13 -0
- package/es/vite/gct-opts.interface.d.ts +18 -0
- package/es/vite/gct-opts.interface.mjs +0 -0
- package/es/vite/index.d.ts +1 -0
- package/es/vite/index.mjs +1 -0
- package/es/vite/vite-config/vite-project-config.d.ts +13 -0
- package/es/vite/vite-config/vite-project-config.mjs +109 -0
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 项目自定义配置接口
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2025-08-24 11:08:43
|
|
6
|
+
* @export
|
|
7
|
+
* @interface GctOpts
|
|
8
|
+
*/
|
|
9
|
+
export interface GctOpts {
|
|
10
|
+
/**
|
|
11
|
+
* HTTP 代理配置,根据分支前缀匹配
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2025-08-24 11:08:56
|
|
15
|
+
* @type {Record<string, string>}
|
|
16
|
+
*/
|
|
17
|
+
httpProxyConfig: Record<string, string>;
|
|
18
|
+
}
|
package/dist/vite/index.cjs
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "defineMobilePluginViteConfig", {
|
|
|
21
21
|
return _vitePluginConfig.defineMobilePluginViteConfig;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "defineProjectViteConfig", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _viteProjectConfig.defineProjectViteConfig;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "defineViteBaseConfig", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -42,4 +48,5 @@ Object.defineProperty(exports, "defineWebPluginViteConfig", {
|
|
|
42
48
|
var _viteBaseConfig = require("./vite-config/vite-base-config.cjs");
|
|
43
49
|
var _viteConfig = require("./vite-config/vite-config.cjs");
|
|
44
50
|
var _viteDevConfig = require("./vite-config/vite-dev-config.cjs");
|
|
45
|
-
var _vitePluginConfig = require("./vite-config/vite-plugin-config.cjs");
|
|
51
|
+
var _vitePluginConfig = require("./vite-config/vite-plugin-config.cjs");
|
|
52
|
+
var _viteProjectConfig = require("./vite-config/vite-project-config.cjs");
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
|
2
2
|
export { defineViteConfig } from './vite-config/vite-config';
|
|
3
3
|
export { defineDevViteConfig } from './vite-config/vite-dev-config';
|
|
4
4
|
export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defineProjectViteConfig = defineProjectViteConfig;
|
|
7
|
+
var _vite = require("vite");
|
|
8
|
+
var _pluginVue = _interopRequireDefault(require("@vitejs/plugin-vue"));
|
|
9
|
+
var _pluginVueJsx = _interopRequireDefault(require("@vitejs/plugin-vue-jsx"));
|
|
10
|
+
var _pluginLegacy = _interopRequireDefault(require("@vitejs/plugin-legacy"));
|
|
11
|
+
var _pluginJson = _interopRequireDefault(require("@rollup/plugin-json"));
|
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
|
13
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
14
|
+
var _simpleGit = require("simple-git");
|
|
15
|
+
var _util = require("../../util/index.cjs");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const gctOptsDefault = {
|
|
18
|
+
httpProxyConfig: {
|
|
19
|
+
alpha: "http://paas.alpha.gct-paas.com",
|
|
20
|
+
beta: "http://paas.beta.gct-paas.com",
|
|
21
|
+
"paas-ai-dev": "http://paas.aidev.gct-paas.com",
|
|
22
|
+
"paas-dev": "http://paas.paasdev.gct-paas.com",
|
|
23
|
+
"paas-test": "http://paas.paastest.gct-paas.com",
|
|
24
|
+
"mom-dev": "http://paas.momdev.gct-paas.com",
|
|
25
|
+
"mom-test": "http://paas.momtest.gct-paas.com",
|
|
26
|
+
"ncdp-dev": "http://paas.ncdpdev.gct-paas.com",
|
|
27
|
+
"ncdp-test": "http://paas.ncdptest.gct-paas.com",
|
|
28
|
+
"ipaas-dev": "http://paas.ipaasdev.gct-paas.com",
|
|
29
|
+
"ipaas-test": "http://paas.ipaastest.gct-paas.com",
|
|
30
|
+
"edhr-dev": "http://paas.edhrdev.gct-paas.com",
|
|
31
|
+
"edhr-test": "http://paas.edhrtest.gct-paas.com",
|
|
32
|
+
"datav-dev": "http://paas.datavdev.gct-paas.com"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
36
|
+
const _gctOpts = (0, _util.mergeConfig)(gctOptsDefault, gctOpts);
|
|
37
|
+
return (0, _vite.defineConfig)(async () => {
|
|
38
|
+
const cwd = process.cwd();
|
|
39
|
+
const pkg = _fsExtra.default.readJsonSync(_path.default.resolve(cwd, "package.json"));
|
|
40
|
+
const git = (0, _simpleGit.simpleGit)({
|
|
41
|
+
baseDir: cwd
|
|
42
|
+
});
|
|
43
|
+
const branchSummary = await git.branch();
|
|
44
|
+
const httpProxyKey = Object.keys(_gctOpts.httpProxyConfig).find(key => {
|
|
45
|
+
return key.startsWith(branchSummary.current);
|
|
46
|
+
}) || "paas-dev";
|
|
47
|
+
const httpProxy = _gctOpts.httpProxyConfig[httpProxyKey];
|
|
48
|
+
return (0, _util.mergeConfig)({
|
|
49
|
+
resolve: {
|
|
50
|
+
alias: {
|
|
51
|
+
"@": _path.default.resolve(cwd, "src")
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
build: {
|
|
55
|
+
rollupOptions: {
|
|
56
|
+
external: ["core-js", "vue", "vue-i18n", "vue-router", "ant-design-vue", "pinia", "systemjs", "@gct-paas/core", "@gct-paas/core-web", "@gct-paas/api"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
css: {
|
|
60
|
+
preprocessorOptions: {
|
|
61
|
+
scss: {
|
|
62
|
+
additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
server: {
|
|
67
|
+
host: "0.0.0.0",
|
|
68
|
+
cors: true,
|
|
69
|
+
fs: {
|
|
70
|
+
strict: false
|
|
71
|
+
},
|
|
72
|
+
proxy: {
|
|
73
|
+
hostname: "0.0.0.0",
|
|
74
|
+
...["/gct-platform", "/gct-apaas", "/gct-ipaas", "/minio"].reduce((acc, item) => {
|
|
75
|
+
acc[item] = httpProxy;
|
|
76
|
+
return acc;
|
|
77
|
+
}, {})
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
define: {
|
|
81
|
+
"import.meta.env.pkg": {
|
|
82
|
+
name: pkg.name,
|
|
83
|
+
version: pkg.version
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
plugins: [(0, _pluginJson.default)(), (0, _pluginVue.default)(), (0, _pluginVueJsx.default)(), (0, _pluginLegacy.default)({
|
|
87
|
+
targets: ["chrome>=85", "edge>=85", "firefox>=79", "safari>=14.1"],
|
|
88
|
+
externalSystemJS: true,
|
|
89
|
+
// 关键配置:只生成 legacy 版本
|
|
90
|
+
renderModernChunks: false
|
|
91
|
+
})]
|
|
92
|
+
}, opts);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserConfig, UserConfigFnPromise } from 'vite';
|
|
2
|
+
import { GctOpts } from '../gct-opts.interface';
|
|
3
|
+
/**
|
|
4
|
+
* 构建本地开发 project 项目 vite 通用配置,基于此配置构建其他 vite 配置
|
|
5
|
+
* 参数合并时,数组会被合并而不是被替换
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2025-08-24 11:08:04
|
|
9
|
+
* @export
|
|
10
|
+
* @param {UserConfig} [opts={}]
|
|
11
|
+
* @returns {*} {Promise<UserConfig>}
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineProjectViteConfig(gctOpts?: Partial<GctOpts>, opts?: UserConfig): UserConfigFnPromise;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 项目自定义配置接口
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2025-08-24 11:08:43
|
|
6
|
+
* @export
|
|
7
|
+
* @interface GctOpts
|
|
8
|
+
*/
|
|
9
|
+
export interface GctOpts {
|
|
10
|
+
/**
|
|
11
|
+
* HTTP 代理配置,根据分支前缀匹配
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2025-08-24 11:08:56
|
|
15
|
+
* @type {Record<string, string>}
|
|
16
|
+
*/
|
|
17
|
+
httpProxyConfig: Record<string, string>;
|
|
18
|
+
}
|
|
File without changes
|
package/es/vite/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
|
2
2
|
export { defineViteConfig } from './vite-config/vite-config';
|
|
3
3
|
export { defineDevViteConfig } from './vite-config/vite-dev-config';
|
|
4
4
|
export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
5
|
+
export { defineProjectViteConfig } from './vite-config/vite-project-config';
|
package/es/vite/index.mjs
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserConfig, UserConfigFnPromise } from 'vite';
|
|
2
|
+
import { GctOpts } from '../gct-opts.interface';
|
|
3
|
+
/**
|
|
4
|
+
* 构建本地开发 project 项目 vite 通用配置,基于此配置构建其他 vite 配置
|
|
5
|
+
* 参数合并时,数组会被合并而不是被替换
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2025-08-24 11:08:04
|
|
9
|
+
* @export
|
|
10
|
+
* @param {UserConfig} [opts={}]
|
|
11
|
+
* @returns {*} {Promise<UserConfig>}
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineProjectViteConfig(gctOpts?: Partial<GctOpts>, opts?: UserConfig): UserConfigFnPromise;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineConfig
|
|
3
|
+
} from "vite";
|
|
4
|
+
import vue from "@vitejs/plugin-vue";
|
|
5
|
+
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
6
|
+
import legacy from "@vitejs/plugin-legacy";
|
|
7
|
+
import json from "@rollup/plugin-json";
|
|
8
|
+
import path from "path";
|
|
9
|
+
import fse from "fs-extra";
|
|
10
|
+
import { simpleGit } from "simple-git";
|
|
11
|
+
import { mergeConfig } from "../../util/index.mjs";
|
|
12
|
+
const gctOptsDefault = {
|
|
13
|
+
httpProxyConfig: {
|
|
14
|
+
alpha: "http://paas.alpha.gct-paas.com",
|
|
15
|
+
beta: "http://paas.beta.gct-paas.com",
|
|
16
|
+
"paas-ai-dev": "http://paas.aidev.gct-paas.com",
|
|
17
|
+
"paas-dev": "http://paas.paasdev.gct-paas.com",
|
|
18
|
+
"paas-test": "http://paas.paastest.gct-paas.com",
|
|
19
|
+
"mom-dev": "http://paas.momdev.gct-paas.com",
|
|
20
|
+
"mom-test": "http://paas.momtest.gct-paas.com",
|
|
21
|
+
"ncdp-dev": "http://paas.ncdpdev.gct-paas.com",
|
|
22
|
+
"ncdp-test": "http://paas.ncdptest.gct-paas.com",
|
|
23
|
+
"ipaas-dev": "http://paas.ipaasdev.gct-paas.com",
|
|
24
|
+
"ipaas-test": "http://paas.ipaastest.gct-paas.com",
|
|
25
|
+
"edhr-dev": "http://paas.edhrdev.gct-paas.com",
|
|
26
|
+
"edhr-test": "http://paas.edhrtest.gct-paas.com",
|
|
27
|
+
"datav-dev": "http://paas.datavdev.gct-paas.com"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export function defineProjectViteConfig(gctOpts = {}, opts = {}) {
|
|
31
|
+
const _gctOpts = mergeConfig(gctOptsDefault, gctOpts);
|
|
32
|
+
return defineConfig(async () => {
|
|
33
|
+
const cwd = process.cwd();
|
|
34
|
+
const pkg = fse.readJsonSync(path.resolve(cwd, "package.json"));
|
|
35
|
+
const git = simpleGit({ baseDir: cwd });
|
|
36
|
+
const branchSummary = await git.branch();
|
|
37
|
+
const httpProxyKey = Object.keys(_gctOpts.httpProxyConfig).find((key) => {
|
|
38
|
+
return key.startsWith(branchSummary.current);
|
|
39
|
+
}) || "paas-dev";
|
|
40
|
+
const httpProxy = _gctOpts.httpProxyConfig[httpProxyKey];
|
|
41
|
+
return mergeConfig(
|
|
42
|
+
{
|
|
43
|
+
resolve: {
|
|
44
|
+
alias: {
|
|
45
|
+
"@": path.resolve(cwd, "src")
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
build: {
|
|
49
|
+
rollupOptions: {
|
|
50
|
+
external: [
|
|
51
|
+
"core-js",
|
|
52
|
+
"vue",
|
|
53
|
+
"vue-i18n",
|
|
54
|
+
"vue-router",
|
|
55
|
+
"ant-design-vue",
|
|
56
|
+
"pinia",
|
|
57
|
+
"systemjs",
|
|
58
|
+
"@gct-paas/core",
|
|
59
|
+
"@gct-paas/core-web",
|
|
60
|
+
"@gct-paas/api"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
css: {
|
|
65
|
+
preprocessorOptions: {
|
|
66
|
+
scss: {
|
|
67
|
+
additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
server: {
|
|
72
|
+
host: "0.0.0.0",
|
|
73
|
+
cors: true,
|
|
74
|
+
fs: {
|
|
75
|
+
strict: false
|
|
76
|
+
},
|
|
77
|
+
proxy: {
|
|
78
|
+
hostname: "0.0.0.0",
|
|
79
|
+
...["/gct-platform", "/gct-apaas", "/gct-ipaas", "/minio"].reduce(
|
|
80
|
+
(acc, item) => {
|
|
81
|
+
acc[item] = httpProxy;
|
|
82
|
+
return acc;
|
|
83
|
+
},
|
|
84
|
+
{}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
define: {
|
|
89
|
+
"import.meta.env.pkg": {
|
|
90
|
+
name: pkg.name,
|
|
91
|
+
version: pkg.version
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
plugins: [
|
|
95
|
+
json(),
|
|
96
|
+
vue(),
|
|
97
|
+
vueJsx(),
|
|
98
|
+
legacy({
|
|
99
|
+
targets: ["chrome>=85", "edge>=85", "firefox>=79", "safari>=14.1"],
|
|
100
|
+
externalSystemJS: true,
|
|
101
|
+
// 关键配置:只生成 legacy 版本
|
|
102
|
+
renderModernChunks: false
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
opts
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/build",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@commitlint/cli": "^19.8.1",
|
|
45
45
|
"@commitlint/config-conventional": "^19.8.1",
|
|
46
46
|
"@eslint/js": "^9.33.0",
|
|
47
|
-
"@gct-paas/scss": "^0.1.4-dev.
|
|
47
|
+
"@gct-paas/scss": "^0.1.4-dev.5",
|
|
48
48
|
"@inquirer/prompts": "^7.8.3",
|
|
49
49
|
"@rollup/plugin-babel": "^6.0.4",
|
|
50
50
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@rollup/plugin-json": "^6.1.0",
|
|
53
53
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
54
54
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
55
|
+
"@vitejs/plugin-legacy": "^7.2.1",
|
|
55
56
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
56
57
|
"@vitejs/plugin-vue-jsx": "^5.0.1",
|
|
57
58
|
"@vue/compiler-sfc": "^3.5.18",
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
"rimraf": "^6.0.1",
|
|
80
81
|
"rollup": "^4.46.4",
|
|
81
82
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
83
|
+
"simple-git": "^3.28.0",
|
|
82
84
|
"stylelint": "^16.23.1",
|
|
83
85
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
84
86
|
"typescript-eslint": "^8.40.0",
|
|
@@ -98,5 +100,5 @@
|
|
|
98
100
|
"typescript": "^5.9.2",
|
|
99
101
|
"unbuild": "^3.6.1"
|
|
100
102
|
},
|
|
101
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "6fd4f6f4c3a0e1bd1fc4eea78fa9c2760e2219be"
|
|
102
104
|
}
|