cyclops-infobook-html 3.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 +7 -0
- package/README.md +5 -0
- package/assets/styles.css +5 -0
- package/bin/generate-infobook-html.js +2 -0
- package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.d.ts +11 -0
- package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.js +24 -0
- package/lib/modloader/ModLoader.d.ts +7 -1
- package/lib/modloader/ModLoader.js +20 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
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
|
+
|
|
4
11
|
<a name="v3.0.0"></a>
|
|
5
12
|
## [v3.0.0](https://github.com/CyclopsMC/infobook-html/compare/v2.0.0...v3.0.0) - 2022-03-10
|
|
6
13
|
|
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
|
@@ -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 = [];
|
|
@@ -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, ' ')
|
|
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
|
|
@@ -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
|
+
}
|
|
@@ -91,27 +91,36 @@ class ModLoader {
|
|
|
91
91
|
process.stdout.write(` - ${fileName} from CurseForge...\n`);
|
|
92
92
|
const url = `https://minecraft.curseforge.com/api/maven/${mod.project}/${mod.artifact
|
|
93
93
|
.replace(/-/g, '/')}/${fileName}`;
|
|
94
|
-
|
|
95
|
-
if (response.status !== 200) {
|
|
96
|
-
throw new Error(response.statusText + ' on ' + url);
|
|
97
|
-
}
|
|
98
|
-
yield new Promise((resolve, reject) => {
|
|
99
|
-
response.body
|
|
100
|
-
.on('error', reject)
|
|
101
|
-
.on('end', resolve)
|
|
102
|
-
.pipe(fs.createWriteStream(path_1.join(modsDir, fileName)));
|
|
103
|
-
});
|
|
94
|
+
yield this.downloadFile(url, fileName, modsDir);
|
|
104
95
|
}
|
|
105
96
|
else if (mod.type === 'maven') {
|
|
106
97
|
process.stdout.write(` - ${mod.artifact} from ${mod.repo}...\n`);
|
|
107
98
|
yield mvn_artifact_download_1.default(mod.artifact, modsDir, mod.repo);
|
|
108
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
|
+
}
|
|
109
104
|
else {
|
|
110
105
|
throw new Error('Unknown mod type ' + mod.type);
|
|
111
106
|
}
|
|
112
107
|
}
|
|
113
108
|
});
|
|
114
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
|
+
}
|
|
115
124
|
/**
|
|
116
125
|
* Start the server and execute a command to dump all registries
|
|
117
126
|
*/
|
|
@@ -135,7 +144,7 @@ class ModLoader {
|
|
|
135
144
|
});
|
|
136
145
|
// Once the loading is complete, send our command and stop the server
|
|
137
146
|
proc.stdout.on('data', (line) => {
|
|
138
|
-
if (line.indexOf('
|
|
147
|
+
if (line.indexOf('Done') >= 0 && line.indexOf('For help, type "help"') >= 0) {
|
|
139
148
|
process.stdout.write('Dumping registries...\n');
|
|
140
149
|
this.sendCommand(proc, '/cyclopscore dumpregistries');
|
|
141
150
|
this.sendCommand(proc, '/stop');
|