@seayoo-web/scripts 1.1.2 → 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.
@@ -108,7 +108,7 @@ async function execCmd(cmd, ignoreWarning = false) {
108
108
  });
109
109
  });
110
110
  }
111
- async function getCommitInfo(command, mode, deployTo) {
111
+ async function getCommitInfo(command, mode, page, deployTo) {
112
112
  if (command !== "build" || mode === "preview" || mode === "prev") {
113
113
  return { hash: await getCommitHash(), logs: [] };
114
114
  }
@@ -126,7 +126,7 @@ async function getCommitInfo(command, mode, deployTo) {
126
126
  process.exit(1);
127
127
  }
128
128
  const [currentCommit, lastDeployTag] = await Promise.all([getCommitHash(), getLastDeployTag(deployTo)]);
129
- const commitLogs = await getCommitLogs(currentCommit, lastDeployTag, "./");
129
+ const commitLogs = await getCommitLogs(currentCommit, lastDeployTag, page || "./");
130
130
  return { hash: currentCommit, logs: commitLogs };
131
131
  }
132
132
  async function getLastDeployTag(deployTo) {
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import vue from "@vitejs/plugin-vue";
7
7
  import vueDevTools from "vite-plugin-vue-devtools";
8
8
  import { existsSync, readFileSync } from "fs";
9
9
  import "colors";
10
- import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-DqZLg6mx.js";
10
+ import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-rC0NCMws.js";
11
11
  import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
12
12
  import { vueTsConfigs } from "@vue/eslint-config-typescript";
13
13
  import { defineConfigWithVueTs } from "@vue/eslint-config-typescript";
@@ -39,7 +39,8 @@ function getBuildEnv(command, mode) {
39
39
  page: "",
40
40
  mode: "",
41
41
  deployUser: "",
42
- deployKey: ""
42
+ deployKey: "",
43
+ viteEnvs: envs
43
44
  };
44
45
  envConfig.mode = mode || "preview";
45
46
  const d = `${EnvPrefix}DEPLOY_DEBUG`;
@@ -105,7 +106,7 @@ function definePageBuildConfig(option) {
105
106
  return defineConfig(async function(viteEnvs) {
106
107
  const { command, mode } = viteEnvs;
107
108
  const envs = getBuildEnv(command, mode);
108
- const gitInfo = await getCommitInfo(command, mode, envs.deployTo || "");
109
+ const gitInfo = await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
109
110
  const isProductMode = mode === "production" || mode === "prod";
110
111
  const {
111
112
  plugins = [],
@@ -138,7 +139,9 @@ function definePageBuildConfig(option) {
138
139
  htmlInjectPlugin({
139
140
  BUILD_TIME: envs.stamp,
140
141
  BUILD_MODE: envs.mode,
141
- BUILD_VERSION: gitInfo.hash
142
+ BUILD_VERSION: gitInfo.hash,
143
+ ...envs.viteEnvs,
144
+ ...define
142
145
  }),
143
146
  ...plugins,
144
147
  command === "build" && envs.deployTo ? viteDeployPlugin({
@@ -163,7 +166,7 @@ function definePageBuildConfig(option) {
163
166
  define: transformEnvs({
164
167
  BUILD_TIME: envs.stamp,
165
168
  BUILD_MODE: envs.mode,
166
- ...envs,
169
+ ...envs.viteEnvs,
167
170
  ...define
168
171
  }),
169
172
  resolve: {
@@ -172,7 +175,6 @@ function definePageBuildConfig(option) {
172
175
  ...alias
173
176
  },
174
177
  extensions: [".mts", ".mjs", ".ts", ".js"],
175
- // allowImportingTsExtensions: true,
176
178
  ...resolveReset
177
179
  },
178
180
  server: {
package/dist/node.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import fs from "fs-extra";
6
6
  import inquirer from "inquirer";
7
7
  import ora from "ora";
8
- import { r as root, b as addProjectToWorkspace, d as copyTemplate, e as getProjects, f as getTemplates, h as checkGitStatusBeforeDestory, i as createBackupTag, j as removeProjectFromWorkspace, s as submitAllDeletionChanges, k as getRepos } from "./git-DqZLg6mx.js";
8
+ import { r as root, b as addProjectToWorkspace, d as copyTemplate, e as getProjects, f as getTemplates, h as checkGitStatusBeforeDestory, i as createBackupTag, j as removeProjectFromWorkspace, s as submitAllDeletionChanges, k as getRepos } from "./git-rC0NCMws.js";
9
9
  const commitRE = /^(?:revert: )?(?:feat|fix|docs|style|refactor|test|chore|debug|tweak|improve)(?:\(.+\))?: .{1,100}/;
10
10
  function checkCommit() {
11
11
  const msgPath = process.argv[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "scripts for seayoo web monorepos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -56,7 +56,6 @@
56
56
  "@types/node": "^22.13.1",
57
57
  "@typescript-eslint/utils": "^8.25.0",
58
58
  "eslint": "^9.19.0",
59
- "postcss": "^8.5.3",
60
59
  "stylelint": "^16.14.1",
61
60
  "stylelint-config-recess-order": "^6.0.0",
62
61
  "stylelint-config-standard": "^37.0.0",
@@ -19,6 +19,8 @@ interface IBuildEnvs {
19
19
  deployUser: string;
20
20
  /** 部署的 key */
21
21
  deployKey: string;
22
+ /** 从 vite 读取到的环境变量 */
23
+ viteEnvs: Record<string, string>;
22
24
  }
23
25
  /**
24
26
  * 获取构建环境配置
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 读取提交信息
3
3
  */
4
- export declare function getCommitInfo(command: string, mode: string, deployTo: string): Promise<{
4
+ export declare function getCommitInfo(command: string, mode: string, page: string, deployTo: string): Promise<{
5
5
  hash: string;
6
6
  logs: string[];
7
7
  }>;