@seayoo-web/scripts 1.3.4 → 1.3.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/index.js +43 -47
- package/package.json +2 -3
- package/types/index.d.ts +1 -3
- package/types/src/vite.app.d.ts +1 -1
- package/types/src/vite.d.ts +4 -0
- package/types/src/vite.lab.d.ts +2 -1
- package/types/src/vite.page.d.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import vue from "@vitejs/plugin-vue";
|
|
3
3
|
import { viteDeployPlugin } from "@seayoo-web/finder";
|
|
4
4
|
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
|
5
5
|
import legacy from "@vitejs/plugin-legacy";
|
|
6
|
-
import vue from "@vitejs/plugin-vue";
|
|
7
6
|
import vueDevTools from "vite-plugin-vue-devtools";
|
|
8
7
|
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { loadEnv } from "vite";
|
|
9
9
|
import "colors";
|
|
10
10
|
import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-C3gyPvsT.js";
|
|
11
11
|
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
|
|
12
12
|
import { vueTsConfigs, defineConfigWithVueTs } from "@vue/eslint-config-typescript";
|
|
13
13
|
import { flatConfigs } from "eslint-plugin-import";
|
|
14
14
|
import pluginVue from "eslint-plugin-vue";
|
|
15
|
+
function defineAppBuildConfig(option) {
|
|
16
|
+
const { plugins = [], build = {}, resolve = {}, ...optionReset } = option || {};
|
|
17
|
+
const { alias, ...resolveReset } = resolve || {};
|
|
18
|
+
return {
|
|
19
|
+
base: "./",
|
|
20
|
+
build: {
|
|
21
|
+
emptyOutDir: true,
|
|
22
|
+
outDir: join(process.cwd(), "./dist"),
|
|
23
|
+
assetsDir: "assets",
|
|
24
|
+
reportCompressedSize: false,
|
|
25
|
+
sourcemap: false,
|
|
26
|
+
...build
|
|
27
|
+
},
|
|
28
|
+
plugins: [vue(), ...plugins],
|
|
29
|
+
resolve: {
|
|
30
|
+
alias: {
|
|
31
|
+
"@": join(process.cwd(), "./src"),
|
|
32
|
+
...alias
|
|
33
|
+
},
|
|
34
|
+
extensions: [".mts", ".mjs", ".ts", ".js"],
|
|
35
|
+
...resolveReset
|
|
36
|
+
},
|
|
37
|
+
...optionReset
|
|
38
|
+
};
|
|
39
|
+
}
|
|
15
40
|
function defineLibBuildConfig(option) {
|
|
16
|
-
return
|
|
41
|
+
return {
|
|
17
42
|
build: {
|
|
18
43
|
outDir: (option == null ? void 0 : option.outDir) || "dist",
|
|
19
44
|
lib: {
|
|
@@ -27,7 +52,7 @@ function defineLibBuildConfig(option) {
|
|
|
27
52
|
external: (option == null ? void 0 : option.external) || [/^@seayoo-web\/(?:request|utils|combo-webview)/]
|
|
28
53
|
}
|
|
29
54
|
}
|
|
30
|
-
}
|
|
55
|
+
};
|
|
31
56
|
}
|
|
32
57
|
const EnvPrefix = "SY_";
|
|
33
58
|
function getBuildEnv(command, mode) {
|
|
@@ -102,21 +127,20 @@ function htmlInjectPlugin(data) {
|
|
|
102
127
|
};
|
|
103
128
|
}
|
|
104
129
|
function definePageBuildConfig(option) {
|
|
105
|
-
|
|
106
|
-
|
|
130
|
+
const {
|
|
131
|
+
plugins = [],
|
|
132
|
+
define = {},
|
|
133
|
+
build = {},
|
|
134
|
+
resolve = {},
|
|
135
|
+
server = {},
|
|
136
|
+
sentry = {},
|
|
137
|
+
...optionReset
|
|
138
|
+
} = option || {};
|
|
139
|
+
const { alias, ...resolveReset } = resolve;
|
|
140
|
+
return async function({ command, mode }) {
|
|
107
141
|
const envs = getBuildEnv(command, mode);
|
|
108
142
|
const gitInfo = await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
|
|
109
143
|
const isProductMode = mode === "production" || mode === "prod";
|
|
110
|
-
const {
|
|
111
|
-
plugins = [],
|
|
112
|
-
define = {},
|
|
113
|
-
build = {},
|
|
114
|
-
resolve = {},
|
|
115
|
-
server = {},
|
|
116
|
-
sentry = {},
|
|
117
|
-
...optionReset
|
|
118
|
-
} = option || {};
|
|
119
|
-
const { alias, ...resolveReset } = resolve || {};
|
|
120
144
|
return {
|
|
121
145
|
base: "./",
|
|
122
146
|
build: {
|
|
@@ -132,8 +156,7 @@ function definePageBuildConfig(option) {
|
|
|
132
156
|
vueDevTools(),
|
|
133
157
|
legacy({
|
|
134
158
|
targets: [
|
|
135
|
-
"
|
|
136
|
-
"> 0.2%",
|
|
159
|
+
"> 0.1%",
|
|
137
160
|
"last 5 versions and not dead",
|
|
138
161
|
"Firefox ESR",
|
|
139
162
|
"edge>=60",
|
|
@@ -148,7 +171,7 @@ function definePageBuildConfig(option) {
|
|
|
148
171
|
// https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/src/index.ts#L170
|
|
149
172
|
// https://unpkg.com/browse/core-js@3.41.0/
|
|
150
173
|
additionalLegacyPolyfills: [
|
|
151
|
-
"regenerator-runtime/runtime
|
|
174
|
+
"regenerator-runtime/runtime",
|
|
152
175
|
"core-js/es/array/flat",
|
|
153
176
|
"core-js/es/global-this",
|
|
154
177
|
"core-js/es/promise",
|
|
@@ -205,34 +228,7 @@ function definePageBuildConfig(option) {
|
|
|
205
228
|
// envPrefix 不允许覆盖
|
|
206
229
|
envPrefix: EnvPrefix
|
|
207
230
|
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
function defineAppBuildConfig(option) {
|
|
211
|
-
return defineConfig(function() {
|
|
212
|
-
const { plugins = [], build = {}, resolve = {}, ...optionReset } = option || {};
|
|
213
|
-
const { alias, ...resolveReset } = resolve || {};
|
|
214
|
-
return {
|
|
215
|
-
base: "./",
|
|
216
|
-
build: {
|
|
217
|
-
emptyOutDir: true,
|
|
218
|
-
outDir: join(process.cwd(), "./dist"),
|
|
219
|
-
assetsDir: "assets",
|
|
220
|
-
reportCompressedSize: false,
|
|
221
|
-
sourcemap: false,
|
|
222
|
-
...build
|
|
223
|
-
},
|
|
224
|
-
plugins: [vue(), ...plugins],
|
|
225
|
-
resolve: {
|
|
226
|
-
alias: {
|
|
227
|
-
"@": join(process.cwd(), "./src"),
|
|
228
|
-
...alias
|
|
229
|
-
},
|
|
230
|
-
extensions: [".mts", ".mjs", ".ts", ".js"],
|
|
231
|
-
...resolveReset
|
|
232
|
-
},
|
|
233
|
-
...optionReset
|
|
234
|
-
};
|
|
235
|
-
});
|
|
231
|
+
};
|
|
236
232
|
}
|
|
237
233
|
const vueEslintConfig = [
|
|
238
234
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/scripts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "scripts for seayoo web monorepos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
"eslint": "^9.19.0",
|
|
68
68
|
"stylelint": "^16.14.1",
|
|
69
69
|
"stylelint-config-recess-order": "^6.0.0",
|
|
70
|
-
"stylelint-config-standard": "^37.0.0"
|
|
71
|
-
"vite": "^6.2.1"
|
|
70
|
+
"stylelint-config-standard": "^37.0.0"
|
|
72
71
|
},
|
|
73
72
|
"scripts": {
|
|
74
73
|
"build": "vite build && tsc --emitDeclarationOnly",
|
package/types/index.d.ts
CHANGED
package/types/src/vite.app.d.ts
CHANGED
package/types/src/vite.lab.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type UserConfig } from "vite";
|
|
1
2
|
interface LibBuildOption {
|
|
2
3
|
/** 输出目录,默认为 "dist" */
|
|
3
4
|
outDir?: string;
|
|
@@ -11,5 +12,5 @@ interface LibBuildOption {
|
|
|
11
12
|
*
|
|
12
13
|
* 默认排除 "@seayoo-web/request" 和 "@seayoo-web/utils" 不打包
|
|
13
14
|
*/
|
|
14
|
-
export declare function defineLibBuildConfig(option?: LibBuildOption):
|
|
15
|
+
export declare function defineLibBuildConfig(option?: LibBuildOption): UserConfig;
|
|
15
16
|
export {};
|
package/types/src/vite.page.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UserConfig, UserConfigFnPromise } from "vite";
|
|
2
2
|
interface ExternalConfig {
|
|
3
3
|
/** sentry 配置 */
|
|
4
4
|
sentry?: {
|
|
@@ -9,5 +9,5 @@ interface ExternalConfig {
|
|
|
9
9
|
/**
|
|
10
10
|
* 导出一个动态的配置工厂函数
|
|
11
11
|
*/
|
|
12
|
-
export declare function definePageBuildConfig(option?: UserConfig & ExternalConfig):
|
|
12
|
+
export declare function definePageBuildConfig(option?: UserConfig & ExternalConfig): UserConfigFnPromise;
|
|
13
13
|
export {};
|