# woltlab-compiler

> A compiler for WoltLab-Package Archives and WoltLab-Package Components

Latest version **1.0.4** (published 2019-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install woltlab-compiler
pnpm add woltlab-compiler
yarn add woltlab-compiler
bun add woltlab-compiler
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-08-06 |
| First published | 2018-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 419.4 KB |
| Known vulnerabilities | 0 (+29 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Manuel Thalmann |
| Maintainers | manuth |
| Keywords | WoltLab, wsc, WoltLab Suite Core, wcf, WoltLab Community Framework, Compiler, TypeScript |

## Links

- npm: https://www.npmjs.com/package/woltlab-compiler
- Repository: https://github.com/manuth/WoltLabCompiler
- Homepage: https://github.com/manuth/WoltLabCompiler#readme
- Issues: https://github.com/manuth/WoltLabCompiler/issues
- npm.io page: https://npm.io/package/woltlab-compiler

## Dependencies (10)

- [tar](https://npm.io/package/tar.md) ^4.4.10
- [upath](https://npm.io/package/upath.md) ^1.1.2
- [mem-fs](https://npm.io/package/mem-fs.md) ^1.1.3
- [xmldom](https://npm.io/package/xmldom.md) ^0.1.27
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [colornames](https://npm.io/package/colornames.md) ^1.1.1
- [hex-to-rgba](https://npm.io/package/hex-to-rgba.md) ^2.0.1
- [mem-fs-editor](https://npm.io/package/mem-fs-editor.md) ^6.0.0
- [temp-filesystem](https://npm.io/package/temp-filesystem.md) ^1.1.3
- [sass-variable-parser](https://npm.io/package/sass-variable-parser.md) ^1.2.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-08-06
- 1.0.3 — 2019-06-16
- 1.0.1 — 2018-12-08
- 1.0.0 — 2018-12-06

## README

# WoltLabCompiler
A compiler for WoltLab-Package Archives and WoltLab-Package Components

## Installing WoltLabCompiler
`WoltLabCompiler` can be installed using the `npm`-cli:

```bash
npm install --save woltlab-compiler
```

## Using WoltLabCompiler
The WoltLabCompiler allows you to compile WoltLab-Packages and WoltLab-Package components written in JavaScript.  
All classes and methods are documented using JSDoc-comments.

### Examples
***Compiling a .tar-Package***
```ts
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();
})();
```

This creates a `.tar`-package called `MyPackage.tar`.

***Compiling a set of Localizations***
```ts
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();
})();
```

This will create a language file for each language in the `TranslationInstruction` (in this case `de` and `en`):
  - `translations/de.xml`
  - `translations/en.xml`

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.

---
_Source: https://npm.io/package/woltlab-compiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
