The WoltLabCompiler allows you to compile WoltLab-Packages and WoltLab-Package components written in JavaScript.
All classes and methods are documented using JSDoc-comments.
import Path = require("path");
import { ACPOptionInstruction, ApplicationFileSystemInstruction, OptionType, Package, PackageCompiler } from "woltlab-compiler";
(async () =>
{
let compiler = new PackageCompiler(
new Package(
{
Name: "MyPackage",
DisplayName: {
inv: "My Package"
},
Identifier: "com.example.my-package",
InstallSet: {
Directory: "install",
Instructions: [
new ApplicationFileSystemInstruction(
{
Application: "wcf",
Source: Path.join(__dirname, "..", "assets", "files", "wcf")
}),
new ACPOptionInstruction(
{
FileName: "acpOptions.xml",
Nodes: [
{
Name: "my-package",
Item: {
DisplayName: {
de: "Mein Paket",
en: "My Package"
},
Options: [
{
Name: "enabled",
DisplayName: {
de: "Aktiviert",
en: "Enabled"
},
Description: {
de: "Aktiviert `Mein Paket`",
en: "Enables `My Package`"
},
Type: OptionType.CheckBox
}
]
}
}
]
})
]
}
}));
compiler.DestinationPath = Path.join(__dirname, "..", "bin", "MyPackage.tar");
await compiler.Execute();
})();
import Path = require("path");
import { LocalizationSetCompiler } from "./System/Compilation/Globalization/LocalizationSetCompiler";
import { TranslationInstruction } from "./System/PackageSystem/Instructions/Globalization/TranslationInstruction";
(async () =>
{
let compiler = new LocalizationSetCompiler(
new TranslationInstruction(
{
FileName: null,
Nodes: [
{
Name: "my",
Nodes: [
{
Name: "package",
Nodes: [
{
Name: "forms",
Nodes: [
{
Name: "main",
Nodes: [
{
Name: "title",
Item: {
Translations: {
de: "Haupt-Formular",
en: "Main Formular"
}
}
}
]
}
]
}
]
}
]
}
]
}).GetMessages());
compiler.DestinationPath = Path.join(__dirname, "..", "bin", "translations");
await compiler.Execute();
})();
There are many more features, compilers and components you may want to work with.
Have a look at the JSDoc-comments which are displayed automatically when working with an extended code-editor.