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.
Files changed (52) hide show
  1. package/README.md +12 -12
  2. package/bin/compress-icons.js +42 -7
  3. package/bin/convert-pom-to-modpack.d.ts +2 -0
  4. package/bin/convert-pom-to-modpack.js +96 -0
  5. package/bin/generate-icons.js +50 -15
  6. package/bin/generate-infobook-html.js +46 -10
  7. package/bin/generate-mod-metadata.js +52 -14
  8. package/index.d.ts +25 -25
  9. package/lib/icon/IconsCompressor.js +43 -12
  10. package/lib/icon/IconsGenerator.d.ts +42 -20
  11. package/lib/icon/IconsGenerator.js +156 -70
  12. package/lib/infobook/FileWriter.d.ts +3 -3
  13. package/lib/infobook/FileWriter.js +5 -5
  14. package/lib/infobook/IFileWriter.d.ts +2 -2
  15. package/lib/infobook/IInfoAppendix.d.ts +3 -3
  16. package/lib/infobook/IInfoBook.d.ts +2 -4
  17. package/lib/infobook/IInfoSection.d.ts +1 -1
  18. package/lib/infobook/IInfobookPlugin.d.ts +5 -5
  19. package/lib/infobook/InfoBookInitializer.d.ts +7 -9
  20. package/lib/infobook/InfoBookInitializer.js +1 -1
  21. package/lib/infobook/appendix/IInfoBookAppendixHandler.d.ts +2 -2
  22. package/lib/infobook/appendix/InfoBookAppendixAd.d.ts +3 -3
  23. package/lib/infobook/appendix/InfoBookAppendixAd.js +7 -2
  24. package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.d.ts +12 -14
  25. package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.js +41 -8
  26. package/lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards.d.ts +3 -3
  27. package/lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards.js +5 -4
  28. package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.d.ts +6 -5
  29. package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.js +4 -3
  30. package/lib/infobook/appendix/InfoBookAppendixHandlerImage.d.ts +3 -3
  31. package/lib/infobook/appendix/InfoBookAppendixHandlerImage.js +4 -4
  32. package/lib/infobook/appendix/InfoBookAppendixHandlerKeybinding.d.ts +3 -3
  33. package/lib/infobook/appendix/InfoBookAppendixHandlerKeybinding.js +3 -2
  34. package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.d.ts +6 -5
  35. package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.js +3 -2
  36. package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.d.ts +3 -3
  37. package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.js +4 -5
  38. package/lib/infobook/appendix/InfoBookAppendixTagIndex.d.ts +4 -4
  39. package/lib/infobook/appendix/InfoBookAppendixTagIndex.js +2 -1
  40. package/lib/modloader/ModLoader.d.ts +13 -2
  41. package/lib/modloader/ModLoader.js +164 -69
  42. package/lib/modloader/PomConverter.d.ts +28 -0
  43. package/lib/modloader/PomConverter.js +194 -0
  44. package/lib/parse/XmlInfoBookParser.d.ts +5 -7
  45. package/lib/parse/XmlInfoBookParser.js +42 -9
  46. package/lib/resource/ResourceHandler.d.ts +7 -13
  47. package/lib/resource/ResourceHandler.js +16 -11
  48. package/lib/resource/ResourceLoader.d.ts +4 -5
  49. package/lib/resource/ResourceLoader.js +35 -33
  50. package/lib/serialize/HtmlInfoBookSerializer.d.ts +10 -16
  51. package/lib/serialize/HtmlInfoBookSerializer.js +83 -80
  52. package/package.json +33 -27
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Cyclops Infobook HTML
2
2
 
3
- [![Build Status](https://travis-ci.org/CyclopsMC/infobook-html.svg?branch=master)](https://travis-ci.org/CyclopsMC/infobook-html)
3
+ [![Build Status](https://github.com/CyclopsMC/infobook-html/actions/workflows/deploy.yml/badge.svg)](https://github.com/CyclopsMC/infobook-html/actions/workflows/deploy.yml)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/CyclopsMC/infobook-html/badge.svg?branch=master)](https://coveralls.io/github/CyclopsMC/infobook-html?branch=master)
5
- [![npm version](https://badge.fury.io/js/infobook-html.svg)](https://www.npmjs.com/package/infobook-html)
5
+ [![npm version](https://badge.fury.io/js/cyclops-infobook-html.svg)](https://www.npmjs.com/package/cyclops-infobook-html)
6
6
 
7
7
  Output Cyclops infobooks as HTML.
8
8
 
@@ -16,7 +16,7 @@ This tool is the basis for the following mod-specific plugins:
16
16
  This tool allows Cyclops infobooks to be exported as an HTML website in four phases:
17
17
 
18
18
  1. Metadata generation: A preparation step for generating all required metadata that is needed for serializing the infobook to HTML.
19
- 2. Icon generation: Exporting item and block icons to PNG files.
19
+ 2. Icon generation: Exporting item and block icons to PNG files.
20
20
  3. HTML generation: Serialization to HTML based on the infook XML and metadata.
21
21
  4. Icon compression: Optionally compress icons within the output directory.
22
22
 
@@ -30,19 +30,19 @@ Before you can execute this phase, you need a `modpack.json` file with contents
30
30
  "minecraft": "1.12.2",
31
31
  "forge": "14.23.5.2838",
32
32
  "mods": [
33
- {
34
- "type": "curseforge",
35
- "project": "cyclops-core",
36
- "artifact": "CyclopsCore-1.12.2",
37
- "version": "1.4.0"
38
- },
39
33
  {
40
- "type": "maven",
34
+ "type": "curseforge",
35
+ "project": "cyclops-core",
36
+ "artifact": "CyclopsCore-1.12.2",
37
+ "version": "1.4.0"
38
+ },
39
+ {
40
+ "type": "maven",
41
41
  "artifact": "org.cyclops.integrateddynamics:IntegratedDynamics:1.12.2-1.0.9-1317",
42
42
  "repo": "https://oss.jfrog.org/artifactory/simple/libs-release/"
43
43
  },
44
44
  {
45
- "type": "maven",
45
+ "type": "maven",
46
46
  "artifact": "org.cyclops.commoncapabilities:CommonCapabilities:1.12.2-2.4.4-309",
47
47
  "repo": "https://oss.jfrog.org/artifactory/simple/libs-release/"
48
48
  },
@@ -164,7 +164,7 @@ Next, the plugin can be loaded when generating HTML by adding the following to y
164
164
  {
165
165
  "plugins": [
166
166
  "path/to/instance.js"
167
- ],
167
+ ]
168
168
  }
169
169
  ```
170
170
 
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
37
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
38
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,19 +42,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
43
  });
11
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
12
48
  Object.defineProperty(exports, "__esModule", { value: true });
13
- const fs = require("fs");
14
- const minimist = require("minimist");
15
- const path_1 = require("path");
49
+ const fs = __importStar(require("node:fs"));
50
+ const node_path_1 = require("node:path");
51
+ const minimist_1 = __importDefault(require("minimist"));
16
52
  const IconsCompressor_1 = require("../lib/icon/IconsCompressor");
17
53
  // Process CLI args
18
- const args = minimist(process.argv.slice(2));
19
- if (args.help || args._.length < 1) {
54
+ const args = (0, minimist_1.default)(process.argv.slice(2));
55
+ if (args.help || args._.length === 0) {
20
56
  printUsage();
21
57
  }
22
58
  function run(outputDir) {
23
59
  return __awaiter(this, void 0, void 0, function* () {
24
- const iconsDir = (0, path_1.resolve)(outputDir, 'assets', 'icon');
60
+ const iconsDir = (0, node_path_1.resolve)(outputDir, 'assets', 'icon');
25
61
  if (!fs.existsSync(iconsDir)) {
26
62
  process.stderr.write(`Icons directory not found: ${iconsDir}\n`);
27
63
  process.exit(1);
@@ -40,7 +76,6 @@ Options:
40
76
  process.exit(1);
41
77
  }
42
78
  run(args._[0]).catch((e) => {
43
- // tslint:disable-next-line:no-console
44
79
  console.error(e);
45
80
  process.exit(1);
46
81
  });
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ const fs = __importStar(require("node:fs"));
50
+ const path = __importStar(require("node:path"));
51
+ const minimist_1 = __importDefault(require("minimist"));
52
+ const PomConverter_1 = require("../lib/modloader/PomConverter");
53
+ // Process CLI args
54
+ const args = (0, minimist_1.default)(process.argv.slice(2));
55
+ if (args.help || args._.length === 0 || args._.length > 3) {
56
+ printUsage();
57
+ }
58
+ function run(pomPath, settingsPath, outputPath) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const pomXml = fs.readFileSync(pomPath, 'utf8');
61
+ const settingsXml = settingsPath ? fs.readFileSync(settingsPath, 'utf8') : undefined;
62
+ const modpack = yield (0, PomConverter_1.convertPomToModpack)(pomXml, settingsXml);
63
+ fs.writeFileSync(outputPath, `${JSON.stringify(modpack, undefined, 2)}\n`, 'utf8');
64
+ process.stdout.write(`Written modpack.json to ${outputPath}\n`);
65
+ });
66
+ }
67
+ function printUsage() {
68
+ process.stdout.write(`convert-pom-to-modpack Convert a Maven pom.xml + settings.xml into a modpack.json
69
+ Usage:
70
+ convert-pom-to-modpack /path/to/modpack.pom.xml [/path/to/settings.xml] [/path/to/modpack.json]
71
+ Arguments:
72
+ pom.xml Path to the Maven POM file (required)
73
+ settings.xml Path to the Maven settings file (optional, provides repository URLs and credentials)
74
+ modpack.json Output path for the generated modpack.json (default: modpack.json in cwd)
75
+ Options:
76
+ --help print this help message
77
+ Notes:
78
+ - The Minecraft version is taken from the project <version> in the POM.
79
+ - The NeoForge version is taken from the <neoforge.version> property in the POM.
80
+ - The Forge version is taken from the <forge.version> property in the POM.
81
+ - Each dependency becomes a maven mod entry pointing to the first active repository.
82
+ - Server credentials in settings.xml are encoded as Authorization headers using the
83
+ placeholder values from the file (e.g. \${GITHUB_TOKEN} remains as-is).
84
+ `);
85
+ process.exit(1);
86
+ }
87
+ const pomPath = path.resolve(args._[0]);
88
+ const settingsArg = args._.length >= 2 ? args._[1] : undefined;
89
+ const outputArg = args._.length >= 3 ? args._[2] : path.join(process.cwd(), 'modpack.json');
90
+ const settingsPath = settingsArg ? path.resolve(settingsArg) : undefined;
91
+ const outputPath = path.resolve(outputArg);
92
+ run(pomPath, settingsPath, outputPath).catch((e) => {
93
+ console.error(e);
94
+ process.exit(1);
95
+ });
96
+ //# sourceMappingURL=convert-pom-to-modpack.js.map
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
37
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
38
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,19 +42,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
43
  });
11
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
12
48
  Object.defineProperty(exports, "__esModule", { value: true });
13
- const fs = require("fs");
14
- const minimist = require("minimist");
15
- const path_1 = require("path");
49
+ const fs = __importStar(require("node:fs"));
50
+ const node_path_1 = require("node:path");
51
+ const minimist_1 = __importDefault(require("minimist"));
16
52
  const IconsGenerator_1 = require("../lib/icon/IconsGenerator");
17
53
  // Process CLI args
18
- const args = minimist(process.argv.slice(2));
19
- if (args.help || args._.length < 1) {
54
+ const args = (0, minimist_1.default)(process.argv.slice(2));
55
+ if (args.help || args._.length === 0) {
20
56
  printUsage();
21
57
  }
22
58
  function run(configPath) {
23
59
  return __awaiter(this, void 0, void 0, function* () {
24
- const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
60
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
25
61
  if (!config.minecraft) {
26
62
  process.stderr.write('Missing "minecraft" field in config\n');
27
63
  process.exit(1);
@@ -31,15 +67,14 @@ function run(configPath) {
31
67
  process.exit(1);
32
68
  }
33
69
  const generator = new IconsGenerator_1.IconsGenerator({
34
- modsDir: (0, path_1.join)(process.cwd(), args['mods-dir'] || (0, path_1.join)('server', 'mods')),
35
- iconsDir: (0, path_1.join)(process.cwd(), args['icons-dir'] || 'icon'),
36
- workDir: (0, path_1.join)(process.cwd(), args['work-dir'] || 'headlessmc'),
70
+ modsDir: (0, node_path_1.join)(process.cwd(), args['mods-dir'] || (0, node_path_1.join)('server', 'mods')),
71
+ iconsDir: (0, node_path_1.join)(process.cwd(), args['icons-dir'] || 'icon'),
72
+ workDir: (0, node_path_1.join)(process.cwd(), args['work-dir'] || 'headlessmc'),
37
73
  minecraftVersion: config.minecraft,
38
- neoforgeVersion: config.neoforge || config.forge,
39
- githubToken: args['github-token'] || process.env.GITHUB_TOKEN,
74
+ neoforgeVersion: (config.neoforge || config.forge),
40
75
  iconExporterVersion: args['icon-exporter-version'],
41
76
  headlessMcVersion: args['headlessmc-version'],
42
- launchTimeoutMs: args.timeout ? parseInt(args.timeout, 10) * 1000 : undefined,
77
+ launchTimeoutMs: args.timeout ? Number.parseInt(args.timeout, 10) * 1000 : undefined,
43
78
  });
44
79
  yield generator.generate();
45
80
  });
@@ -53,15 +88,15 @@ Options:
53
88
  --mods-dir directory containing mod JARs (default: server/mods)
54
89
  --icons-dir output directory for icons (default: icons)
55
90
  --work-dir working directory for HeadlessMC (default: headlessmc)
56
- --github-token GitHub token for downloading from GitHub Packages
57
- --icon-exporter-version version of the IconExporter artifact (default: 1.4.0-174)
91
+ --icon-exporter-version version of the IconExporter artifact to pin (e.g. "1.4.0-174");
92
+ if omitted, the latest version for the configured Minecraft version
93
+ is fetched automatically from Modrinth
58
94
  --headlessmc-version version of HeadlessMC to use (default: 2.8.0)
59
95
  --timeout timeout in seconds for the full icon generation (default: 1800)
60
96
  `);
61
97
  process.exit(1);
62
98
  }
63
99
  run(args._[0]).catch((e) => {
64
- // tslint:disable-next-line:no-console
65
100
  console.error(e);
66
101
  process.exit(1);
67
102
  });
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
37
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
38
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,21 +42,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
43
  });
11
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
12
48
  Object.defineProperty(exports, "__esModule", { value: true });
13
- const fs = require("fs");
14
- const minimist = require("minimist");
15
- const path_1 = require("path");
49
+ const fs = __importStar(require("node:fs"));
50
+ const node_path_1 = require("node:path");
51
+ const minimist_1 = __importDefault(require("minimist"));
16
52
  const InfoBookAppendixHandlerAdvancementRewards_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards");
17
53
  const InfoBookAppendixHandlerCraftingRecipe_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe");
18
- const InfoBookAppendixHandlerSmeltingRecipe_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe");
19
54
  const InfoBookAppendixHandlerImage_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerImage");
20
55
  const InfoBookAppendixHandlerKeybinding_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerKeybinding");
56
+ const InfoBookAppendixHandlerSmeltingRecipe_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe");
21
57
  const InfoBookAppendixHandlerTextfield_1 = require("../lib/infobook/appendix/InfoBookAppendixHandlerTextfield");
22
58
  const InfoBookInitializer_1 = require("../lib/infobook/InfoBookInitializer");
23
59
  const ResourceLoader_1 = require("../lib/resource/ResourceLoader");
24
60
  const HtmlInfoBookSerializer_1 = require("../lib/serialize/HtmlInfoBookSerializer");
25
61
  // Process CLI args
26
- const args = minimist(process.argv.slice(2));
62
+ const args = (0, minimist_1.default)(process.argv.slice(2));
27
63
  if (args.help || (args._.length !== 2 && args._.length !== 3)) {
28
64
  process.stdout.write(`generate-cyclops-infobook-html Output Cyclops infobooks as HTML
29
65
  Usage:
@@ -36,7 +72,7 @@ Options:
36
72
  function create() {
37
73
  return __awaiter(this, void 0, void 0, function* () {
38
74
  // Create infobook from config
39
- const config = JSON.parse(fs.readFileSync(args._[0], "utf8"));
75
+ const config = JSON.parse(fs.readFileSync(args._[0], 'utf8'));
40
76
  // Override baseUrl
41
77
  if (args._.length === 3) {
42
78
  config.baseUrl = args._[2];
@@ -61,7 +97,7 @@ function create() {
61
97
  yield resourceLoader.loadIcons('icon');
62
98
  yield resourceLoader.loadItemTranslationKeys('registries');
63
99
  yield resourceLoader.loadFluidTranslationKeys('registries');
64
- yield resourceLoader.loadKeybindings(config.keybindings);
100
+ resourceLoader.loadKeybindings(config.keybindings);
65
101
  yield resourceLoader.loadAll(process.cwd(), 'mod_assets', config.excludedModLanguages || []);
66
102
  // Setup infobook loader
67
103
  const infoBookInitializer = new InfoBookInitializer_1.InfoBookInitializer(config);
@@ -76,7 +112,8 @@ function create() {
76
112
  const headSuffixGetters = [];
77
113
  if (config.plugins) {
78
114
  for (const pluginPath of config.plugins) {
79
- const plugin = require((0, path_1.join)(process.cwd(), pluginPath));
115
+ // eslint-disable-next-line ts/no-require-imports, ts/no-var-requires, ts/no-unsafe-assignment
116
+ const plugin = require((0, node_path_1.join)(process.cwd(), pluginPath));
80
117
  plugin.load(infoBookInitializer, resourceLoader, config);
81
118
  if (plugin.assetsPath) {
82
119
  assetsPaths.push(plugin.assetsPath);
@@ -89,7 +126,7 @@ function create() {
89
126
  // Find all available mods
90
127
  const mods = (yield fs.promises.readdir('server/mods'))
91
128
  .filter((mod) => mod.endsWith('.jar'))
92
- .map((mod) => mod.substr(0, mod.length - 4));
129
+ .map((mod) => mod.slice(0, Math.max(0, mod.length - 4)));
93
130
  // Initialize book
94
131
  const infoBook = yield infoBookInitializer.initialize(resourceLoader.getResourceHandler());
95
132
  // Convert info book to HTML
@@ -104,7 +141,6 @@ function create() {
104
141
  });
105
142
  }
106
143
  create().catch((e) => {
107
- // tslint:disable-next-line:no-console
108
144
  console.error(e);
109
145
  process.exit(1);
110
146
  });
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
37
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
38
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,24 +42,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
43
  });
11
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
12
48
  Object.defineProperty(exports, "__esModule", { value: true });
13
- const fs = require("fs");
14
- const minimist = require("minimist");
15
- const path_1 = require("path");
49
+ const fs = __importStar(require("node:fs"));
50
+ const node_path_1 = require("node:path");
51
+ const minimist_1 = __importDefault(require("minimist"));
16
52
  const ModLoader_1 = require("../lib/modloader/ModLoader");
17
53
  // Process CLI args
18
- const args = minimist(process.argv.slice(2));
54
+ const args = (0, minimist_1.default)(process.argv.slice(2));
19
55
  if (args.help || args._.length !== 2) {
20
56
  printUsage();
21
57
  }
22
58
  function run(command, configPath) {
23
59
  return __awaiter(this, void 0, void 0, function* () {
24
60
  // Create mod loader
25
- const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
61
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
26
62
  const modLoader = new ModLoader_1.ModLoader({
27
63
  mods: config.mods,
28
- path: (0, path_1.join)(process.cwd(), 'server'),
29
- loader: 'forge' in config ? { versionForge: config.forge } : { versionNeoForge: config.neoforge },
64
+ path: (0, node_path_1.join)(process.cwd(), 'server'),
65
+ loader: 'forge' in config ?
66
+ { versionForge: config.forge } :
67
+ { versionNeoForge: config.neoforge },
30
68
  versionMinecraft: config.minecraft,
31
69
  });
32
70
  switch (command) {
@@ -38,13 +76,13 @@ function run(command, configPath) {
38
76
  break;
39
77
  case 'extractmc':
40
78
  yield modLoader.extractMinecraftAssets();
41
- yield modLoader.copyModAssets((0, path_1.join)(process.cwd(), 'mod_assets'));
79
+ yield modLoader.copyModAssets((0, node_path_1.join)(process.cwd(), 'mod_assets'));
42
80
  break;
43
81
  case 'extractmods':
44
82
  yield modLoader.extractModsAssets();
45
- yield modLoader.copyModAssets((0, path_1.join)(process.cwd(), 'mod_assets'));
83
+ yield modLoader.copyModAssets((0, node_path_1.join)(process.cwd(), 'mod_assets'));
46
84
  break;
47
- case 'generate':
85
+ case 'generate': {
48
86
  if (!modLoader.isForgeInstalled()) {
49
87
  yield modLoader.installForge();
50
88
  yield modLoader.acceptEula();
@@ -65,17 +103,18 @@ function run(command, configPath) {
65
103
  catch (error) {
66
104
  lastError = error;
67
105
  process.stdout.write('Failed to start server, retrying after delay...\n');
68
- yield new Promise((resolve) => setTimeout(resolve, 5000));
106
+ yield new Promise(resolve => setTimeout(resolve, 5000));
69
107
  }
70
108
  } while (attempts++ < 5);
71
109
  if (lastError) {
72
110
  throw lastError;
73
111
  }
74
- yield modLoader.copyRegistries((0, path_1.join)(process.cwd(), 'registries'));
112
+ yield modLoader.copyRegistries((0, node_path_1.join)(process.cwd(), 'registries'));
75
113
  yield modLoader.extractMinecraftAssets();
76
114
  yield modLoader.extractModsAssets();
77
- yield modLoader.copyModAssets((0, path_1.join)(process.cwd(), 'mod_assets'));
115
+ yield modLoader.copyModAssets((0, node_path_1.join)(process.cwd(), 'mod_assets'));
78
116
  break;
117
+ }
79
118
  default:
80
119
  printUsage();
81
120
  break;
@@ -92,7 +131,6 @@ Options:
92
131
  process.exit(1);
93
132
  }
94
133
  run(args._[1], args._[0]).catch((e) => {
95
- // tslint:disable-next-line:no-console
96
134
  console.error(e);
97
135
  process.exit(1);
98
136
  });
package/index.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- export * from "./lib/icon/IconsCompressor";
2
- export * from "./lib/icon/IconsGenerator";
3
- export * from "./lib/infobook/appendix/IInfoBookAppendixHandler";
4
- export * from "./lib/infobook/appendix/InfoBookAppendixAd";
5
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe";
6
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards";
7
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe";
8
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe";
9
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerImage";
10
- export * from "./lib/infobook/appendix/InfoBookAppendixHandlerKeybinding";
11
- export * from "./lib/infobook/appendix/InfoBookAppendixTagIndex";
12
- export * from "./lib/infobook/FileWriter";
13
- export * from "./lib/infobook/IFileWriter";
14
- export * from "./lib/infobook/IFluid";
15
- export * from "./lib/infobook/IInfoAppendix";
16
- export * from "./lib/infobook/IInfoBook";
17
- export * from "./lib/infobook/IInfobookPlugin";
18
- export * from "./lib/infobook/IInfoSection";
19
- export * from "./lib/infobook/IItem";
20
- export * from "./lib/infobook/InfoBookInitializer";
21
- export * from "./lib/modloader/ModLoader";
22
- export * from "./lib/parse/XmlInfoBookParser";
23
- export * from "./lib/resource/ResourceHandler";
24
- export * from "./lib/resource/ResourceLoader";
25
- export * from "./lib/serialize/HtmlInfoBookSerializer";
1
+ export * from './lib/icon/IconsCompressor';
2
+ export * from './lib/icon/IconsGenerator';
3
+ export * from './lib/infobook/appendix/IInfoBookAppendixHandler';
4
+ export * from './lib/infobook/appendix/InfoBookAppendixAd';
5
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe';
6
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards';
7
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe';
8
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe';
9
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerImage';
10
+ export * from './lib/infobook/appendix/InfoBookAppendixHandlerKeybinding';
11
+ export * from './lib/infobook/appendix/InfoBookAppendixTagIndex';
12
+ export * from './lib/infobook/FileWriter';
13
+ export * from './lib/infobook/IFileWriter';
14
+ export * from './lib/infobook/IFluid';
15
+ export * from './lib/infobook/IInfoAppendix';
16
+ export * from './lib/infobook/IInfoBook';
17
+ export * from './lib/infobook/IInfobookPlugin';
18
+ export * from './lib/infobook/IInfoSection';
19
+ export * from './lib/infobook/IItem';
20
+ export * from './lib/infobook/InfoBookInitializer';
21
+ export * from './lib/modloader/ModLoader';
22
+ export * from './lib/parse/XmlInfoBookParser';
23
+ export * from './lib/resource/ResourceHandler';
24
+ export * from './lib/resource/ResourceLoader';
25
+ export * from './lib/serialize/HtmlInfoBookSerializer';