cyclops-infobook-html 5.1.0 → 5.2.1
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/README.md +12 -12
- package/bin/compress-icons.js +42 -7
- package/bin/convert-pom-to-modpack.d.ts +2 -0
- package/bin/convert-pom-to-modpack.js +96 -0
- package/bin/generate-icons.js +50 -15
- package/bin/generate-infobook-html.js +46 -10
- package/bin/generate-mod-metadata.js +52 -14
- package/index.d.ts +25 -25
- package/lib/icon/IconsCompressor.js +43 -12
- package/lib/icon/IconsGenerator.d.ts +42 -20
- package/lib/icon/IconsGenerator.js +156 -70
- package/lib/infobook/FileWriter.d.ts +3 -3
- package/lib/infobook/FileWriter.js +5 -5
- package/lib/infobook/IFileWriter.d.ts +2 -2
- package/lib/infobook/IInfoAppendix.d.ts +3 -3
- package/lib/infobook/IInfoBook.d.ts +2 -4
- package/lib/infobook/IInfoSection.d.ts +1 -1
- package/lib/infobook/IInfobookPlugin.d.ts +5 -5
- package/lib/infobook/InfoBookInitializer.d.ts +7 -9
- package/lib/infobook/InfoBookInitializer.js +1 -1
- package/lib/infobook/appendix/IInfoBookAppendixHandler.d.ts +2 -2
- package/lib/infobook/appendix/InfoBookAppendixAd.d.ts +3 -3
- package/lib/infobook/appendix/InfoBookAppendixAd.js +7 -2
- package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.d.ts +12 -14
- package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.js +41 -8
- package/lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards.d.ts +3 -3
- package/lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards.js +5 -4
- package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.d.ts +6 -5
- package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.js +4 -3
- package/lib/infobook/appendix/InfoBookAppendixHandlerImage.d.ts +3 -3
- package/lib/infobook/appendix/InfoBookAppendixHandlerImage.js +4 -4
- package/lib/infobook/appendix/InfoBookAppendixHandlerKeybinding.d.ts +3 -3
- package/lib/infobook/appendix/InfoBookAppendixHandlerKeybinding.js +3 -2
- package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.d.ts +6 -5
- package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.js +3 -2
- package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.d.ts +3 -3
- package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.js +4 -5
- package/lib/infobook/appendix/InfoBookAppendixTagIndex.d.ts +4 -4
- package/lib/infobook/appendix/InfoBookAppendixTagIndex.js +2 -1
- package/lib/modloader/ModLoader.d.ts +13 -2
- package/lib/modloader/ModLoader.js +164 -69
- package/lib/modloader/PomConverter.d.ts +28 -0
- package/lib/modloader/PomConverter.js +194 -0
- package/lib/parse/XmlInfoBookParser.d.ts +5 -7
- package/lib/parse/XmlInfoBookParser.js +42 -9
- package/lib/resource/ResourceHandler.d.ts +7 -13
- package/lib/resource/ResourceHandler.js +16 -11
- package/lib/resource/ResourceLoader.d.ts +4 -5
- package/lib/resource/ResourceLoader.js +35 -33
- package/lib/serialize/HtmlInfoBookSerializer.d.ts +10 -16
- package/lib/serialize/HtmlInfoBookSerializer.js +83 -80
- package/package.json +33 -27
|
@@ -8,14 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.HtmlInfoBookSerializer = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
16
|
+
const node_fs_1 = require("node:fs");
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
const node_util_1 = require("node:util");
|
|
19
|
+
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
15
20
|
const ncp_1 = require("ncp");
|
|
16
|
-
const path_1 = require("path");
|
|
17
21
|
const pug_1 = require("pug");
|
|
18
|
-
const util_1 = require("util");
|
|
19
22
|
const InfoBookAppendixAd_1 = require("../infobook/appendix/InfoBookAppendixAd");
|
|
20
23
|
const FileWriter_1 = require("../infobook/FileWriter");
|
|
21
24
|
/**
|
|
@@ -23,20 +26,20 @@ const FileWriter_1 = require("../infobook/FileWriter");
|
|
|
23
26
|
*/
|
|
24
27
|
class HtmlInfoBookSerializer {
|
|
25
28
|
constructor() {
|
|
26
|
-
this.templateIndex = (0, pug_1.compileFile)(__dirname
|
|
27
|
-
this.templateSection = (0, pug_1.compileFile)(__dirname
|
|
28
|
-
this.appendixWrapper = (0, pug_1.compileFile)(__dirname
|
|
29
|
-
this.templateItem = (0, pug_1.compileFile)(__dirname
|
|
29
|
+
this.templateIndex = (0, pug_1.compileFile)((0, node_path_1.join)(__dirname, '..', '..', 'template', 'index.pug'));
|
|
30
|
+
this.templateSection = (0, pug_1.compileFile)((0, node_path_1.join)(__dirname, '..', '..', 'template', 'section.pug'));
|
|
31
|
+
this.appendixWrapper = (0, pug_1.compileFile)((0, node_path_1.join)(__dirname, '..', '..', 'template', 'appendix', 'appendix_base.pug'));
|
|
32
|
+
this.templateItem = (0, pug_1.compileFile)((0, node_path_1.join)(__dirname, '..', '..', 'template', 'appendix', 'item.pug'));
|
|
30
33
|
}
|
|
31
34
|
serialize(infobook, context, assetsPaths) {
|
|
32
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
36
|
context = Object.assign(Object.assign({}, context), { basePath: context.path, breadcrumbs: [] });
|
|
34
37
|
this.fileWriter = new FileWriter_1.FileWriter(context);
|
|
35
38
|
yield this.ensureDirExists(context.path);
|
|
36
|
-
yield this.ensureDirExists((0,
|
|
37
|
-
yield this.ensureDirExists((0,
|
|
39
|
+
yield this.ensureDirExists((0, node_path_1.join)(context.path, 'assets'));
|
|
40
|
+
yield this.ensureDirExists((0, node_path_1.join)(context.path, 'assets', 'icon'));
|
|
38
41
|
// Create a .nojekyll file to ensure _lang directories are served via GitHub pages.
|
|
39
|
-
yield
|
|
42
|
+
yield node_fs_1.promises.writeFile((0, node_path_1.join)(context.path, '.nojekyll'), '');
|
|
40
43
|
// Serialize sections in all languages
|
|
41
44
|
for (const language of context.resourceHandler.getLanguages()) {
|
|
42
45
|
const langPath = this.getLanguagePath(language, context.path);
|
|
@@ -45,9 +48,9 @@ class HtmlInfoBookSerializer {
|
|
|
45
48
|
yield this.serializeSectionFiles(infobook, context, language, langPath, sectionIndex);
|
|
46
49
|
}
|
|
47
50
|
// Serialize assets
|
|
48
|
-
yield (0,
|
|
51
|
+
yield (0, node_util_1.promisify)(ncp_1.ncp)((0, node_path_1.join)(__dirname, '..', '..', 'assets'), (0, node_path_1.join)(context.path, 'assets'));
|
|
49
52
|
for (const assetsPath of assetsPaths) {
|
|
50
|
-
yield (0,
|
|
53
|
+
yield (0, node_util_1.promisify)(ncp_1.ncp)(assetsPath, (0, node_path_1.join)(context.path, 'assets'));
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
}
|
|
@@ -62,11 +65,11 @@ class HtmlInfoBookSerializer {
|
|
|
62
65
|
yield this.serializeSection(infobook.rootSection, Object.assign(Object.assign({}, contextRoot), { language, path: langPath }), (_a) => __awaiter(this, [_a], void 0, function* ({ index, section, sectionTitle, fileUrl, breadcrumbs }) {
|
|
63
66
|
if (!index) {
|
|
64
67
|
sectionIndex.urlIndex[fileUrl] = pageIndex++;
|
|
65
|
-
const name = breadcrumbs.slice(1).map(
|
|
68
|
+
const name = breadcrumbs.slice(1).map(b => b.name).join(' / ');
|
|
66
69
|
sectionIndex.linkedPagesList.push({ name, url: fileUrl });
|
|
67
70
|
for (let tag of section.tags) {
|
|
68
|
-
if (tag.
|
|
69
|
-
tag = contextRoot.modId
|
|
71
|
+
if (!tag.includes(':')) {
|
|
72
|
+
tag = `${contextRoot.modId}:${tag}`;
|
|
70
73
|
}
|
|
71
74
|
sectionIndex.tags[tag] = fileUrl;
|
|
72
75
|
}
|
|
@@ -81,25 +84,27 @@ class HtmlInfoBookSerializer {
|
|
|
81
84
|
// Create links to this page in other languages
|
|
82
85
|
const languages = [];
|
|
83
86
|
for (const name of contextRoot.resourceHandler.getLanguages()) {
|
|
84
|
-
const baseFilePath = filePath.
|
|
85
|
-
const languageFilePath = (0,
|
|
87
|
+
const baseFilePath = filePath.slice((0, node_path_1.join)(contextRoot.basePath, this.getLanguagePath(language)).length);
|
|
88
|
+
const languageFilePath = (0, node_path_1.join)(contextRoot.basePath, this.getLanguagePath(name), baseFilePath);
|
|
86
89
|
const url = this.filePathToUrl(languageFilePath, contextRoot.basePath, context.baseUrl);
|
|
87
90
|
languages.push({ name, url });
|
|
88
91
|
}
|
|
89
92
|
if (index) {
|
|
90
93
|
// Create index file
|
|
91
|
-
const fileContents = this.templateIndex(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map(
|
|
94
|
+
const fileContents = this.templateIndex(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map(g => g(context)).join(''), languages,
|
|
92
95
|
sectionTitle,
|
|
93
96
|
subSectionDatas }));
|
|
94
|
-
yield
|
|
97
|
+
yield node_fs_1.promises.writeFile(filePath, fileContents);
|
|
95
98
|
}
|
|
96
99
|
else {
|
|
97
100
|
// Determine next/previous page based on the index
|
|
98
101
|
const pageIndex = sectionIndex.urlIndex[fileUrl];
|
|
99
|
-
const nextPage = pageIndex < sectionIndex.linkedPagesList.length
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const nextPage = pageIndex < sectionIndex.linkedPagesList.length ?
|
|
103
|
+
sectionIndex.linkedPagesList[pageIndex + 1] :
|
|
104
|
+
null;
|
|
105
|
+
const previousPage = pageIndex > 0 ?
|
|
106
|
+
sectionIndex.linkedPagesList[pageIndex - 1] :
|
|
107
|
+
null;
|
|
103
108
|
// Prepend ad appendix if enabled
|
|
104
109
|
const appendices = section.appendix;
|
|
105
110
|
if (context.googleAdsense && language === 'en_us') {
|
|
@@ -121,13 +126,13 @@ class HtmlInfoBookSerializer {
|
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
128
|
// Create leaf file
|
|
124
|
-
const fileContents = this.templateSection(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map(
|
|
129
|
+
const fileContents = this.templateSection(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map(g => g(context)).join(''), languages,
|
|
125
130
|
nextPage,
|
|
126
131
|
previousPage,
|
|
127
132
|
sectionAppendices, sectionParagraphs: section.paragraphTranslationKeys
|
|
128
|
-
.map(
|
|
129
|
-
.map(
|
|
130
|
-
yield
|
|
133
|
+
.map(key => context.resourceHandler.getTranslation(key, context.language))
|
|
134
|
+
.map(value => this.formatString(value)), sectionTitle }));
|
|
135
|
+
yield node_fs_1.promises.writeFile(filePath, fileContents);
|
|
131
136
|
}
|
|
132
137
|
}));
|
|
133
138
|
});
|
|
@@ -136,47 +141,46 @@ class HtmlInfoBookSerializer {
|
|
|
136
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
142
|
const sectionTitle = this.formatString(context.resourceHandler
|
|
138
143
|
.getTranslation(section.nameTranslationKey, context.language));
|
|
139
|
-
const breadcrumbs = context.breadcrumbs
|
|
144
|
+
const breadcrumbs = [...context.breadcrumbs, { name: sectionTitle }];
|
|
140
145
|
// Go in a subfolder when we are handling a different mod
|
|
141
146
|
if (section.modId !== context.modId) {
|
|
142
|
-
yield this.ensureDirExists((0,
|
|
143
|
-
context = Object.assign(Object.assign({}, context), { modId: section.modId, path: (0,
|
|
147
|
+
yield this.ensureDirExists((0, node_path_1.join)(context.path, section.modId));
|
|
148
|
+
context = Object.assign(Object.assign({}, context), { modId: section.modId, path: (0, node_path_1.join)(context.path, section.modId) });
|
|
144
149
|
}
|
|
145
150
|
if (section.subSections && section.subSections.length > 0) {
|
|
146
151
|
// Navigation section
|
|
147
152
|
// Serialize subsections
|
|
148
153
|
const subSectionDatas = [];
|
|
149
154
|
const fileUrl = this.filePathToUrl(context.path, context.basePath, context.baseUrl);
|
|
150
|
-
const subBreadcrumbs = context.breadcrumbs
|
|
155
|
+
const subBreadcrumbs = [...context.breadcrumbs, {
|
|
151
156
|
name: sectionTitle,
|
|
152
157
|
url: fileUrl,
|
|
153
|
-
}]
|
|
158
|
+
}];
|
|
154
159
|
for (const subSection of section.subSections) {
|
|
155
|
-
const subSectionData = yield this.serializeSection(subSection, Object.assign(Object.assign({}, context), { breadcrumbs: subBreadcrumbs, path: (0,
|
|
156
|
-
.
|
|
160
|
+
const subSectionData = yield this.serializeSection(subSection, Object.assign(Object.assign({}, context), { breadcrumbs: subBreadcrumbs, path: (0, node_path_1.join)(context.path, subSection.nameTranslationKey
|
|
161
|
+
.slice(subSection.nameTranslationKey.lastIndexOf('.') + 1)), root: false }), onSection);
|
|
157
162
|
subSectionDatas.push(Object.assign(Object.assign({}, subSectionData), { url: this.filePathToUrl(subSectionData.filePath, context.basePath, context.baseUrl) }));
|
|
158
163
|
}
|
|
159
|
-
const filePath = (0,
|
|
164
|
+
const filePath = (0, node_path_1.join)(context.path, 'index.html');
|
|
160
165
|
yield onSection({ index: true, breadcrumbs, context, sectionTitle, section, subSectionDatas, filePath, fileUrl });
|
|
161
166
|
return { filePath: context.path, sectionTitle };
|
|
162
167
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return { filePath, sectionTitle };
|
|
172
|
-
}
|
|
168
|
+
// Leaf section
|
|
169
|
+
const directory = context.path.slice(0, Math.max(0, context.path.lastIndexOf('/')));
|
|
170
|
+
yield this.ensureDirExists(directory);
|
|
171
|
+
// Handle leaf file
|
|
172
|
+
const filePath = `${context.path}.html`;
|
|
173
|
+
const fileUrl = this.filePathToUrl(filePath, context.basePath, context.baseUrl);
|
|
174
|
+
yield onSection({ index: false, breadcrumbs, context, sectionTitle, section, subSectionDatas: [], filePath, fileUrl });
|
|
175
|
+
return { filePath, sectionTitle };
|
|
173
176
|
});
|
|
174
177
|
}
|
|
175
178
|
createResourceLink(resourceHandler, context, resource, translationKey) {
|
|
176
179
|
let link;
|
|
177
180
|
let linkTarget;
|
|
178
181
|
if (resource.startsWith('minecraft:')) {
|
|
179
|
-
|
|
182
|
+
const translated = resourceHandler.getTranslation(translationKey, 'en_us');
|
|
183
|
+
link = `https://minecraft.gamepedia.com/${translated.replaceAll(' ', '_')}`;
|
|
180
184
|
linkTarget = '_blank';
|
|
181
185
|
}
|
|
182
186
|
else if (context.sectionIndex.tags[resource]) {
|
|
@@ -193,7 +197,7 @@ class HtmlInfoBookSerializer {
|
|
|
193
197
|
if (!icon) {
|
|
194
198
|
throw new Error(`Could not find an icon for item ${JSON.stringify(item)}`);
|
|
195
199
|
}
|
|
196
|
-
const iconUrl = yield fileWriter.write(
|
|
200
|
+
const iconUrl = yield fileWriter.write(`icon/${(0, node_path_1.basename)(icon)}`, () => (0, node_fs_1.createReadStream)(icon));
|
|
197
201
|
const key = resourceHandler.getItemTranslationKey(item);
|
|
198
202
|
if (!key) {
|
|
199
203
|
throw new Error(`Could not find translation key for item ${JSON.stringify(item)}`);
|
|
@@ -209,7 +213,7 @@ class HtmlInfoBookSerializer {
|
|
|
209
213
|
if (!icon) {
|
|
210
214
|
throw new Error(`Could not find an icon for fluid ${JSON.stringify(fluid)}`);
|
|
211
215
|
}
|
|
212
|
-
const iconUrl = yield fileWriter.write(
|
|
216
|
+
const iconUrl = yield fileWriter.write(`icon/${(0, node_path_1.basename)(icon)}`, () => (0, node_fs_1.createReadStream)(icon));
|
|
213
217
|
const key = resourceHandler.getFluidTranslationKey(fluid);
|
|
214
218
|
if (!key) {
|
|
215
219
|
throw new Error(`Could not find translation key for fluid ${JSON.stringify(fluid)}`);
|
|
@@ -222,9 +226,8 @@ class HtmlInfoBookSerializer {
|
|
|
222
226
|
tagFluid(context, fluidName) {
|
|
223
227
|
return fluidName;
|
|
224
228
|
}
|
|
225
|
-
getLanguagePath(language, path) {
|
|
226
|
-
path
|
|
227
|
-
return language === 'en_us' ? path : (0, path_1.join)(path, '_lang', language);
|
|
229
|
+
getLanguagePath(language, path = '') {
|
|
230
|
+
return language === 'en_us' ? path : (0, node_path_1.join)(path, '_lang', language);
|
|
228
231
|
}
|
|
229
232
|
/**
|
|
230
233
|
* Convert Minecraft formatting codes to HTML formats.
|
|
@@ -236,40 +239,40 @@ class HtmlInfoBookSerializer {
|
|
|
236
239
|
*/
|
|
237
240
|
formatString(value) {
|
|
238
241
|
// Convert '&' to '§'
|
|
239
|
-
value = value.
|
|
242
|
+
value = value.replaceAll('&', '§');
|
|
240
243
|
// Formats to HTML
|
|
241
|
-
value = value.
|
|
242
|
-
value = value.
|
|
243
|
-
value = value.
|
|
244
|
-
value = value.
|
|
245
|
-
value = value.
|
|
244
|
+
value = value.replaceAll(/§l§n([^§]*)§r/gu, '<strong><u>$1</u></strong>');
|
|
245
|
+
value = value.replaceAll(/§l([^§]*)§r/gu, '<strong>$1</strong>');
|
|
246
|
+
value = value.replaceAll(/§n([^§]*)§r/gu, '<u>$1</u>');
|
|
247
|
+
value = value.replaceAll(/§o([^§]*)§r/gu, '<em>$1</em>');
|
|
248
|
+
value = value.replaceAll('§N', '<br />');
|
|
246
249
|
// Colors to HTML
|
|
247
|
-
value = value.
|
|
248
|
-
value = value.
|
|
249
|
-
value = value.
|
|
250
|
-
value = value.
|
|
251
|
-
value = value.
|
|
252
|
-
value = value.
|
|
253
|
-
value = value.
|
|
254
|
-
value = value.
|
|
255
|
-
value = value.
|
|
256
|
-
value = value.
|
|
257
|
-
value = value.
|
|
258
|
-
value = value.
|
|
259
|
-
value = value.
|
|
260
|
-
value = value.
|
|
261
|
-
value = value.
|
|
262
|
-
value = value.
|
|
250
|
+
value = value.replaceAll(/§r([^§]*)§0/gu, '<span style="color: #000000">$1</span>');
|
|
251
|
+
value = value.replaceAll(/§1([^§]*)§0/gu, '<span style="color: #0000AA">$1</span>');
|
|
252
|
+
value = value.replaceAll(/§2([^§]*)§0/gu, '<span style="color: #00AA00">$1</span>');
|
|
253
|
+
value = value.replaceAll(/§3([^§]*)§0/gu, '<span style="color: #00AAAA">$1</span>');
|
|
254
|
+
value = value.replaceAll(/§4([^§]*)§0/gu, '<span style="color: #AA0000">$1</span>');
|
|
255
|
+
value = value.replaceAll(/§5([^§]*)§0/gu, '<span style="color: #AA00AA">$1</span>');
|
|
256
|
+
value = value.replaceAll(/§6([^§]*)§0/gu, '<span style="color: #FFAA00">$1</span>');
|
|
257
|
+
value = value.replaceAll(/§7([^§]*)§0/gu, '<span style="color: #AAAAAA">$1</span>');
|
|
258
|
+
value = value.replaceAll(/§8([^§]*)§0/gu, '<span style="color: #555555">$1</span>');
|
|
259
|
+
value = value.replaceAll(/§9([^§]*)§0/gu, '<span style="color: #5555FF">$1</span>');
|
|
260
|
+
value = value.replaceAll(/§a([^§]*)§0/gu, '<span style="color: #55FF55">$1</span>');
|
|
261
|
+
value = value.replaceAll(/§b([^§]*)§0/gu, '<span style="color: #55FFFF">$1</span>');
|
|
262
|
+
value = value.replaceAll(/§c([^§]*)§0/gu, '<span style="color: #FF5555">$1</span>');
|
|
263
|
+
value = value.replaceAll(/§d([^§]*)§0/gu, '<span style="color: #FF55FF">$1</span>');
|
|
264
|
+
value = value.replaceAll(/§e([^§]*)§0/gu, '<span style="color: #FFFF55">$1</span>');
|
|
265
|
+
value = value.replaceAll(/§f([^§]*)§0/gu, '<span style="color: #FFFFFF">$1</span>');
|
|
263
266
|
return value;
|
|
264
267
|
}
|
|
265
268
|
ensureDirExists(dirPath) {
|
|
266
269
|
return __awaiter(this, void 0, void 0, function* () {
|
|
267
270
|
let fstat;
|
|
268
271
|
try {
|
|
269
|
-
fstat = yield
|
|
272
|
+
fstat = yield node_fs_1.promises.stat(dirPath);
|
|
270
273
|
}
|
|
271
|
-
catch (
|
|
272
|
-
yield (0,
|
|
274
|
+
catch (_a) {
|
|
275
|
+
yield (0, node_util_1.promisify)(mkdirp_1.default)(dirPath);
|
|
273
276
|
}
|
|
274
277
|
if (fstat && !fstat.isDirectory() && fstat.isFile()) {
|
|
275
278
|
throw new Error(`Could not serialize to a file, must be a directory.`);
|
|
@@ -278,9 +281,9 @@ class HtmlInfoBookSerializer {
|
|
|
278
281
|
}
|
|
279
282
|
filePathToUrl(filePath, basePath, baseUrl) {
|
|
280
283
|
let url = filePath.replace(basePath, baseUrl);
|
|
281
|
-
const last = (0,
|
|
282
|
-
if (!url.endsWith('/') && last.
|
|
283
|
-
url
|
|
284
|
+
const last = (0, node_path_1.basename)(url);
|
|
285
|
+
if (!url.endsWith('/') && !last.includes('.')) {
|
|
286
|
+
url += '/';
|
|
284
287
|
}
|
|
285
288
|
return url;
|
|
286
289
|
}
|
package/package.json
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyclops-infobook-html",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "Output Cyclops infobooks as HTML",
|
|
5
|
-
"
|
|
5
|
+
"author": "Ruben Taelman <rubensworks@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/CyclopsMC/infobook-html#readme",
|
|
6
8
|
"repository": "git@github.com:CyclopsMC/infobook-html.git",
|
|
7
9
|
"bugs": {
|
|
8
10
|
"url": "https://github.com/CyclopsMC/infobook-html/issues"
|
|
9
11
|
},
|
|
10
|
-
"
|
|
11
|
-
"author": "Ruben Taelman <rubensworks@gmail.com>",
|
|
12
|
-
"license": "MIT",
|
|
12
|
+
"main": "index.js",
|
|
13
13
|
"bin": {
|
|
14
14
|
"generate-cyclops-infobook-html": "bin/generate-infobook-html.js",
|
|
15
15
|
"generate-mod-metadata": "bin/generate-mod-metadata.js",
|
|
16
16
|
"generate-icons": "bin/generate-icons.js",
|
|
17
|
-
"compress-icons": "bin/compress-icons.js"
|
|
17
|
+
"compress-icons": "bin/compress-icons.js",
|
|
18
|
+
"convert-pom-to-modpack": "bin/convert-pom-to-modpack.js"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
21
|
+
"assets/**/*",
|
|
20
22
|
"bin/**/*.d.ts",
|
|
21
23
|
"bin/**/*.js",
|
|
24
|
+
"index.d.ts",
|
|
25
|
+
"index.js",
|
|
22
26
|
"lib/**/*.d.ts",
|
|
23
27
|
"lib/**/*.js",
|
|
24
|
-
"template/**/*.pug"
|
|
25
|
-
"assets/**/*",
|
|
26
|
-
"index.d.ts",
|
|
27
|
-
"index.js"
|
|
28
|
+
"template/**/*.pug"
|
|
28
29
|
],
|
|
29
30
|
"pre-commit": [
|
|
30
31
|
"build",
|
|
@@ -51,50 +52,55 @@
|
|
|
51
52
|
"collectCoverage": true,
|
|
52
53
|
"testEnvironment": "node"
|
|
53
54
|
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@types/jest": "^30.0.0",
|
|
56
|
-
"@types/minimist": "^1.2.0",
|
|
57
|
-
"coveralls": "^3.0.3",
|
|
58
|
-
"jest": "^30.0.0",
|
|
59
|
-
"manual-git-changelog": "^1.0.1",
|
|
60
|
-
"pre-commit": "^1.2.2",
|
|
61
|
-
"ts-jest": "^29.0.0",
|
|
62
|
-
"tslint": "^6.0.0",
|
|
63
|
-
"tslint-eslint-rules": "^5.4.0",
|
|
64
|
-
"typescript": "^5.0.0"
|
|
65
|
-
},
|
|
66
55
|
"scripts": {
|
|
67
56
|
"test": "jest ${1}",
|
|
68
57
|
"test-watch": "jest ${1} --watch",
|
|
69
58
|
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls",
|
|
70
|
-
"lint": "
|
|
59
|
+
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint . --cache",
|
|
71
60
|
"build": "tsc",
|
|
72
61
|
"build-watch": "tsc --watch",
|
|
73
62
|
"validate": "npm ls",
|
|
74
63
|
"prepare": "npm run build",
|
|
75
|
-
"version": "manual-git-changelog onversion"
|
|
64
|
+
"version": "manual-git-changelog onversion",
|
|
65
|
+
"generate:metadata": "node bin/generate-mod-metadata.js modpack.json generate",
|
|
66
|
+
"generate:modpack": "node bin/convert-pom-to-modpack.js modpack.pom.xml settings.xml modpack.json",
|
|
67
|
+
"generate:icons": "node bin/generate-icons.js modpack.json",
|
|
68
|
+
"generate:html": "node bin/generate-infobook-html.js config.json output",
|
|
69
|
+
"generate:compress": "node bin/compress-icons.js output"
|
|
76
70
|
},
|
|
77
71
|
"dependencies": {
|
|
72
|
+
"@types/minimist": "^1.2.0",
|
|
78
73
|
"@types/mkdirp": "^0.5.2",
|
|
79
74
|
"@types/ncp": "^2.0.1",
|
|
80
|
-
"@types/node": "^13.1.0",
|
|
81
75
|
"@types/node-fetch": "^2.5.0",
|
|
82
76
|
"@types/pug": "^2.0.4",
|
|
83
77
|
"@types/rimraf": "^3.0.0",
|
|
84
78
|
"@types/xml2js": "^0.4.4",
|
|
85
79
|
"@types/yauzl": "^2.9.1",
|
|
86
|
-
"@types/minimist": "^1.2.0",
|
|
87
80
|
"minimist": "^1.2.0",
|
|
88
81
|
"mkdirp": "^0.5.1",
|
|
89
82
|
"mvn-artifact-download": "^5.0.0",
|
|
90
|
-
"optipng-bin": "^9.0.0",
|
|
91
83
|
"ncp": "^2.0.0",
|
|
92
84
|
"node-fetch": "^2.6.0",
|
|
85
|
+
"optipng-bin": "^9.0.0",
|
|
93
86
|
"pug": "^3.0.0",
|
|
94
87
|
"rimraf": "^3.0.0",
|
|
95
88
|
"xml2js": "^0.4.19",
|
|
96
89
|
"yauzl": "^2.10.0"
|
|
97
90
|
},
|
|
91
|
+
"devDependencies": {
|
|
92
|
+
"@rubensworks/eslint-config": "^3.1.0",
|
|
93
|
+
"@types/jest": "^30.0.0",
|
|
94
|
+
"@types/minimist": "^1.2.0",
|
|
95
|
+
"@types/node": "^22.19.15",
|
|
96
|
+
"coveralls": "^3.0.3",
|
|
97
|
+
"eslint": "^8.57.1",
|
|
98
|
+
"jest": "^30.0.0",
|
|
99
|
+
"manual-git-changelog": "^1.0.1",
|
|
100
|
+
"pre-commit": "^1.2.2",
|
|
101
|
+
"ts-jest": "^29.0.0",
|
|
102
|
+
"typescript": "^5.0.0"
|
|
103
|
+
},
|
|
98
104
|
"resolutions": {
|
|
99
105
|
"@types/istanbul-reports": "3.0.0"
|
|
100
106
|
}
|