@seayoo-web/scripts 2.5.2 → 2.5.4

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
@@ -73,6 +73,7 @@ function getBuildEnv(command, mode, onlyBuild, requireSentryToken, ignoreSentryT
73
73
  const s = `${EnvPrefix}SENTRY_AUTH_TOKEN`;
74
74
  const u = `${EnvPrefix}DEPLOY_USER`;
75
75
  const k = `${EnvPrefix}DEPLOY_KEY`;
76
+ const p = `${EnvPrefix}SERVER_PORT`;
76
77
  const paths = process.cwd().replace(/\\/g, "/").split("/");
77
78
  const execDirWithPackage = paths.slice(-2).join("/");
78
79
  const execDir = paths.slice(-1)[0];
@@ -87,6 +88,8 @@ function getBuildEnv(command, mode, onlyBuild, requireSentryToken, ignoreSentryT
87
88
  process.exit(1);
88
89
  }
89
90
  envConfig.page = execDirWithPackage;
91
+ const port = +envs[p];
92
+ if (port) envConfig.port = port;
90
93
  if (onlyBuild) {
91
94
  return envConfig;
92
95
  }
@@ -157,6 +160,10 @@ function definePageBuildConfig(option) {
157
160
  ...optionReset
158
161
  } = option || {};
159
162
  const { alias, ...resolveReset } = resolve;
163
+ if (server.port) {
164
+ console.warn(`ServerPort 不允许直接修改,请使用环境变量 ${EnvPrefix}_SERVER_PORT 设置`);
165
+ delete server.port;
166
+ }
160
167
  return async function({ command, mode }) {
161
168
  var _a, _b, _c;
162
169
  const justBuild = mode === "build";
@@ -268,6 +275,7 @@ function definePageBuildConfig(option) {
268
275
  },
269
276
  server: {
270
277
  open: true,
278
+ port: envs.port,
271
279
  ...server
272
280
  },
273
281
  ...optionReset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "scripts for seayoo web repos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -74,6 +74,7 @@
74
74
  },
75
75
  "scripts": {
76
76
  "build": "vite build && tsc --emitDeclarationOnly",
77
+ "type-check": "tsc --noEmit",
77
78
  "prepublish": "pnpm build"
78
79
  }
79
80
  }
@@ -19,6 +19,8 @@ interface IBuildEnvs {
19
19
  deployUser: string;
20
20
  /** 部署的 key */
21
21
  deployKey: string;
22
+ /** 本地开发服务器的端口 */
23
+ port?: number;
22
24
  /** 从 vite 读取到的环境变量 */
23
25
  viteEnvs: Record<string, string>;
24
26
  }