@gct-paas/build 0.1.5-dev.9 → 0.1.6-dev.2
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/constants/index.cjs +12 -3
- package/dist/constants/index.d.ts +0 -4
- package/dist/eslint/eslint-config/eslint-config.cjs +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/vite/index.cjs +6 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/vite-config/vite-base-config.cjs +2 -24
- package/dist/vite/vite-config/vite-config.cjs +18 -18
- package/dist/vite/vite-config/vite-config.d.ts +1 -0
- package/dist/vite/vite-config/vite-dev-config.cjs +1 -2
- package/dist/vite/vite-config/vite-pkg-dev-config.cjs +4 -6
- package/dist/vite/vite-config/vite-project-config.cjs +7 -44
- package/dist/vite/vite-config/vite-project-config.d.ts +1 -2
- package/es/constants/index.d.ts +0 -4
- package/es/constants/index.mjs +26 -7
- package/es/eslint/eslint-config/eslint-config.mjs +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/vite/index.d.ts +1 -1
- package/es/vite/index.mjs +1 -1
- package/es/vite/vite-config/vite-base-config.mjs +0 -22
- package/es/vite/vite-config/vite-config.d.ts +1 -0
- package/es/vite/vite-config/vite-config.mjs +22 -18
- package/es/vite/vite-config/vite-dev-config.mjs +1 -2
- package/es/vite/vite-config/vite-pkg-dev-config.mjs +2 -5
- package/es/vite/vite-config/vite-project-config.d.ts +1 -2
- package/es/vite/vite-config/vite-project-config.mjs +8 -63
- package/package.json +18 -33
- package/dist/rollup/index.cjs +0 -35
- package/dist/rollup/index.d.ts +0 -3
- package/dist/rollup/rollup-config/build-config.cjs +0 -60
- package/dist/rollup/rollup-config/build-config.d.ts +0 -9
- package/dist/rollup/rollup-config/dev-config.cjs +0 -107
- package/dist/rollup/rollup-config/dev-config.d.ts +0 -9
- package/dist/rollup/rollup-plugins/copy-file.cjs +0 -24
- package/dist/rollup/rollup-plugins/copy-file.d.ts +0 -37
- package/dist/rollup/rollup-plugins/ignore-compiler-file.cjs +0 -23
- package/dist/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
- package/dist/rollup/rollup-plugins/index.cjs +0 -19
- package/dist/rollup/rollup-plugins/index.d.ts +0 -2
- package/dist/vite/gct-opts.interface.cjs +0 -1
- package/dist/vite/gct-opts.interface.d.ts +0 -18
- package/es/rollup/index.d.ts +0 -3
- package/es/rollup/index.mjs +0 -3
- package/es/rollup/rollup-config/build-config.d.ts +0 -9
- package/es/rollup/rollup-config/build-config.mjs +0 -67
- package/es/rollup/rollup-config/dev-config.d.ts +0 -9
- package/es/rollup/rollup-config/dev-config.mjs +0 -124
- package/es/rollup/rollup-plugins/copy-file.d.ts +0 -37
- package/es/rollup/rollup-plugins/copy-file.mjs +0 -18
- package/es/rollup/rollup-plugins/ignore-compiler-file.d.ts +0 -8
- package/es/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -17
- package/es/rollup/rollup-plugins/index.d.ts +0 -2
- package/es/rollup/rollup-plugins/index.mjs +0 -2
- package/es/vite/gct-opts.interface.d.ts +0 -18
- package/es/vite/gct-opts.interface.mjs +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "rollup";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
4
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
5
|
-
import json from "@rollup/plugin-json";
|
|
6
|
-
import esbuild from "rollup-plugin-esbuild";
|
|
7
|
-
import dts from "vite-plugin-dts";
|
|
8
|
-
import vue from "@vitejs/plugin-vue";
|
|
9
|
-
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
10
|
-
import * as rf from "rimraf";
|
|
11
|
-
import cpy from "cpy";
|
|
12
|
-
import fs from "fs-extra";
|
|
13
|
-
import os from "os";
|
|
14
|
-
import { copyFile, ignoreCompilerFile } from "../rollup-plugins/index.mjs";
|
|
15
|
-
import { DEFAULT_EXTERNAL, PROD_MODE } from "../../constants/index.mjs";
|
|
16
|
-
import { IS_NODE_MODULE, mergeConfig, winToUnixPath } from "../../util/index.mjs";
|
|
17
|
-
export function defineRollupConfig(opts = {}) {
|
|
18
|
-
process.on("SIGINT", () => {
|
|
19
|
-
process.exit();
|
|
20
|
-
});
|
|
21
|
-
const cwd = process.cwd();
|
|
22
|
-
const isProd = process.env.NODE_ENV === PROD_MODE;
|
|
23
|
-
const rootDir = path.resolve(cwd, "src");
|
|
24
|
-
const outDir = path.resolve(cwd, "es");
|
|
25
|
-
const assetsDir = path.resolve(cwd, "public");
|
|
26
|
-
const externalCompileFileReg = /\.(scss|css|less|d\.ts)+$/;
|
|
27
|
-
rf.sync(outDir);
|
|
28
|
-
if (isProd) {
|
|
29
|
-
const isWin = os.platform() === "win32";
|
|
30
|
-
if (isWin) {
|
|
31
|
-
if (fs.pathExistsSync(assetsDir)) {
|
|
32
|
-
cpy(winToUnixPath(assetsDir), winToUnixPath(outDir));
|
|
33
|
-
}
|
|
34
|
-
cpy(
|
|
35
|
-
winToUnixPath(path.resolve(cwd, "src/**/*.{scss,css,less,d.ts}")),
|
|
36
|
-
winToUnixPath(outDir)
|
|
37
|
-
);
|
|
38
|
-
} else {
|
|
39
|
-
if (fs.pathExistsSync(assetsDir)) {
|
|
40
|
-
cpy(assetsDir, outDir);
|
|
41
|
-
}
|
|
42
|
-
cpy(path.resolve(cwd, "src/**/*.{scss,css,less,d.ts}"), outDir);
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
copyFile([
|
|
46
|
-
{
|
|
47
|
-
from: assetsDir,
|
|
48
|
-
to: outDir
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
from: rootDir,
|
|
52
|
-
to: outDir,
|
|
53
|
-
opts: {
|
|
54
|
-
ignored: (file, stats) => {
|
|
55
|
-
if (stats && stats.isFile()) {
|
|
56
|
-
return !externalCompileFileReg.test(file);
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
const output = [
|
|
65
|
-
{
|
|
66
|
-
dir: outDir,
|
|
67
|
-
esModule: true,
|
|
68
|
-
format: "es",
|
|
69
|
-
sourcemap: false,
|
|
70
|
-
preserveModules: true,
|
|
71
|
-
preserveModulesRoot: rootDir,
|
|
72
|
-
exports: "named",
|
|
73
|
-
entryFileNames: "[name].mjs"
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
return mergeConfig(
|
|
77
|
-
defineConfig({
|
|
78
|
-
input: "src/index.ts",
|
|
79
|
-
treeshake: false,
|
|
80
|
-
external: (id) => {
|
|
81
|
-
if (IS_NODE_MODULE.test(id)) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
if (DEFAULT_EXTERNAL.includes(id)) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
},
|
|
89
|
-
output,
|
|
90
|
-
plugins: [
|
|
91
|
-
ignoreCompilerFile(externalCompileFileReg),
|
|
92
|
-
json(),
|
|
93
|
-
vue({
|
|
94
|
-
isProduction: isProd
|
|
95
|
-
}),
|
|
96
|
-
vueJsx({}),
|
|
97
|
-
nodeResolve({
|
|
98
|
-
extensions: [".cjs", ".mjs", ".js", ".ts"]
|
|
99
|
-
}),
|
|
100
|
-
commonjs(),
|
|
101
|
-
esbuild({
|
|
102
|
-
logLevel: "verbose",
|
|
103
|
-
sourceMap: false,
|
|
104
|
-
target: ["esnext"],
|
|
105
|
-
loaders: {
|
|
106
|
-
".vue": "ts"
|
|
107
|
-
}
|
|
108
|
-
}),
|
|
109
|
-
dts({
|
|
110
|
-
outDir: [outDir],
|
|
111
|
-
// 排除测试目录,以及测试文件
|
|
112
|
-
exclude: [
|
|
113
|
-
"**/test/**",
|
|
114
|
-
"**/*.test.ts",
|
|
115
|
-
"**/*.test.tsx",
|
|
116
|
-
"**/*.spec.ts",
|
|
117
|
-
"**/*.spec.tsx"
|
|
118
|
-
]
|
|
119
|
-
})
|
|
120
|
-
]
|
|
121
|
-
}),
|
|
122
|
-
opts
|
|
123
|
-
);
|
|
124
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as chokidar from 'chokidar';
|
|
2
|
-
/**
|
|
3
|
-
* 文件拷贝插件配置参数
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @interface CopyFilePluginOptions
|
|
7
|
-
*/
|
|
8
|
-
export interface CopyFilePluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* 源文件
|
|
11
|
-
*
|
|
12
|
-
* @type {string}
|
|
13
|
-
* @memberof CopyFilePluginOptions
|
|
14
|
-
*/
|
|
15
|
-
from: string;
|
|
16
|
-
/**
|
|
17
|
-
* 目标文件
|
|
18
|
-
*
|
|
19
|
-
* @type {string}
|
|
20
|
-
* @memberof CopyFilePluginOptions
|
|
21
|
-
*/
|
|
22
|
-
to: string;
|
|
23
|
-
/**
|
|
24
|
-
* chokidar watch 配置
|
|
25
|
-
*
|
|
26
|
-
* @type {chokidar.ChokidarOptions}
|
|
27
|
-
*/
|
|
28
|
-
opts?: chokidar.ChokidarOptions;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 文件拷贝插件,在开发模式下会监控文件变更,并自动拷贝文件
|
|
32
|
-
*
|
|
33
|
-
* @export
|
|
34
|
-
* @param {CopyFilePluginOptions[]} opts
|
|
35
|
-
* @return {*} {Plugin}
|
|
36
|
-
*/
|
|
37
|
-
export declare function copyFile(opts: CopyFilePluginOptions[]): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CopyWatch } from "../../util/index.mjs";
|
|
2
|
-
export function copyFile(opts) {
|
|
3
|
-
if (opts.length === 0) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
const arr = [];
|
|
7
|
-
opts.forEach((opt) => {
|
|
8
|
-
arr.push(new CopyWatch(opt.from, opt.to, opt.opts));
|
|
9
|
-
});
|
|
10
|
-
process.on("exit", () => {
|
|
11
|
-
if (!opts.length) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
arr.forEach((item) => {
|
|
15
|
-
item.unwatch();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function ignoreCompilerFile(extReg) {
|
|
2
|
-
return {
|
|
3
|
-
name: "gct:ignore-compiler-file",
|
|
4
|
-
resolveId(source) {
|
|
5
|
-
if (extReg.test(source)) {
|
|
6
|
-
return {
|
|
7
|
-
id: source,
|
|
8
|
-
external: true
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
},
|
|
13
|
-
load() {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|