Docs

Project Structure

A well-organized project is the foundation for maintainability and scalability. A Sliprail extension project has a standard structure, with the manifest.json file at its core.

Standard Project Structure

A typical extension project looks like this:

my-extension/
├── main.mjs            # The main entry point for the extension
├── manifest.json       # The extension manifest file
├── icon.svg            # (Optional) The extension's icon
├── node_modules/       # Project dependencies
├── package.json        # Project metadata and scripts
└── README.md           # (Optional) Extension documentation

The manifest.json File

The manifest.json file defines how your extension integrates with the Sliprail system. It contains key information such as its unique identifier, icon, and main entry point.

Here is a simple example of a manifest.json:

{
  "id": "your-extension-id",
  "icon": "icon.svg",
  "main": "main.mjs"
}

Dependency Management

Sliprail does not automatically run npm install for extensions. This means that if your extension uses npm packages, you must bundle all dependencies with your code.

  • Bundle Dependencies: Your build process (which is typically pre-configured in the templates) needs to bundle the code from node_modules into your final output files.
  • Include All Files: When you push to your GitHub repository, make sure all bundled files are included so that the extension can run without requiring any extra installation steps from the user.

This approach ensures that extensions have a consistent and reliable runtime environment on any user's system.