semantic-release-minecraft 1.1.3 → 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/CHANGELOG.md +6 -0
- package/dist/curseforge.d.ts +2 -2
- package/dist/curseforge.d.ts.map +1 -1
- package/dist/curseforge.js +47 -115
- package/dist/curseforge.js.map +1 -1
- package/dist/definitions/curseforge.d.ts +6 -6
- package/dist/definitions/{plugin_config.d.ts → plugin-config.d.ts} +4 -3
- package/dist/definitions/plugin-config.d.ts.map +1 -0
- package/dist/definitions/plugin-config.js +2 -0
- package/dist/definitions/plugin-config.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -23
- package/dist/index.js.map +1 -1
- package/dist/modrinth.d.ts +3 -3
- package/dist/modrinth.d.ts.map +1 -1
- package/dist/modrinth.js +58 -224
- package/dist/modrinth.js.map +1 -1
- package/dist/prepare.d.ts +4 -8
- package/dist/prepare.d.ts.map +1 -1
- package/dist/prepare.js +31 -32
- package/dist/prepare.js.map +1 -1
- package/dist/utils/glob-utils.d.ts +6 -0
- package/dist/utils/glob-utils.d.ts.map +1 -0
- package/dist/utils/glob-utils.js +27 -0
- package/dist/utils/glob-utils.js.map +1 -0
- package/dist/utils/platform/curseforge-utils.d.ts +4 -0
- package/dist/utils/platform/curseforge-utils.d.ts.map +1 -0
- package/dist/utils/platform/curseforge-utils.js +7 -0
- package/dist/utils/platform/curseforge-utils.js.map +1 -0
- package/dist/utils/platform/utils.d.ts +10 -0
- package/dist/utils/platform/utils.d.ts.map +1 -0
- package/dist/utils/platform/utils.js +56 -0
- package/dist/utils/platform/utils.js.map +1 -0
- package/dist/utils/template-utils.d.ts +26 -0
- package/dist/utils/template-utils.d.ts.map +1 -0
- package/dist/utils/template-utils.js +40 -0
- package/dist/utils/template-utils.js.map +1 -0
- package/dist/utils/utils.d.ts +4 -26
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +5 -79
- package/dist/utils/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/curseforge.ts +98 -160
- package/src/definitions/curseforge.ts +6 -6
- package/src/definitions/plugin-config.ts +68 -0
- package/src/index.ts +28 -34
- package/src/modrinth.ts +78 -272
- package/src/prepare.ts +43 -52
- package/src/utils/glob-utils.ts +38 -0
- package/src/utils/platform/curseforge-utils.ts +17 -0
- package/src/utils/platform/utils.ts +84 -0
- package/src/utils/template-utils.ts +54 -0
- package/src/utils/utils.ts +5 -115
- package/dist/definitions/plugin_config.d.ts.map +0 -1
- package/dist/definitions/plugin_config.js +0 -2
- package/dist/definitions/plugin_config.js.map +0 -1
- package/src/definitions/plugin_config.ts +0 -68
package/dist/modrinth.js
CHANGED
|
@@ -1,251 +1,85 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import FormData from 'form-data';
|
|
3
3
|
import { readFile } from 'fs/promises';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { findFiles, renderTemplates, resolveMultipleTemplate, resolveTemplate, toArray, } from './utils/utils.js';
|
|
4
|
+
import { basename } from 'path';
|
|
5
|
+
import { findFilesAndPrimaryFile } from './utils/platform/utils';
|
|
6
|
+
import { resolveAndRenderTemplate, resolveAndRenderTemplates, } from './utils/template-utils';
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
8
|
+
* Publishes files to Modrinth.
|
|
10
9
|
*/
|
|
11
|
-
export async function publishToModrinth(pluginConfig, context) {
|
|
12
|
-
const { env, logger } = context;
|
|
10
|
+
export async function publishToModrinth(pluginConfig, context, strategy) {
|
|
11
|
+
const { env, logger, nextRelease } = context;
|
|
13
12
|
const { modrinth } = pluginConfig;
|
|
14
13
|
const token = env.MODRINTH_TOKEN;
|
|
15
14
|
const projectId = modrinth?.project_id;
|
|
16
|
-
const
|
|
17
|
-
const nextReleaseVersion = nextRelease.version;
|
|
18
|
-
// 查找文件并确定主要文件
|
|
19
|
-
const { files, primaryFile } = await findModrinthFiles(pluginConfig, context);
|
|
15
|
+
const { files, primaryFile } = await findFilesAndPrimaryFile(pluginConfig, context, strategy);
|
|
20
16
|
logger.log(`Publishing ${files.length} file(s) to Modrinth project ${projectId}...`);
|
|
21
|
-
//
|
|
17
|
+
// use multipart/form-data to upload files and version data
|
|
22
18
|
const form = new FormData();
|
|
23
19
|
const filePartNames = [];
|
|
24
20
|
let primaryFilePartName = undefined;
|
|
25
|
-
// 上传所有文件
|
|
26
21
|
for (let i = 0; i < files.length; i++) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const fileName =
|
|
22
|
+
const filePath = files[i];
|
|
23
|
+
const file = await readFile(filePath);
|
|
24
|
+
const fileName = basename(filePath);
|
|
30
25
|
const filePartName = `file-${i}`;
|
|
31
|
-
form.append(filePartName,
|
|
26
|
+
form.append(filePartName, file, { filename: fileName });
|
|
32
27
|
filePartNames.push(filePartName);
|
|
33
|
-
|
|
34
|
-
if (jarPath === primaryFile) {
|
|
28
|
+
if (filePath === primaryFile) {
|
|
35
29
|
primaryFilePartName = filePartName;
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
// 使用根据 primaryFileGlob 确定的主要文件
|
|
39
|
-
const finalPrimaryFile = primaryFilePartName;
|
|
40
|
-
// 准备版本信息,只包含必需字段和存在的可选字段
|
|
41
|
-
// displayName 按照优先级:平台特定配置 > 全局配置 > 平台特定环境变量 > 全局环境变量
|
|
42
|
-
let displayName;
|
|
43
|
-
if (modrinth?.display_name) {
|
|
44
|
-
displayName = _.template(modrinth.display_name)({
|
|
45
|
-
nextRelease,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
else if (pluginConfig.display_name) {
|
|
49
|
-
displayName = _.template(pluginConfig.display_name)({
|
|
50
|
-
nextRelease,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
else if (env.MODRINTH_DISPLAY_NAME) {
|
|
54
|
-
displayName = env.MODRINTH_DISPLAY_NAME;
|
|
55
|
-
}
|
|
56
|
-
else if (env.DISPLAY_NAME) {
|
|
57
|
-
displayName = env.DISPLAY_NAME;
|
|
58
|
-
}
|
|
59
|
-
// version_number 按照优先级:平台特定配置 > 平台特定环境变量 > 全局环境变量
|
|
60
|
-
const versionNumber = resolveTemplate([modrinth?.version_number, env.MODRINTH_VERSION_NUMBER], { nextRelease });
|
|
61
|
-
// 准备版本信息,只包含必需字段和存在的可选字段
|
|
62
32
|
const versionData = {
|
|
63
33
|
project_id: projectId,
|
|
64
|
-
file_parts: filePartNames,
|
|
34
|
+
file_parts: filePartNames,
|
|
35
|
+
changelog: modrinth?.changelog || nextRelease.notes || '',
|
|
36
|
+
loaders: modrinth?.mod_loaders || [],
|
|
37
|
+
version_type: pluginConfig.release_type || 'release',
|
|
38
|
+
dependencies: modrinth?.dependencies || [],
|
|
39
|
+
featured: modrinth?.featured || false,
|
|
40
|
+
status: modrinth?.status || 'listed',
|
|
41
|
+
requested_status: modrinth?.requested_status || 'listed',
|
|
42
|
+
primary_file: primaryFilePartName,
|
|
65
43
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// 如果没有找到任何配置,使用默认值
|
|
72
|
-
versionData.name = context.nextRelease.name;
|
|
73
|
-
}
|
|
74
|
-
// 只有找到值时才添加 version_number 字段
|
|
75
|
-
if (versionNumber) {
|
|
76
|
-
versionData.version_number = versionNumber;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
// 如果没有找到任何配置,使用默认值
|
|
80
|
-
versionData.version_number = nextReleaseVersion;
|
|
81
|
-
}
|
|
82
|
-
// 只添加存在的可选字段
|
|
83
|
-
if (modrinth?.changelog || context.nextRelease?.notes) {
|
|
84
|
-
versionData.changelog =
|
|
85
|
-
modrinth?.changelog || context.nextRelease?.notes || '';
|
|
86
|
-
}
|
|
87
|
-
if (modrinth?.game_versions && modrinth.game_versions.length > 0) {
|
|
88
|
-
versionData.game_versions = renderTemplates(modrinth.game_versions, {
|
|
89
|
-
nextRelease,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
else if (pluginConfig.game_versions &&
|
|
93
|
-
pluginConfig.game_versions.length > 0) {
|
|
94
|
-
versionData.game_versions = renderTemplates(toArray(pluginConfig.game_versions), {
|
|
95
|
-
nextRelease,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
// modLoaders 按照优先级:平台特定配置 > 全局配置 > 平台特定环境变量 > 全局环境变量
|
|
99
|
-
let modLoaders;
|
|
100
|
-
if (modrinth?.mod_loaders && modrinth.mod_loaders.length > 0) {
|
|
101
|
-
modLoaders = renderTemplates(modrinth.mod_loaders, {
|
|
102
|
-
nextRelease,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
else if (pluginConfig.mod_loaders &&
|
|
106
|
-
pluginConfig.mod_loaders.length > 0) {
|
|
107
|
-
modLoaders = renderTemplates(toArray(pluginConfig.mod_loaders), {
|
|
108
|
-
nextRelease,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else if (env.MODRINTH_MOD_LOADERS) {
|
|
112
|
-
modLoaders = env.MODRINTH_MOD_LOADERS.split(',').map((s) => s.trim());
|
|
113
|
-
}
|
|
114
|
-
else if (env.MOD_LOADERS) {
|
|
115
|
-
modLoaders = env.MOD_LOADERS.split(',').map((s) => s.trim());
|
|
116
|
-
}
|
|
117
|
-
if (modLoaders) {
|
|
118
|
-
versionData.loaders = modLoaders;
|
|
119
|
-
}
|
|
120
|
-
if (pluginConfig.release_type) {
|
|
121
|
-
versionData.version_type = pluginConfig.release_type;
|
|
122
|
-
}
|
|
123
|
-
if (modrinth?.dependencies && modrinth.dependencies.length > 0) {
|
|
124
|
-
versionData.dependencies = modrinth.dependencies;
|
|
125
|
-
}
|
|
126
|
-
if (modrinth?.featured !== undefined) {
|
|
127
|
-
versionData.featured = modrinth.featured;
|
|
128
|
-
}
|
|
129
|
-
if (modrinth?.status) {
|
|
130
|
-
versionData.status = modrinth.status;
|
|
131
|
-
}
|
|
132
|
-
if (modrinth?.requested_status) {
|
|
133
|
-
versionData.requested_status = modrinth.requested_status;
|
|
134
|
-
}
|
|
135
|
-
// 只有当 finalPrimaryFile 存在时才添加 primary_file 字段
|
|
136
|
-
if (finalPrimaryFile) {
|
|
137
|
-
versionData.primary_file = finalPrimaryFile;
|
|
138
|
-
}
|
|
139
|
-
// 添加版本信息作为 JSON
|
|
140
|
-
form.append('data', versionData);
|
|
141
|
-
// 发送版本创建请求
|
|
142
|
-
try {
|
|
143
|
-
const versionResponse = await axios.post('https://api.modrinth.com/v2/version', form, {
|
|
144
|
-
headers: {
|
|
145
|
-
...form.getHeaders(),
|
|
146
|
-
Authorization: token,
|
|
147
|
-
},
|
|
148
|
-
validateStatus: (status) => status < 500, // 仅拒绝5xx错误
|
|
149
|
-
});
|
|
150
|
-
// 检查响应状态码
|
|
151
|
-
if (versionResponse.status === 200) {
|
|
152
|
-
// 成功
|
|
153
|
-
logger.log(`Successfully published to Modrinth: ${versionResponse.data.name || versionResponse.data.id}`);
|
|
154
|
-
return versionResponse.data.id;
|
|
155
|
-
}
|
|
156
|
-
else if (versionResponse.status === 400 ||
|
|
157
|
-
versionResponse.status === 401) {
|
|
158
|
-
// 处理客户端错误
|
|
159
|
-
const data = versionResponse.data;
|
|
160
|
-
logger.error(data);
|
|
161
|
-
if (data && data.error && data.description) {
|
|
162
|
-
logger.error(`Modrinth API Error (${versionResponse.status}): ${data.error} - ${data.description}`);
|
|
163
|
-
throw new Error(`Modrinth发布失败: ${data.error} - ${data.description}`);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
logger.error(`Modrinth API Error (${versionResponse.status}): ${JSON.stringify(data)}`);
|
|
167
|
-
throw new Error(`Modrinth发布失败 (状态码: ${versionResponse.status}): ${JSON.stringify(data)}`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
// 其他错误状态码
|
|
172
|
-
const data = versionResponse.data;
|
|
173
|
-
logger.error(`Modrinth API Error (${versionResponse.status}): ${JSON.stringify(data)}`);
|
|
174
|
-
throw new Error(`Modrinth发布失败 (状态码: ${versionResponse.status}): ${JSON.stringify(data)}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (error) {
|
|
178
|
-
if (error.response) {
|
|
179
|
-
// 已经在上面处理过
|
|
180
|
-
throw error;
|
|
181
|
-
}
|
|
182
|
-
else if (error.request) {
|
|
183
|
-
// 请求已发送但未收到响应
|
|
184
|
-
logger.error('Modrinth API 请求失败,未收到响应');
|
|
185
|
-
throw new Error('Modrinth发布失败: 未收到服务器响应');
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
// 请求配置出错
|
|
189
|
-
logger.error('Modrinth API 请求配置错误:', error.message);
|
|
190
|
-
throw new Error(`Modrinth发布失败: ${error.message}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* 为 Modrinth 查找文件并确定主要文件
|
|
196
|
-
*/
|
|
197
|
-
async function findModrinthFiles(pluginConfig, context) {
|
|
198
|
-
const { env, logger } = context;
|
|
199
|
-
// 获取 Modrinth 专用的 glob 配置,如果没有则使用全局配置
|
|
200
|
-
const modrinthGlob = resolveMultipleTemplate([
|
|
201
|
-
pluginConfig.modrinth?.glob,
|
|
202
|
-
pluginConfig.glob,
|
|
203
|
-
env.MODRINTH_GLOB,
|
|
204
|
-
env.GLOB,
|
|
205
|
-
], {
|
|
206
|
-
nextRelease: context.nextRelease,
|
|
44
|
+
const displayName = resolveAndRenderTemplate([modrinth?.display_name, pluginConfig.display_name], {
|
|
45
|
+
nextRelease,
|
|
46
|
+
...strategy,
|
|
207
47
|
});
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
let primaryFile = undefined;
|
|
213
|
-
const primaryPatterns = resolveMultipleTemplate([
|
|
214
|
-
pluginConfig.modrinth?.primary_file_glob,
|
|
215
|
-
env.MODRINTH_PRIMARY_FILE_GLOB,
|
|
216
|
-
], {
|
|
217
|
-
nextRelease: context.nextRelease,
|
|
48
|
+
versionData.name = displayName || nextRelease.name;
|
|
49
|
+
const versionNumber = resolveAndRenderTemplate([modrinth?.version_number], {
|
|
50
|
+
nextRelease,
|
|
51
|
+
...strategy,
|
|
218
52
|
});
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
53
|
+
versionData.version_number = versionNumber || nextRelease.version;
|
|
54
|
+
const gameVersions = resolveAndRenderTemplates([modrinth?.game_versions, pluginConfig.game_versions], {
|
|
55
|
+
nextRelease,
|
|
56
|
+
...strategy,
|
|
57
|
+
});
|
|
58
|
+
versionData.game_versions = gameVersions || [];
|
|
59
|
+
const modLoaders = resolveAndRenderTemplates([modrinth?.mod_loaders, pluginConfig.mod_loaders], {
|
|
60
|
+
nextRelease,
|
|
61
|
+
...strategy,
|
|
62
|
+
});
|
|
63
|
+
versionData.mod_loaders = modLoaders || [];
|
|
64
|
+
form.append('data', versionData);
|
|
65
|
+
const versionResponse = await axios.post('https://api.modrinth.com/v2/version', form, {
|
|
66
|
+
headers: {
|
|
67
|
+
...form.getHeaders(),
|
|
68
|
+
Authorization: token,
|
|
69
|
+
},
|
|
70
|
+
validateStatus: (status) => status < 500,
|
|
71
|
+
});
|
|
72
|
+
const resData = versionResponse.data;
|
|
73
|
+
if (versionResponse.status === 200) {
|
|
74
|
+
logger.log(`Successfully published to Modrinth: ${resData.project_id} (File ID: ${resData.file_id})`);
|
|
75
|
+
return versionResponse.data.id;
|
|
243
76
|
}
|
|
244
|
-
else if (
|
|
245
|
-
|
|
246
|
-
throw new Error(`
|
|
77
|
+
else if (versionResponse.status === 400 ||
|
|
78
|
+
versionResponse.status === 401) {
|
|
79
|
+
throw new Error(`Failed to publish to Modrinth (${versionResponse.status}): ${resData}`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error(`Failed to publish to Modrinth (${versionResponse.status}): ${resData}`);
|
|
247
83
|
}
|
|
248
|
-
// 当只有一个文件时,不设置 primaryFile,让网站做决定
|
|
249
|
-
return { files: jarFiles, primaryFile };
|
|
250
84
|
}
|
|
251
85
|
//# sourceMappingURL=modrinth.js.map
|
package/dist/modrinth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modrinth.js","sourceRoot":"","sources":["../src/modrinth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"modrinth.js","sourceRoot":"","sources":["../src/modrinth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACH,wBAAwB,EACxB,yBAAyB,GAC5B,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,YAA0B,EAC1B,OAAuB,EACvB,QAAgC;IAEhC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,EAAE,QAAQ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IAAI,EACJ;QACI,OAAO,EAAE;YACL,GAAG,IAAI,CAAC,UAAU,EAAE;YACpB,aAAa,EAAE,KAAK;SACvB;QACD,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,GAAG;KAC3C,CACJ,CAAC;IAEF,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC;IAErC,IAAI,eAAe,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CACN,uCAAuC,OAAO,CAAC,UAAU,cAAc,OAAO,CAAC,OAAO,GAAG,CAC5F,CAAC;QACF,OAAO,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IACnC,CAAC;SAAM,IACH,eAAe,CAAC,MAAM,KAAK,GAAG;QAC9B,eAAe,CAAC,MAAM,KAAK,GAAG,EAChC,CAAC;QACC,MAAM,IAAI,KAAK,CACX,kCAAkC,eAAe,CAAC,MAAM,MAAM,OAAO,EAAE,CAC1E,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CACX,kCAAkC,eAAe,CAAC,MAAM,MAAM,OAAO,EAAE,CAC1E,CAAC;IACN,CAAC;AACL,CAAC"}
|
package/dist/prepare.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PrepareContext } from 'semantic-release';
|
|
2
|
+
import { PluginConfig } from './definitions/plugin-config';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Get CurseForge game version IDs based on the plugin configuration.
|
|
5
5
|
*/
|
|
6
|
-
export declare function getCurseForgeGameVersionIds(apiToken: string, pluginConfig:
|
|
7
|
-
/**
|
|
8
|
-
* 比较器:忽略名称中的 "-Snapshot" 后缀
|
|
9
|
-
*/
|
|
10
|
-
export declare const CURSEFORGE_GAME_VERSION_SNAPSHOT_NAME_COMPARER: (a: string, b: string) => boolean;
|
|
6
|
+
export declare function getCurseForgeGameVersionIds(apiToken: string, pluginConfig: PluginConfig, context: PrepareContext): Promise<number[]>;
|
|
11
7
|
//# sourceMappingURL=prepare.d.ts.map
|
package/dist/prepare.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D;;GAEG;AACH,wBAAsB,2BAA2B,CAC7C,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkEnB"}
|
package/dist/prepare.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { BUKKIT_GAME_VERSION_TYPE, } from './definitions/curseforge.js';
|
|
3
|
-
import { getCurseForgeModLoaders
|
|
3
|
+
import { getCurseForgeModLoaders } from './utils/platform/curseforge-utils';
|
|
4
|
+
import { toArray } from './utils/utils.js';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Get CurseForge game version IDs based on the plugin configuration.
|
|
6
7
|
*/
|
|
7
|
-
export async function getCurseForgeGameVersionIds(apiToken, pluginConfig,
|
|
8
|
+
export async function getCurseForgeGameVersionIds(apiToken, pluginConfig, context) {
|
|
9
|
+
const { nextRelease } = context;
|
|
8
10
|
const curseforgeConfig = pluginConfig.curseforge;
|
|
9
|
-
const modLoaders = getCurseForgeModLoaders(pluginConfig,
|
|
10
|
-
const javaVersions = toArray(curseforgeConfig.java_versions
|
|
11
|
-
const gameVersions = toArray(curseforgeConfig.game_versions || pluginConfig.game_versions
|
|
12
|
-
const pluginGameVersions = toArray(curseforgeConfig.game_versions_for_plugins
|
|
13
|
-
const addonGameVersions = toArray(curseforgeConfig.game_versions_for_addon
|
|
14
|
-
const environments = toArray(curseforgeConfig.environments
|
|
11
|
+
const modLoaders = getCurseForgeModLoaders(pluginConfig, nextRelease);
|
|
12
|
+
const javaVersions = toArray(curseforgeConfig.java_versions);
|
|
13
|
+
const gameVersions = toArray(curseforgeConfig.game_versions || pluginConfig.game_versions);
|
|
14
|
+
const pluginGameVersions = toArray(curseforgeConfig.game_versions_for_plugins);
|
|
15
|
+
const addonGameVersions = toArray(curseforgeConfig.game_versions_for_addon);
|
|
16
|
+
const environments = toArray(curseforgeConfig.environments);
|
|
15
17
|
const map = await createCurseForgeGameVersionMap(apiToken);
|
|
16
18
|
const javaVersionNames = javaVersions.map((javaVersion) => `Java ${javaVersion}`);
|
|
17
19
|
// TODO: Modrinth 和 CurseForge 的游戏版本命名格式转化,以 Modrinth 为基准
|
|
18
20
|
// const gameVersionNames = gameVersions.map(x => formatCurseForgeGameVersionSnapshot(x));
|
|
19
|
-
|
|
20
|
-
const gameVersionIds = findCurseForgeGameVersionIdsByNames(map.game_versions, gameVersions, undefined, CURSEFORGE_GAME_VERSION_SNAPSHOT_NAME_COMPARER);
|
|
21
|
+
const gameVersionIds = findCurseForgeGameVersionIdsByNames(map.game_versions, gameVersions);
|
|
21
22
|
const loaderIds = findCurseForgeGameVersionIdsByNames(map.loaders, modLoaders);
|
|
22
23
|
const javaIds = findCurseForgeGameVersionIdsByNames(map.java_versions, javaVersionNames);
|
|
23
|
-
// 插件的游戏版本名称
|
|
24
24
|
const pluginGameVersionIds = findCurseForgeGameVersionIdsByNames(map.game_versions_for_plugins, pluginGameVersions);
|
|
25
|
-
// 附加组件的游戏版本名称
|
|
26
25
|
const addonGameVersionIds = findCurseForgeGameVersionIdsByNames(map.game_versions_for_addons, addonGameVersions);
|
|
27
26
|
const environmentIds = findCurseForgeGameVersionIdsByNames(map.environments, environments);
|
|
28
27
|
const curseforgeGameVersionIds = [];
|
|
29
28
|
curseforgeGameVersionIds.push(...gameVersionIds, ...loaderIds, ...javaIds, ...pluginGameVersionIds, ...addonGameVersionIds, ...environmentIds);
|
|
30
29
|
return curseforgeGameVersionIds;
|
|
31
30
|
}
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Create a CurseForge game version map by categorizing game versions based on their type names.
|
|
33
|
+
*/
|
|
33
34
|
async function createCurseForgeGameVersionMap(apiToken) {
|
|
34
35
|
const { versions, types } = await fetchCurseForgeGameVersionInfo(apiToken);
|
|
35
36
|
return {
|
|
@@ -41,11 +42,9 @@ async function createCurseForgeGameVersionMap(apiToken) {
|
|
|
41
42
|
environments: filterGameVersionsByTypeName(versions, types, 'environment'),
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
// 获取 CurseForge 游戏版本和版本类型信息
|
|
45
|
+
/**
|
|
46
|
+
* Fetch CurseForge game version and version type information.
|
|
47
|
+
*/
|
|
49
48
|
async function fetchCurseForgeGameVersionInfo(apiToken) {
|
|
50
49
|
const gameVersionsRes = await axios.get('https://minecraft.curseforge.com/api/game/versions', {
|
|
51
50
|
headers: {
|
|
@@ -59,30 +58,30 @@ async function fetchCurseForgeGameVersionInfo(apiToken) {
|
|
|
59
58
|
});
|
|
60
59
|
const gameVersionTypes = gameVersionTypesRes.data;
|
|
61
60
|
if (!gameVersionTypes.some((x) => x.id === BUKKIT_GAME_VERSION_TYPE.id)) {
|
|
62
|
-
gameVersionTypes.
|
|
61
|
+
gameVersionTypes.push(BUKKIT_GAME_VERSION_TYPE);
|
|
63
62
|
}
|
|
64
63
|
return {
|
|
65
64
|
versions: gameVersionsRes.data,
|
|
66
65
|
types: gameVersionTypes,
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Filter game versions by their type name prefix.
|
|
70
|
+
*/
|
|
71
|
+
function filterGameVersionsByTypeName(versions, types, typeName) {
|
|
72
|
+
const filteredTypes = types.filter((x) => x.slug.startsWith(typeName));
|
|
73
|
+
return versions.filter((v) => filteredTypes.some((t) => t.id === v.gameVersionTypeID));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Find CurseForge game version IDs by their names using a custom comparer.
|
|
77
|
+
*/
|
|
78
|
+
function findCurseForgeGameVersionIdsByNames(versions, names, comparer = (a, b) => a.toLowerCase() === b.toLowerCase()) {
|
|
70
79
|
const result = [];
|
|
71
80
|
for (const name of names) {
|
|
72
81
|
let version = versions.find((v) => comparer(v.name, name));
|
|
73
|
-
if (!version && fallbackComparer) {
|
|
74
|
-
version = versions.find((v) => fallbackComparer(v.name, name));
|
|
75
|
-
}
|
|
76
82
|
if (version)
|
|
77
83
|
result.push(version.id);
|
|
78
84
|
}
|
|
79
|
-
return
|
|
85
|
+
return result;
|
|
80
86
|
}
|
|
81
|
-
/**
|
|
82
|
-
* 比较器:忽略名称中的 "-Snapshot" 后缀
|
|
83
|
-
*/
|
|
84
|
-
export const CURSEFORGE_GAME_VERSION_SNAPSHOT_NAME_COMPARER = (a, b) => {
|
|
85
|
-
const normalize = (s) => s?.replace(/-snapshot$/i, '') ?? '';
|
|
86
|
-
return normalize(a).toLowerCase() === normalize(b).toLowerCase();
|
|
87
|
-
};
|
|
88
87
|
//# sourceMappingURL=prepare.js.map
|
package/dist/prepare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,wBAAwB,GAI3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../src/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAA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,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,OAAO;YAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PublishContext } from 'semantic-release';
|
|
2
|
+
/**
|
|
3
|
+
* Find files based on provided glob patterns.
|
|
4
|
+
*/
|
|
5
|
+
export declare function findFilesByGlob(patterns: string[] | undefined, context: PublishContext): Promise<string[]>;
|
|
6
|
+
//# sourceMappingURL=glob-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob-utils.d.ts","sourceRoot":"","sources":["../../src/utils/glob-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,wBAAsB,eAAe,CACjC,QAAQ,EAAE,MAAM,EAAE,YAGjB,EACD,OAAO,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBnB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { glob } from 'glob';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Find files based on provided glob patterns.
|
|
5
|
+
*/
|
|
6
|
+
export async function findFilesByGlob(patterns = [
|
|
7
|
+
'build/libs/!(*-@(dev|sources|javadoc)).jar',
|
|
8
|
+
'build/libs/*-@(dev|sources|javadoc).jar',
|
|
9
|
+
], context) {
|
|
10
|
+
const { logger, cwd } = context;
|
|
11
|
+
const allFiles = [];
|
|
12
|
+
for (const pattern of patterns) {
|
|
13
|
+
logger.log(`Searching for files with pattern: ${pattern}`);
|
|
14
|
+
const files = await glob(pattern, {
|
|
15
|
+
cwd,
|
|
16
|
+
nodir: true,
|
|
17
|
+
});
|
|
18
|
+
allFiles.push(...files);
|
|
19
|
+
}
|
|
20
|
+
// 转换为绝对路径
|
|
21
|
+
const files = allFiles.map((file) => resolve(cwd, file));
|
|
22
|
+
if (files.length === 0) {
|
|
23
|
+
throw new Error(`No files found matching patterns: ${patterns.join(', ')}`);
|
|
24
|
+
}
|
|
25
|
+
return files;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=glob-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob-utils.js","sourceRoot":"","sources":["../../src/utils/glob-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,WAAqB;IACjB,4CAA4C;IAC5C,yCAAyC;CAC5C,EACD,OAAuB;IAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEhC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;YAC9B,GAAG;YACH,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU;IACV,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAE1D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACX,qCAAqC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7D,CAAC;IACN,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NextRelease } from 'semantic-release';
|
|
2
|
+
import { PluginConfig } from '../../definitions/plugin-config';
|
|
3
|
+
export declare function getCurseForgeModLoaders(pluginConfig: PluginConfig, nextRelease: NextRelease): string[];
|
|
4
|
+
//# sourceMappingURL=curseforge-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curseforge-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/platform/curseforge-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAG/D,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,GACzB,MAAM,EAAE,CASV"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { resolveAndRenderTemplates } from '../template-utils';
|
|
2
|
+
export function getCurseForgeModLoaders(pluginConfig, nextRelease) {
|
|
3
|
+
return (resolveAndRenderTemplates([pluginConfig.curseforge?.mod_loaders, pluginConfig.mod_loaders], {
|
|
4
|
+
nextRelease,
|
|
5
|
+
}) || []);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=curseforge-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curseforge-utils.js","sourceRoot":"","sources":["../../../src/utils/platform/curseforge-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,UAAU,uBAAuB,CACnC,YAA0B,EAC1B,WAAwB;IAExB,OAAO,CACH,yBAAyB,CACrB,CAAC,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC,EAChE;QACI,WAAW;KACd,CACJ,IAAI,EAAE,CACV,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PublishContext } from 'semantic-release';
|
|
2
|
+
import { PluginConfig } from '../../definitions/plugin-config';
|
|
3
|
+
/**
|
|
4
|
+
* Find files and primary file for publishing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findFilesAndPrimaryFile(pluginConfig: PluginConfig, context: PublishContext, strategy: Record<string, string>): Promise<{
|
|
7
|
+
files: string[];
|
|
8
|
+
primaryFile: string;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/platform/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D;;GAEG;AACH,wBAAsB,uBAAuB,CACzC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAqEnD"}
|