@seayoo-web/scripts 2.8.2 → 2.10.0

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 CHANGED
@@ -218,7 +218,7 @@ function definePageBuildConfig(option) {
218
218
  if (k) return trunkMap[k];
219
219
  };
220
220
  const ignoreSideEffects = ["thinkingdata", "@esotericsoftware/spine", ...badPackages];
221
- const baseValue = typeof base === "object" && base ? base[mode] : typeof base === "string" ? base : "./";
221
+ const baseValue = typeof base === "function" ? base(mode, envs.viteEnvs) || "./" : typeof base === "object" && base ? base[mode] : typeof base === "string" ? base : "./";
222
222
  if (baseValue === void 0 && mode !== "development") {
223
223
  console.warn(`base 参数在模式(${mode})下未设置内容`.red);
224
224
  process.exit(1);
@@ -284,6 +284,7 @@ function definePageBuildConfig(option) {
284
284
  key: envs.deployKey,
285
285
  debug: envs.deployDebug,
286
286
  preview: option?.finder?.preview ?? true,
287
+ onBeforeDeploy: option?.finder?.beforeDeploy,
287
288
  commitLogs: isProductMode && gitInfo.logs.length > 0 ? "\n" + gitInfo.logs.join("\n") : void 0,
288
289
  onFinished() {
289
290
  if (isProductMode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "2.8.2",
3
+ "version": "2.10.0",
4
4
  "description": "scripts for seayoo web repos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -53,7 +53,7 @@
53
53
  "terser": "^5.43.1",
54
54
  "vite-plugin-stylelint": "^6.0.2",
55
55
  "stylelint-order": "^7.0.0",
56
- "@seayoo-web/finder": "^2.1.1"
56
+ "@seayoo-web/finder": "^2.2.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/fs-extra": "^11.0.4",
@@ -1,7 +1,7 @@
1
1
  import type { UserConfig, UserConfigFnPromise } from "vite";
2
2
  interface ExternalConfig {
3
3
  /** 设置base路径,支持配置多组 base,以 mode 为key */
4
- base?: string | Record<string, string>;
4
+ base?: string | Record<string, string> | ((mode: string, env: Record<string, string>) => string);
5
5
  /** 是否不使用 vue */
6
6
  notVuePage?: boolean;
7
7
  /** 是否不加载 polyfill */
@@ -28,6 +28,10 @@ interface ExternalConfig {
28
28
  * 匹配时仅针对单一目录和文件名进行检查,不跨目录检查
29
29
  */
30
30
  ignoreFiles?: string[];
31
+ /**
32
+ * 在部署文件前调用,用以调整产物文件
33
+ */
34
+ beforeDeploy?: (distDir: string) => unknown;
31
35
  };
32
36
  /**
33
37
  * 手工指定 trunk 合并策略,Record<key, chunk>,即 id.include(key) 则打到 trunk 中