@shwfed/nuxt 0.7.3 → 0.7.5

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