Docs

Build & Publish

Once your extension is developed and tested, you can publish it for others to use. The publishing process is primarily for public extensions and is managed through GitHub.

Extension Code Recommendations

Sliprail extensions are recommended to be developed using pure JavaScript or ES modules (.js or .mjs files). The advantages of using pure JavaScript include:

  • No build step required: Pure JavaScript code can run directly, simplifying the development workflow
  • Faster development iteration: No need to recompile after code changes
  • Simpler maintenance: Reduces complexity of build tools and configurations

If your extension uses TypeScript or other languages that require compilation, you can configure your own build process as needed.

Avoid Blocking the Main Thread

Important Reminder: Extension code runs in Sliprail's main thread. Please ensure your extension code does not block the main thread for extended periods.

  • Avoid synchronous blocking operations: Do not use synchronous file operations, long-running loops, or synchronous network requests
  • Use asynchronous operations: Prefer using async/await or Promises for I/O operations
  • Batch processing: For large data processing, consider processing in batches or using setImmediate/setTimeout for chunked processing
  • Performance optimization: Avoid heavy computations in the main thread; use Worker threads when necessary

Blocking the main thread may cause the Sliprail interface to become laggy, slow to respond, and negatively impact user experience.

Dependency Management

No External Dependencies

If your extension only uses Node.js built-in modules and APIs provided by @sliprail/sdk, no additional build or bundling steps are required.

Using Third-Party Dependencies

If your extension relies on third-party npm packages, please note:

  • Sliprail will not automatically install dependencies for extensions
  • You need to configure your own bundler (such as webpack, esbuild, rollup, etc.)
  • Bundle all dependencies into the final JavaScript or ES module files
  • Ensure the bundled files can run independently without requiring a node_modules directory

When publishing a new version, make sure the code pushed to GitHub includes all bundled files.

Publishing a Public Extension

The process for publishing a public extension is straightforward:

  1. Prepare Your Code: Ensure all required files (manifest.json, extension code, icons, etc.) are ready

  2. Push to GitHub: Push your code to the GitHub repository you specified when registering your extension

  3. Automatic Deployment: Sliprail periodically checks registered extension repositories for updates. When it detects an update, it will automatically pull the latest version

Users will then be able to update to the latest version of your extension in the Sliprail Extension Manager.

Publishing a Private Extension

Private extensions do not need to be published to any platform. They run directly on your machine via the "Load Local Extension" feature. You just need to ensure your code is saved locally.