@seayoo-web/scripts 1.1.1 → 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 -9
- package/dist/node.js +1 -1
- package/package.json +6 -6
- package/types/index.d.ts +0 -1
- 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,13 +7,12 @@ 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";
|
|
14
14
|
import { flatConfigs } from "eslint-plugin-import";
|
|
15
15
|
import pluginVue from "eslint-plugin-vue";
|
|
16
|
-
import nestingPlugin from "postcss-nesting";
|
|
17
16
|
function defineLibBuildConfig(option) {
|
|
18
17
|
return defineConfig({
|
|
19
18
|
build: {
|
|
@@ -39,6 +38,8 @@ function getBuildEnv(command, mode) {
|
|
|
39
38
|
stamp: getNowTime(),
|
|
40
39
|
page: "",
|
|
41
40
|
mode: "",
|
|
41
|
+
loadingIcon: "https://a0.seayooassets.com/web/static/loadings/default.svg",
|
|
42
|
+
backgroudColor: "#222",
|
|
42
43
|
deployUser: "",
|
|
43
44
|
deployKey: ""
|
|
44
45
|
};
|
|
@@ -48,6 +49,14 @@ function getBuildEnv(command, mode) {
|
|
|
48
49
|
const s = `${EnvPrefix}SENTRY_AUTH_TOKEN`;
|
|
49
50
|
const u = `${EnvPrefix}DEPLOY_USER`;
|
|
50
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
|
+
}
|
|
51
60
|
const execDir = process.cwd().replace(/\\/g, "/").split("/").slice(-2).join("/");
|
|
52
61
|
const packageFile = join(process.cwd(), "./package.json");
|
|
53
62
|
if (!existsSync(packageFile)) {
|
|
@@ -106,7 +115,7 @@ function definePageBuildConfig(option) {
|
|
|
106
115
|
return defineConfig(async function(viteEnvs) {
|
|
107
116
|
const { command, mode } = viteEnvs;
|
|
108
117
|
const envs = getBuildEnv(command, mode);
|
|
109
|
-
const gitInfo = await getCommitInfo(command, mode, envs.deployTo || "");
|
|
118
|
+
const gitInfo = await getCommitInfo(command, mode, envs.page, envs.deployTo || "");
|
|
110
119
|
const isProductMode = mode === "production" || mode === "prod";
|
|
111
120
|
const {
|
|
112
121
|
plugins = [],
|
|
@@ -139,7 +148,10 @@ function definePageBuildConfig(option) {
|
|
|
139
148
|
htmlInjectPlugin({
|
|
140
149
|
BUILD_TIME: envs.stamp,
|
|
141
150
|
BUILD_MODE: envs.mode,
|
|
142
|
-
BUILD_VERSION: gitInfo.hash
|
|
151
|
+
BUILD_VERSION: gitInfo.hash,
|
|
152
|
+
LOADING_ICON: envs.loadingIcon,
|
|
153
|
+
BACKGROUND_COLOR: envs.backgroudColor,
|
|
154
|
+
...define
|
|
143
155
|
}),
|
|
144
156
|
...plugins,
|
|
145
157
|
command === "build" && envs.deployTo ? viteDeployPlugin({
|
|
@@ -164,7 +176,8 @@ function definePageBuildConfig(option) {
|
|
|
164
176
|
define: transformEnvs({
|
|
165
177
|
BUILD_TIME: envs.stamp,
|
|
166
178
|
BUILD_MODE: envs.mode,
|
|
167
|
-
|
|
179
|
+
LOADING_ICON: envs.loadingIcon,
|
|
180
|
+
BACKGROUND_COLOR: envs.backgroudColor,
|
|
168
181
|
...define
|
|
169
182
|
}),
|
|
170
183
|
resolve: {
|
|
@@ -237,9 +250,6 @@ const stylelintConfig = {
|
|
|
237
250
|
],
|
|
238
251
|
rules: {}
|
|
239
252
|
};
|
|
240
|
-
const postcssConfig = {
|
|
241
|
-
plugins: [nestingPlugin]
|
|
242
|
-
};
|
|
243
253
|
export {
|
|
244
254
|
EnvPrefix,
|
|
245
255
|
defineConfigWithVueTs,
|
|
@@ -248,7 +258,6 @@ export {
|
|
|
248
258
|
getBuildEnv,
|
|
249
259
|
htmlInjectPlugin,
|
|
250
260
|
importEslintConfig,
|
|
251
|
-
postcssConfig,
|
|
252
261
|
stylelintConfig,
|
|
253
262
|
transformEnvs,
|
|
254
263
|
vueEslintConfig
|
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",
|
|
@@ -47,9 +47,6 @@
|
|
|
47
47
|
"jiti": "^2.4.2",
|
|
48
48
|
"ora": "^8.2.0",
|
|
49
49
|
"postcss-html": "^1.8.0",
|
|
50
|
-
"postcss-nesting": "^13.0.1",
|
|
51
|
-
"stylelint-config-recess-order": "^6.0.0",
|
|
52
|
-
"stylelint-config-standard": "^37.0.0",
|
|
53
50
|
"vite-plugin-stylelint": "^6.0.0",
|
|
54
51
|
"vite-plugin-vue-devtools": "^7.7.2",
|
|
55
52
|
"@seayoo-web/finder": "^2.0.13"
|
|
@@ -59,13 +56,16 @@
|
|
|
59
56
|
"@types/node": "^22.13.1",
|
|
60
57
|
"@typescript-eslint/utils": "^8.25.0",
|
|
61
58
|
"eslint": "^9.19.0",
|
|
62
|
-
"postcss": "^8.5.3",
|
|
63
59
|
"stylelint": "^16.14.1",
|
|
60
|
+
"stylelint-config-recess-order": "^6.0.0",
|
|
61
|
+
"stylelint-config-standard": "^37.0.0",
|
|
64
62
|
"@seayoo-web/tsconfig": "^1.0.2"
|
|
65
63
|
},
|
|
66
64
|
"peerDependencies": {
|
|
67
65
|
"eslint": "^9.19.0",
|
|
68
|
-
"stylelint": "^16.14.1"
|
|
66
|
+
"stylelint": "^16.14.1",
|
|
67
|
+
"stylelint-config-recess-order": "^6.0.0",
|
|
68
|
+
"stylelint-config-standard": "^37.0.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "vite build && tsc --emitDeclarationOnly",
|
package/types/index.d.ts
CHANGED
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
|
}>;
|