cyclops-infobook-html 2.0.0 → 3.1.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 CHANGED
@@ -1,6 +1,19 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ <a name="v3.1.0"></a>
5
+ ## [v3.1.0](https://github.com/CyclopsMC/infobook-html/compare/v3.0.0...v3.1.0) - 2024-01-31
6
+
7
+ ### Added
8
+ * [Support text field appendix](https://github.com/CyclopsMC/infobook-html/commit/6f24bbbd606b6cfd1237e3bf740e73ffc23008be)
9
+ * [Allowing raw mod URLs in modpack](https://github.com/CyclopsMC/infobook-html/commit/11c9ed5adc554ae7dafa66a202ac83fcacd240fb)
10
+
11
+ <a name="v3.0.0"></a>
12
+ ## [v3.0.0](https://github.com/CyclopsMC/infobook-html/compare/v2.0.0...v3.0.0) - 2022-03-10
13
+
14
+ ### Changed
15
+ * [Update to MC 1.18](https://github.com/CyclopsMC/infobook-html/commit/1fb77959593a2b84cb14e56406f0df20ad450e16)
16
+
4
17
  <a name="v2.0.0"></a>
5
18
  ## [v2.0.0](https://github.com/CyclopsMC/infobook-html/compare/v1.1.2...v2.0.0) - 2021-02-03
6
19
 
package/README.md CHANGED
@@ -44,6 +44,11 @@ Before you can execute this phase, you need a `modpack.json` file with contents
44
44
  "type": "maven",
45
45
  "artifact": "org.cyclops.commoncapabilities:CommonCapabilities:1.12.2-2.4.4-309",
46
46
  "repo": "https://oss.jfrog.org/artifactory/simple/libs-release/"
47
+ },
48
+ {
49
+ "type": "raw",
50
+ "name": "integratedscripting-1.19.2-1.0.0-61.jar",
51
+ "url": "https://www.dropbox.com/s/mbbikni5ieyttuq/integratedscripting-1.19.2-1.0.0-61.jar?dl=1"
47
52
  }
48
53
  ]
49
54
  }
package/assets/styles.css CHANGED
@@ -167,6 +167,11 @@ hr {
167
167
  top: 1px;
168
168
  }
169
169
 
170
+ .appendix-textfield {
171
+ text-align: left;
172
+ padding: 10px;
173
+ }
174
+
170
175
  .appendix .inputs {
171
176
  display: inline-block;
172
177
  vertical-align: middle;
@@ -10,6 +10,7 @@ const InfoBookAppendixHandlerCraftingRecipe_1 = require("../lib/infobook/appendi
10
10
  const InfoBookAppendixHandlerSmeltingRecipe_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe");
11
11
  const InfoBookAppendixHandlerImage_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerImage");
12
12
  const InfoBookAppendixHandlerKeybinding_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerKeybinding");
13
+ const InfoBookAppendixHandlerTextfield_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerTextfield");
13
14
  const InfoBookInitializer_1 = require("../lib/infobook/InfoBookInitializer");
14
15
  const ResourceLoader_1 = require("../lib/resource/ResourceLoader");
15
16
  const HtmlInfoBookSerializer_1 = require("../lib/serialize/HtmlInfoBookSerializer");
@@ -61,6 +62,7 @@ function create() {
61
62
  infoBookInitializer.registerAppendixHandler('minecraft:smelting', new InfoBookAppendixHandlerSmeltingRecipe_1.InfoBookAppendixHandlerSmeltingRecipe(resourceLoader.getResourceHandler(), 'registries', config.recipeOverrides));
62
63
  infoBookInitializer.registerAppendixHandler('image', new InfoBookAppendixHandlerImage_1.InfoBookAppendixHandlerImage(resourceLoader.getResourceHandler()));
63
64
  infoBookInitializer.registerAppendixHandler('keybinding', new InfoBookAppendixHandlerKeybinding_1.InfoBookAppendixHandlerKeybinding(resourceLoader.getResourceHandler()));
65
+ infoBookInitializer.registerAppendixHandler('textfield', new InfoBookAppendixHandlerTextfield_1.InfoBookAppendixHandlerTextfield(resourceLoader.getResourceHandler()));
64
66
  // Load plugins
65
67
  const assetsPaths = [];
66
68
  const headSuffixGetters = [];
@@ -88,7 +90,7 @@ function create() {
88
90
  path += '/';
89
91
  }
90
92
  const infoBookSerializer = new HtmlInfoBookSerializer_1.HtmlInfoBookSerializer();
91
- yield infoBookSerializer.serialize(infoBook, Object.assign({}, config, { headSuffixGetters,
93
+ yield infoBookSerializer.serialize(infoBook, Object.assign(Object.assign({}, config), { headSuffixGetters,
92
94
  mods,
93
95
  path, resourceHandler: resourceLoader.getResourceHandler(), root: true }), assetsPaths);
94
96
  });
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/infobook/appendix/IInfoBookAppendixHandler"), exports);
4
5
  tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixAd"), exports);
5
6
  tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe"), exports);
6
7
  tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards"), exports);
@@ -10,6 +11,13 @@ tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixHandlerIma
10
11
  tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixHandlerKeybinding"), exports);
11
12
  tslib_1.__exportStar(require("./lib/infobook/appendix/InfoBookAppendixTagIndex"), exports);
12
13
  tslib_1.__exportStar(require("./lib/infobook/FileWriter"), exports);
14
+ tslib_1.__exportStar(require("./lib/infobook/IFileWriter"), exports);
15
+ tslib_1.__exportStar(require("./lib/infobook/IFluid"), exports);
16
+ tslib_1.__exportStar(require("./lib/infobook/IInfoAppendix"), exports);
17
+ tslib_1.__exportStar(require("./lib/infobook/IInfoBook"), exports);
18
+ tslib_1.__exportStar(require("./lib/infobook/IInfobookPlugin"), exports);
19
+ tslib_1.__exportStar(require("./lib/infobook/IInfoSection"), exports);
20
+ tslib_1.__exportStar(require("./lib/infobook/IItem"), exports);
13
21
  tslib_1.__exportStar(require("./lib/infobook/InfoBookInitializer"), exports);
14
22
  tslib_1.__exportStar(require("./lib/modloader/ModLoader"), exports);
15
23
  tslib_1.__exportStar(require("./lib/parse/XmlInfoBookParser"), exports);
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileWriter = void 0;
3
4
  const fs_1 = require("fs");
4
5
  const path_1 = require("path");
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookInitializer = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const XmlInfoBookParser_1 = require("../parse/XmlInfoBookParser");
5
6
  const InfoBookAppendixTagIndex_1 = require("./appendix/InfoBookAppendixTagIndex");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixAd = void 0;
3
4
  const pug_1 = require("pug");
4
5
  /**
5
6
  * An appendix with an add
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerAbstractRecipe = void 0;
3
4
  const fs = require("fs");
4
5
  const path_1 = require("path");
5
6
  /**
@@ -11,7 +12,7 @@ class InfoBookAppendixHandlerAbstractRecipe {
11
12
  this.resourceHandler = resourceHandler;
12
13
  this.registry = InfoBookAppendixHandlerAbstractRecipe.indexRegistry(JSON.parse(fs.readFileSync(path_1.join(registriesPath, id.replace(/:/g, '__') + '.json'), "utf8")));
13
14
  if (recipeOverrides) {
14
- this.registry = Object.assign({}, this.registry, (recipeOverrides[id] || {}));
15
+ this.registry = Object.assign(Object.assign({}, this.registry), (recipeOverrides[id] || {}));
15
16
  }
16
17
  }
17
18
  static indexRegistry(registryRead) {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerAdvancementRewards = void 0;
3
4
  const pug_1 = require("pug");
4
5
  /**
5
6
  * Handles advancement rewards appendices.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerCraftingRecipe = void 0;
3
4
  const pug_1 = require("pug");
4
5
  const InfoBookAppendixHandlerAbstractRecipe_1 = require("./InfoBookAppendixHandlerAbstractRecipe");
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerImage = void 0;
3
4
  const fs_1 = require("fs");
4
5
  const path_1 = require("path");
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerKeybinding = void 0;
3
4
  const pug_1 = require("pug");
4
5
  /**
5
6
  * Handles keybindings appendices.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerSmeltingRecipe = void 0;
3
4
  const pug_1 = require("pug");
4
5
  const InfoBookAppendixHandlerAbstractRecipe_1 = require("./InfoBookAppendixHandlerAbstractRecipe");
5
6
  /**
@@ -0,0 +1,11 @@
1
+ import { ResourceHandler } from "../../resource/ResourceHandler";
2
+ import { IInfoAppendix } from "../IInfoAppendix";
3
+ import { IInfoBookAppendixHandler } from "./IInfoBookAppendixHandler";
4
+ /**
5
+ * Handles text field appendices.
6
+ */
7
+ export declare class InfoBookAppendixHandlerTextfield implements IInfoBookAppendixHandler {
8
+ private readonly resourceHandler;
9
+ constructor(resourceHandler: ResourceHandler);
10
+ createAppendix(data: any): IInfoAppendix;
11
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixHandlerTextfield = void 0;
4
+ /**
5
+ * Handles text field appendices.
6
+ */
7
+ class InfoBookAppendixHandlerTextfield {
8
+ constructor(resourceHandler) {
9
+ this.resourceHandler = resourceHandler;
10
+ }
11
+ createAppendix(data) {
12
+ const contents = data._
13
+ .replace(/ /g, '&nbsp;')
14
+ .replace(/\n/g, '<br \>');
15
+ const scale = data.$.scale || 1;
16
+ return {
17
+ toHtml: (context, fileWriter) => {
18
+ return `<div class="appendix-textfield" style="font-size: ${scale}em">${contents}</div>`;
19
+ },
20
+ };
21
+ }
22
+ }
23
+ exports.InfoBookAppendixHandlerTextfield = InfoBookAppendixHandlerTextfield;
24
+ //# sourceMappingURL=InfoBookAppendixHandlerTextfield.js.map
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InfoBookAppendixTagIndex = void 0;
3
4
  const pug_1 = require("pug");
4
5
  /**
5
6
  * An appendix that lists all tags with links to them
@@ -29,6 +29,7 @@ export declare class ModLoader {
29
29
  * Download and install mods.
30
30
  */
31
31
  installMods(): Promise<void>;
32
+ downloadFile(url: string, fileName: string, modsDir: string): Promise<void>;
32
33
  /**
33
34
  * Start the server and execute a command to dump all registries
34
35
  */
@@ -78,7 +79,7 @@ export interface IModLoaderArgs {
78
79
  versionForge: string;
79
80
  versionMinecraft: string;
80
81
  }
81
- export declare type IMod = IModMaven | IModCurseforge;
82
+ export declare type IMod = IModMaven | IModCurseforge | IModRaw;
82
83
  export interface IModMaven {
83
84
  type: 'maven';
84
85
  artifact: string;
@@ -90,3 +91,8 @@ export interface IModCurseforge {
90
91
  artifact: string;
91
92
  version: string;
92
93
  }
94
+ export interface IModRaw {
95
+ type: 'raw';
96
+ name: string;
97
+ url: string;
98
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModLoader = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const child_process_1 = require("child_process");
5
6
  const fs_1 = require("fs");
@@ -11,6 +12,7 @@ const path_1 = require("path");
11
12
  const rimraf = require("rimraf");
12
13
  const util_1 = require("util");
13
14
  const yauzl_1 = require("yauzl");
15
+ const Path = require("path");
14
16
  /**
15
17
  * Takes care of installing Forge, installing mods, starting a Forge server, and fetching metadata.
16
18
  */
@@ -89,27 +91,36 @@ class ModLoader {
89
91
  process.stdout.write(` - ${fileName} from CurseForge...\n`);
90
92
  const url = `https://minecraft.curseforge.com/api/maven/${mod.project}/${mod.artifact
91
93
  .replace(/-/g, '/')}/${fileName}`;
92
- const response = yield node_fetch_1.default(url);
93
- if (response.status !== 200) {
94
- throw new Error(response.statusText + ' on ' + url);
95
- }
96
- yield new Promise((resolve, reject) => {
97
- response.body
98
- .on('error', reject)
99
- .on('end', resolve)
100
- .pipe(fs.createWriteStream(path_1.join(modsDir, fileName)));
101
- });
94
+ yield this.downloadFile(url, fileName, modsDir);
102
95
  }
103
96
  else if (mod.type === 'maven') {
104
97
  process.stdout.write(` - ${mod.artifact} from ${mod.repo}...\n`);
105
98
  yield mvn_artifact_download_1.default(mod.artifact, modsDir, mod.repo);
106
99
  }
100
+ else if (mod.type === 'raw') {
101
+ process.stdout.write(` - ${mod.name} from ${mod.url}...\n`);
102
+ yield this.downloadFile(mod.url, mod.name, modsDir);
103
+ }
107
104
  else {
108
105
  throw new Error('Unknown mod type ' + mod.type);
109
106
  }
110
107
  }
111
108
  });
112
109
  }
110
+ downloadFile(url, fileName, modsDir) {
111
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
112
+ const response = yield node_fetch_1.default(url);
113
+ if (response.status !== 200) {
114
+ throw new Error(response.statusText + ' on ' + url);
115
+ }
116
+ yield new Promise((resolve, reject) => {
117
+ response.body
118
+ .on('error', reject)
119
+ .on('end', resolve)
120
+ .pipe(fs.createWriteStream(path_1.join(modsDir, fileName)));
121
+ });
122
+ });
123
+ }
113
124
  /**
114
125
  * Start the server and execute a command to dump all registries
115
126
  */
@@ -117,7 +128,7 @@ class ModLoader {
117
128
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
118
129
  // Start the Forge server
119
130
  process.stdout.write('Starting server...\n');
120
- const proc = child_process_1.exec(`cd ${this.path} && java -jar forge-*.jar nogui`);
131
+ const proc = child_process_1.exec(`cd ${this.path} && ./run.sh nogui`);
121
132
  // Ignore stdout: proc.stdout.pipe(process.stdout);
122
133
  proc.stderr.pipe(process.stderr);
123
134
  const onDone = new Promise((resolve, reject) => {
@@ -133,7 +144,7 @@ class ModLoader {
133
144
  });
134
145
  // Once the loading is complete, send our command and stop the server
135
146
  proc.stdout.on('data', (line) => {
136
- if (line.indexOf('[minecraft/DedicatedServer]: Done') >= 0) {
147
+ if (line.indexOf('Done') >= 0 && line.indexOf('For help, type "help"') >= 0) {
137
148
  process.stdout.write('Dumping registries...\n');
138
149
  this.sendCommand(proc, '/cyclopscore dumpregistries');
139
150
  this.sendCommand(proc, '/stop');
@@ -174,9 +185,14 @@ class ModLoader {
174
185
  }
175
186
  // Find Minecraft jar
176
187
  let jar = null;
177
- for (const file of yield fs.promises.readdir(this.path)) {
178
- if (file.startsWith('minecraft_server') && file.endsWith('.jar')) {
179
- jar = path_1.join(this.path, file);
188
+ const subPath = Path.join(this.path, 'libraries', 'net', 'minecraft', 'server');
189
+ for (const dir of yield fs.promises.readdir(subPath)) {
190
+ if (dir.indexOf('-') > 0) {
191
+ for (const file of yield fs.promises.readdir(Path.join(subPath, dir))) {
192
+ if (file.startsWith('server') && file.endsWith('extra.jar')) {
193
+ jar = path_1.join(subPath, dir, file);
194
+ }
195
+ }
180
196
  }
181
197
  }
182
198
  // Error if no jar was found
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XmlInfoBookParser = void 0;
3
4
  const fs = require("fs");
4
5
  const xml2js_1 = require("xml2js");
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceHandler = void 0;
3
4
  const path_1 = require("path");
4
5
  /**
5
6
  * Allows Minecraft resources to be used.
@@ -252,9 +253,9 @@ class ResourceHandler {
252
253
  return keybinding;
253
254
  }
254
255
  }
256
+ exports.ResourceHandler = ResourceHandler;
255
257
  ResourceHandler.TRANSLATION_DEFAULTS = {
256
258
  'fluid.tile.lava': 'Lava',
257
259
  'fluid.tile.water': 'Water',
258
260
  };
259
- exports.ResourceHandler = ResourceHandler;
260
261
  //# sourceMappingURL=ResourceHandler.js.map
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceLoader = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const fs_1 = require("fs");
5
6
  const path_1 = require("path");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HtmlInfoBookSerializer = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const fs_1 = require("fs");
5
6
  const mkdirp = require("mkdirp");
@@ -21,7 +22,7 @@ class HtmlInfoBookSerializer {
21
22
  }
22
23
  serialize(infobook, context, assetsPaths) {
23
24
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- context = Object.assign({}, context, { basePath: context.path, breadcrumbs: [] });
25
+ context = Object.assign(Object.assign({}, context), { basePath: context.path, breadcrumbs: [] });
25
26
  this.fileWriter = new FileWriter_1.FileWriter(context);
26
27
  yield this.ensureDirExists(context.path);
27
28
  yield this.ensureDirExists(path_1.join(context.path, 'assets'));
@@ -50,7 +51,7 @@ class HtmlInfoBookSerializer {
50
51
  urlIndex: {},
51
52
  };
52
53
  let pageIndex = 0;
53
- yield this.serializeSection(infobook.rootSection, Object.assign({}, contextRoot, { language, path: langPath }), ({ index, section, sectionTitle, fileUrl, breadcrumbs }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
54
+ yield this.serializeSection(infobook.rootSection, Object.assign(Object.assign({}, contextRoot), { language, path: langPath }), ({ index, section, sectionTitle, fileUrl, breadcrumbs }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
54
55
  if (!index) {
55
56
  sectionIndex.urlIndex[fileUrl] = pageIndex++;
56
57
  const name = breadcrumbs.slice(1).map((b) => b.name).join(' / ');
@@ -68,7 +69,7 @@ class HtmlInfoBookSerializer {
68
69
  }
69
70
  serializeSectionFiles(infobook, contextRoot, language, langPath, sectionIndex) {
70
71
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- yield this.serializeSection(infobook.rootSection, Object.assign({}, contextRoot, { language, path: langPath, sectionIndex }), ({ index, breadcrumbs, context, section, sectionTitle, subSectionDatas, filePath, fileUrl }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+ yield this.serializeSection(infobook.rootSection, Object.assign(Object.assign({}, contextRoot), { language, path: langPath, sectionIndex }), ({ index, breadcrumbs, context, section, sectionTitle, subSectionDatas, filePath, fileUrl }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
72
73
  // Create links to this page in other languages
73
74
  const languages = [];
74
75
  for (const name of contextRoot.resourceHandler.getLanguages()) {
@@ -79,7 +80,7 @@ class HtmlInfoBookSerializer {
79
80
  }
80
81
  if (index) {
81
82
  // Create index file
82
- const fileContents = this.templateIndex(Object.assign({}, context, { breadcrumbs, headSuffix: context.headSuffixGetters.map((g) => g(context)).join(''), languages,
83
+ const fileContents = this.templateIndex(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map((g) => g(context)).join(''), languages,
83
84
  sectionTitle,
84
85
  subSectionDatas }));
85
86
  yield fs_1.promises.writeFile(filePath, fileContents);
@@ -97,7 +98,7 @@ class HtmlInfoBookSerializer {
97
98
  appendices.unshift(new InfoBookAppendixAd_1.InfoBookAppendixAd());
98
99
  }
99
100
  // Create leaf file
100
- const fileContents = this.templateSection(Object.assign({}, context, { breadcrumbs, headSuffix: context.headSuffixGetters.map((g) => g(context)).join(''), languages,
101
+ const fileContents = this.templateSection(Object.assign(Object.assign({}, context), { breadcrumbs, headSuffix: context.headSuffixGetters.map((g) => g(context)).join(''), languages,
101
102
  nextPage,
102
103
  previousPage, sectionAppendices: appendices
103
104
  .filter((appendix) => appendix) // TODO: rm
@@ -128,7 +129,7 @@ class HtmlInfoBookSerializer {
128
129
  // Go in a subfolder when we are handling a different mod
129
130
  if (section.modId !== context.modId) {
130
131
  yield this.ensureDirExists(path_1.join(context.path, section.modId));
131
- context = Object.assign({}, context, { modId: section.modId, path: path_1.join(context.path, section.modId) });
132
+ context = Object.assign(Object.assign({}, context), { modId: section.modId, path: path_1.join(context.path, section.modId) });
132
133
  }
133
134
  if (section.subSections && section.subSections.length > 0) {
134
135
  // Navigation section
@@ -140,9 +141,9 @@ class HtmlInfoBookSerializer {
140
141
  url: fileUrl,
141
142
  }]);
142
143
  for (const subSection of section.subSections) {
143
- const subSectionData = yield this.serializeSection(subSection, Object.assign({}, context, { breadcrumbs: subBreadcrumbs, path: path_1.join(context.path, subSection.nameTranslationKey
144
+ const subSectionData = yield this.serializeSection(subSection, Object.assign(Object.assign({}, context), { breadcrumbs: subBreadcrumbs, path: path_1.join(context.path, subSection.nameTranslationKey
144
145
  .substr(subSection.nameTranslationKey.lastIndexOf('.') + 1)), root: false }), onSection);
145
- subSectionDatas.push(Object.assign({}, subSectionData, { url: this.filePathToUrl(subSectionData.filePath, context.basePath, context.baseUrl) }));
146
+ subSectionDatas.push(Object.assign(Object.assign({}, subSectionData), { url: this.filePathToUrl(subSectionData.filePath, context.basePath, context.baseUrl) }));
146
147
  }
147
148
  const filePath = path_1.join(context.path, 'index.html');
148
149
  yield onSection({ index: true, breadcrumbs, context, sectionTitle, section, subSectionDatas, filePath, fileUrl });
@@ -186,7 +187,7 @@ class HtmlInfoBookSerializer {
186
187
  throw new Error(`Could not find translation key for item ${JSON.stringify(item)}`);
187
188
  }
188
189
  const { link, linkTarget } = this.createResourceLink(resourceHandler, context, item.item, key);
189
- return this.templateItem(Object.assign({}, context, { annotation, count: item.count || 1, icon: iconUrl, link,
190
+ return this.templateItem(Object.assign(Object.assign({}, context), { annotation, count: item.count || 1, icon: iconUrl, link,
190
191
  linkTarget, name: resourceHandler.getTranslation(resourceHandler.getItemTranslationKey(item), context.language), slot }));
191
192
  }
192
193
  createFluidDisplay(resourceHandler, context, fileWriter, fluid, slot) {
@@ -200,7 +201,7 @@ class HtmlInfoBookSerializer {
200
201
  throw new Error(`Could not find translation key for fluid ${JSON.stringify(fluid)}`);
201
202
  }
202
203
  const { link, linkTarget } = this.createResourceLink(resourceHandler, context, this.tagFluid(context, fluid.fluid), key);
203
- return this.templateItem(Object.assign({}, context, { count: (fluid.amount || 1), icon: iconUrl, link,
204
+ return this.templateItem(Object.assign(Object.assign({}, context), { count: (fluid.amount || 1), icon: iconUrl, link,
204
205
  linkTarget, name: resourceHandler.getTranslation(resourceHandler.getFluidTranslationKey(fluid), context.language), slot }));
205
206
  }
206
207
  tagFluid(context, fluidName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyclops-infobook-html",
3
- "version": "2.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Output Cyclops infobooks as HTML",
5
5
  "main": "index.js",
6
6
  "repository": "git@github.com:CyclopsMC/infobook-html.git",
@@ -59,7 +59,7 @@
59
59
  "ts-jest": "^26.0.0",
60
60
  "tslint": "^6.0.0",
61
61
  "tslint-eslint-rules": "^5.4.0",
62
- "typescript": "^3.4.5"
62
+ "typescript": "^4.0.0"
63
63
  },
64
64
  "scripts": {
65
65
  "test": "jest ${1}",