@seayoo-web/scripts 1.1.2 → 1.2.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/{git-DqZLg6mx.js → git-rC0NCMws.js} +2 -2
- package/dist/index.js +18 -4
- package/dist/node.js +1 -1
- package/package.json +1 -2
- package/types/src/env.d.ts +4 -0
- package/types/src/git.d.ts +1 -1
|
@@ -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-
|
|
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";
|
|
@@ -38,6 +38,8 @@ 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",
|
|
41
43
|
deployUser: "",
|
|
42
44
|
deployKey: ""
|
|
43
45
|
};
|
|
@@ -47,6 +49,14 @@ function getBuildEnv(command, mode) {
|
|
|
47
49
|
const s = `${EnvPrefix}SENTRY_AUTH_TOKEN`;
|
|
48
50
|
const u = `${EnvPrefix}DEPLOY_USER`;
|
|
49
51
|
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
|
+
}
|
|
50
60
|
const execDir = process.cwd().replace(/\\/g, "/").split("/").slice(-2).join("/");
|
|
51
61
|
const packageFile = join(process.cwd(), "./package.json");
|
|
52
62
|
if (!existsSync(packageFile)) {
|
|
@@ -105,7 +115,7 @@ function definePageBuildConfig(option) {
|
|
|
105
115
|
return defineConfig(async function(viteEnvs) {
|
|
106
116
|
const { command, mode } = viteEnvs;
|
|
107
117
|
const envs = getBuildEnv(command, mode);
|
|
108
|
-
const gitInfo = await getCommitInfo(command, mode, envs.deployTo || "");
|
|
118
|
+
const gitInfo = await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
|
|
109
119
|
const isProductMode = mode === "production" || mode === "prod";
|
|
110
120
|
const {
|
|
111
121
|
plugins = [],
|
|
@@ -138,7 +148,10 @@ function definePageBuildConfig(option) {
|
|
|
138
148
|
htmlInjectPlugin({
|
|
139
149
|
BUILD_TIME: envs.stamp,
|
|
140
150
|
BUILD_MODE: envs.mode,
|
|
141
|
-
BUILD_VERSION: gitInfo.hash
|
|
151
|
+
BUILD_VERSION: gitInfo.hash,
|
|
152
|
+
LOADING_ICON: envs.loadingIcon,
|
|
153
|
+
BACKGROUND_COLOR: envs.backgroudColor,
|
|
154
|
+
...define
|
|
142
155
|
}),
|
|
143
156
|
...plugins,
|
|
144
157
|
command === "build" && envs.deployTo ? viteDeployPlugin({
|
|
@@ -163,7 +176,8 @@ function definePageBuildConfig(option) {
|
|
|
163
176
|
define: transformEnvs({
|
|
164
177
|
BUILD_TIME: envs.stamp,
|
|
165
178
|
BUILD_MODE: envs.mode,
|
|
166
|
-
|
|
179
|
+
LOADING_ICON: envs.loadingIcon,
|
|
180
|
+
BACKGROUND_COLOR: envs.backgroudColor,
|
|
167
181
|
...define
|
|
168
182
|
}),
|
|
169
183
|
resolve: {
|
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-
|
|
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.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
package/types/src/env.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ 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;
|
|
12
16
|
/** 页面部署地址 */
|
|
13
17
|
deployTo?: string;
|
|
14
18
|
/** 打印部署详细日志 */
|
package/types/src/git.d.ts
CHANGED
|
@@ -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
|
}>;
|