@shwfed/nuxt 0.7.4 → 0.7.6
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/module.json +1 -1
- package/dist/module.mjs +97 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { createHmac } from 'node:crypto';
|
|
1
3
|
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addImportsDir, addComponentsDir, addRouteMiddleware } from '@nuxt/kit';
|
|
2
4
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
|
3
5
|
import TailwindCSS from '@tailwindcss/vite';
|
|
@@ -12,6 +14,9 @@ const module$1 = defineNuxtModule({
|
|
|
12
14
|
"@nuxt/fonts": {
|
|
13
15
|
version: "^0.14.0",
|
|
14
16
|
defaults: {
|
|
17
|
+
providers: {
|
|
18
|
+
google: false
|
|
19
|
+
},
|
|
15
20
|
families: [
|
|
16
21
|
{ name: "Noto Sans", provider: "bunny" },
|
|
17
22
|
{ name: "Noto Sans SC", provider: "bunny" },
|
|
@@ -70,6 +75,98 @@ const module$1 = defineNuxtModule({
|
|
|
70
75
|
name: "token",
|
|
71
76
|
global: true
|
|
72
77
|
});
|
|
78
|
+
},
|
|
79
|
+
hooks: {
|
|
80
|
+
"build:error": async (error) => {
|
|
81
|
+
if (!process.env.CI) return;
|
|
82
|
+
const accessToken = "a01e0fdfd7d2d019dcfac29e39d82333907f97bfe490dc9e15e94ee4cf6a7ecf";
|
|
83
|
+
const secret = "SEC9d85269f2b09e9eb652d32af42ff7e84193f0ca5d5669ba16378a388881aed9c";
|
|
84
|
+
const timestamp = String(Date.now());
|
|
85
|
+
const sign = encodeURIComponent(
|
|
86
|
+
createHmac("sha256", secret).update(`${timestamp}
|
|
87
|
+
${secret}`).digest("base64")
|
|
88
|
+
);
|
|
89
|
+
const jobName = process.env.JOB_NAME ?? "";
|
|
90
|
+
const buildNumber = process.env.BUILD_NUMBER ?? "";
|
|
91
|
+
const branch = process.env.BRANCH_NAME ?? process.env.GIT_BRANCH ?? "";
|
|
92
|
+
const runUrl = process.env.RUN_DISPLAY_URL ?? "";
|
|
93
|
+
await fetch(
|
|
94
|
+
`https://oapi.dingtalk.com/robot/send?access_token=${accessToken}×tamp=${timestamp}&sign=${sign}`,
|
|
95
|
+
{
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: { "Content-Type": "application/json" },
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
msgtype: "actionCard",
|
|
100
|
+
actionCard: {
|
|
101
|
+
title: `\u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}`,
|
|
102
|
+
text: `### \u9879\u76EE\u6784\u5EFA\u5931\u8D25: ${jobName}
|
|
103
|
+
|
|
104
|
+
**\u6784\u5EFA\u7F16\u53F7**: #${buildNumber}
|
|
105
|
+
|
|
106
|
+
**\u5206\u652F**: ${branch}
|
|
107
|
+
|
|
108
|
+
**\u9519\u8BEF**: ${error.message}`,
|
|
109
|
+
btnOrientation: "0",
|
|
110
|
+
btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
"build:done": async () => {
|
|
117
|
+
if (!process.env.CI) return;
|
|
118
|
+
const accessToken = "a01e0fdfd7d2d019dcfac29e39d82333907f97bfe490dc9e15e94ee4cf6a7ecf";
|
|
119
|
+
const secret = "SEC9d85269f2b09e9eb652d32af42ff7e84193f0ca5d5669ba16378a388881aed9c";
|
|
120
|
+
const previousCommit = process.env.GIT_PREVIOUS_SUCCESSFUL_COMMIT;
|
|
121
|
+
let changelog;
|
|
122
|
+
try {
|
|
123
|
+
changelog = previousCommit ? execSync(`git log ${previousCommit}..HEAD --pretty=format:"- %s [%an]"`).toString().trim() : execSync('git log -5 --pretty=format:"- %s [%an]"').toString().trim();
|
|
124
|
+
} catch {
|
|
125
|
+
changelog = "";
|
|
126
|
+
}
|
|
127
|
+
if (!changelog) changelog = "\u6682\u65E0\u65B0\u4EE3\u7801\u53D8\u66F4";
|
|
128
|
+
let lastAuthor;
|
|
129
|
+
try {
|
|
130
|
+
lastAuthor = execSync("git log -1 --pretty=format:'%an'").toString().trim();
|
|
131
|
+
} catch {
|
|
132
|
+
lastAuthor = "Unknown";
|
|
133
|
+
}
|
|
134
|
+
const timestamp = String(Date.now());
|
|
135
|
+
const sign = encodeURIComponent(
|
|
136
|
+
createHmac("sha256", secret).update(`${timestamp}
|
|
137
|
+
${secret}`).digest("base64")
|
|
138
|
+
);
|
|
139
|
+
const jobName = process.env.JOB_NAME ?? "";
|
|
140
|
+
const buildNumber = process.env.BUILD_NUMBER ?? "";
|
|
141
|
+
const branch = process.env.BRANCH_NAME ?? process.env.GIT_BRANCH ?? "";
|
|
142
|
+
const runUrl = process.env.RUN_DISPLAY_URL ?? "";
|
|
143
|
+
await fetch(
|
|
144
|
+
`https://oapi.dingtalk.com/robot/send?access_token=${accessToken}×tamp=${timestamp}&sign=${sign}`,
|
|
145
|
+
{
|
|
146
|
+
method: "POST",
|
|
147
|
+
headers: { "Content-Type": "application/json" },
|
|
148
|
+
body: JSON.stringify({
|
|
149
|
+
msgtype: "actionCard",
|
|
150
|
+
actionCard: {
|
|
151
|
+
title: `\u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}`,
|
|
152
|
+
text: `### \u9879\u76EE\u6784\u5EFA\u901A\u77E5: ${jobName}
|
|
153
|
+
|
|
154
|
+
**\u6784\u5EFA\u7F16\u53F7**: #${buildNumber}
|
|
155
|
+
|
|
156
|
+
**\u5206\u652F**: ${branch}
|
|
157
|
+
|
|
158
|
+
**\u4F5C\u8005**: ${lastAuthor}
|
|
159
|
+
|
|
160
|
+
**\u53D8\u66F4\u65E5\u5FD7**:
|
|
161
|
+
|
|
162
|
+
${changelog}`,
|
|
163
|
+
btnOrientation: "0",
|
|
164
|
+
btns: [{ title: "\u67E5\u770B\u8BE6\u60C5", actionURL: runUrl }]
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
73
170
|
}
|
|
74
171
|
});
|
|
75
172
|
|