Simple JS Package
This guide extends the Simple Package walkthrough with an actual script instead of plain shell commands — a Node.js script that runs the same way on every platform, no compilation needed.
Package Structure
1my-package/
2├── .aux4 # Package metadata and commands (REQUIRED)
3├── LICENSE # License file (REQUIRED)
4├── README.md # Package documentation (REQUIRED)
5├── RELEASE.md # Release notes for this version (recommended)
6└── lib/ # Script files (optional)
7 └── slug.jsStep 1: Create the Package
Create the directory structure
1mkdir -p slug/lib
2cd slugCreate the script
1cat > lib/slug.js << 'EOF'
2const text = process.argv[2] || "";
3const slug = text
4 .toLowerCase()
5 .trim()
6 .replace(/[^a-z0-9]+/g, "-")
7 .replace(/^-+|-+$/g, "");
8console.log(slug);
9EOFCreate the .aux4 file
Reference the script with ${packageDir}, which resolves to the package's installation directory (~/.aux4.config/packages/<scope>/<name>/):
1{
2 "scope": "myorg",
3 "name": "slug",
4 "version": "1.0.0",
5 "description": "Convert text into a URL-friendly slug",
6 "license": "MIT",
7 "profiles": [
8 {
9 "name": "main",
10 "commands": [
11 {
12 "name": "slug",
13 "execute": [
14 "node ${packageDir}/lib/slug.js \"${text}\""
15 ],
16 "help": {
17 "text": "Convert text into a URL-friendly slug",
18 "variables": [
19 {
20 "name": "text",
21 "text": "The text to slugify",
22 "arg": true
23 }
24 ]
25 }
26 }
27 ]
28 }
29 ]
30}Quoting matters here: ${text} is wrapped in \"..\" inside the execute string. Without the quotes, a multi-word value gets word-split by the shell before it reaches process.argv — the script would only ever see the first word.
Create the LICENSE and README.md files
Same as the Simple Package guide — see its Step 1 for the full LICENSE text and the aux4/license shortcut.
Step 2: Test Locally
1aux4 slug "Hello World! This is aux4"1hello-world-this-is-aux4Step 3: Build the Package
1aux4 aux4 pkger build --out ./out .1out/
2└── myorg_slug_1.0.0.zipThe script is bundled into the zip automatically — no separate build step is needed for Node.js, since it runs directly from source.
Step 4: Install from File (Local Testing)
1aux4 aux4 pkger install --fromFile ./out/myorg_slug_1.0.0.zip1aux4 slug "Local Install Test!"1local-install-testStep 5: Publish the Package
1aux4 aux4 login
2aux4 aux4 pkger publish ./out/myorg_slug_1.0.0.zipStep 6: Install from aux4 Hub
1aux4 aux4 pkger install myorg/slugStep 7: Use the Package
1aux4 slug "Ready To Ship"1ready-to-shipOther Languages
The same pattern works for any interpreted language — reference the interpreter and the script's path under ${packageDir}:
1"execute": ["python3 ${packageDir}/lib/slug.py \"${text}\""]If your package needs system-level dependencies (e.g., node or python3 itself must be present), see Package with System Dependencies. If you'd rather ship a compiled binary instead of an interpreted script — so users don't need Node/Python installed at all — see Multi-Platform Package.