@seayoo-web/scripts 1.2.0 → 1.2.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/dist/index.js +4 -16
- package/package.json +1 -1
- package/types/src/env.d.ts +2 -4
package/dist/index.js
CHANGED
|
@@ -38,10 +38,9 @@ function getBuildEnv(command, mode) {
|
|
|
38
38
|
stamp: getNowTime(),
|
|
39
39
|
page: "",
|
|
40
40
|
mode: "",
|
|
41
|
-
loadingIcon: "https://a0.seayooassets.com/web/static/loadings/default.svg",
|
|
42
|
-
backgroudColor: "#222",
|
|
43
41
|
deployUser: "",
|
|
44
|
-
deployKey: ""
|
|
42
|
+
deployKey: "",
|
|
43
|
+
viteEnvs: envs
|
|
45
44
|
};
|
|
46
45
|
envConfig.mode = mode || "preview";
|
|
47
46
|
const d = `${EnvPrefix}DEPLOY_DEBUG`;
|
|
@@ -49,14 +48,6 @@ function getBuildEnv(command, mode) {
|
|
|
49
48
|
const s = `${EnvPrefix}SENTRY_AUTH_TOKEN`;
|
|
50
49
|
const u = `${EnvPrefix}DEPLOY_USER`;
|
|
51
50
|
const k = `${EnvPrefix}DEPLOY_KEY`;
|
|
52
|
-
const l = `${EnvPrefix}LOADING_ICON`;
|
|
53
|
-
const b = `${EnvPrefix}BACKGROUND_COLOR`;
|
|
54
|
-
if (envs[l]) {
|
|
55
|
-
envConfig.loadingIcon = envs[l];
|
|
56
|
-
}
|
|
57
|
-
if (envs[b]) {
|
|
58
|
-
envConfig.backgroudColor = envs[b];
|
|
59
|
-
}
|
|
60
51
|
const execDir = process.cwd().replace(/\\/g, "/").split("/").slice(-2).join("/");
|
|
61
52
|
const packageFile = join(process.cwd(), "./package.json");
|
|
62
53
|
if (!existsSync(packageFile)) {
|
|
@@ -149,8 +140,7 @@ function definePageBuildConfig(option) {
|
|
|
149
140
|
BUILD_TIME: envs.stamp,
|
|
150
141
|
BUILD_MODE: envs.mode,
|
|
151
142
|
BUILD_VERSION: gitInfo.hash,
|
|
152
|
-
|
|
153
|
-
BACKGROUND_COLOR: envs.backgroudColor,
|
|
143
|
+
...envs.viteEnvs,
|
|
154
144
|
...define
|
|
155
145
|
}),
|
|
156
146
|
...plugins,
|
|
@@ -176,8 +166,7 @@ function definePageBuildConfig(option) {
|
|
|
176
166
|
define: transformEnvs({
|
|
177
167
|
BUILD_TIME: envs.stamp,
|
|
178
168
|
BUILD_MODE: envs.mode,
|
|
179
|
-
|
|
180
|
-
BACKGROUND_COLOR: envs.backgroudColor,
|
|
169
|
+
...envs.viteEnvs,
|
|
181
170
|
...define
|
|
182
171
|
}),
|
|
183
172
|
resolve: {
|
|
@@ -186,7 +175,6 @@ function definePageBuildConfig(option) {
|
|
|
186
175
|
...alias
|
|
187
176
|
},
|
|
188
177
|
extensions: [".mts", ".mjs", ".ts", ".js"],
|
|
189
|
-
// allowImportingTsExtensions: true,
|
|
190
178
|
...resolveReset
|
|
191
179
|
},
|
|
192
180
|
server: {
|
package/package.json
CHANGED
package/types/src/env.d.ts
CHANGED
|
@@ -9,10 +9,6 @@ interface IBuildEnvs {
|
|
|
9
9
|
mode: string;
|
|
10
10
|
/** 页面 repo 地址 */
|
|
11
11
|
page: string;
|
|
12
|
-
/** 默认的 loading icon 地址,默认 https://a0.seayooassets.com/web/static/loadings/default.svg */
|
|
13
|
-
loadingIcon: string;
|
|
14
|
-
/** 默认的页面背景色,需要跟 loading icon 搭配,默认 #222 */
|
|
15
|
-
backgroudColor: string;
|
|
16
12
|
/** 页面部署地址 */
|
|
17
13
|
deployTo?: string;
|
|
18
14
|
/** 打印部署详细日志 */
|
|
@@ -23,6 +19,8 @@ interface IBuildEnvs {
|
|
|
23
19
|
deployUser: string;
|
|
24
20
|
/** 部署的 key */
|
|
25
21
|
deployKey: string;
|
|
22
|
+
/** 从 vite 读取到的环境变量 */
|
|
23
|
+
viteEnvs: Record<string, string>;
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* 获取构建环境配置
|