Follow these steps to set up your environment for building and testing your module:
- Install LynxHub using one of the following options:
- Locate the app data folder:
- Launch LynxHub
- Navigate to the Settings page
- Go to Data Management -> Data
- Note: You can change the path in this section if desired
- Create a module folder:
- Open the
Modules
folder in the app data directory - Create a new folder for your module
- Open the
- Develop and build your module
- Install your module:
- Place your built module data inside the folder you created in step 3
- Restart LynxHub
- Verify module loading:
- Your module should now be loaded and ready to use
- If you don't see your module, check the main and renderer console logs for any errors
-
Clone the repository:
git clone https://github.com/KindaBrazy/LynxHub-Module-Guide cd LynxHub-Module-Guide
-
Install dependencies:
npm i
-
Configure module information:
- Edit the lynxModule.json file with your module details
- Refer to the lynxModule.json tips for guidance
-
Set up compilation path:
- In index.js, update the
compiledPath
variable (line 9) with your module's path in the app data folder:const compiledPath = path.join('C:\\Users\\USERNAME\\Documents\\LynxHub\\Modules\\YourModuleName');
- In index.js, update the
-
Implement renderer functionality:
- Edit the renderer.ts file
- Check renderer.ts tips
-
Implement main process functionality:
- Edit the main.ts file
- Check main.ts tips
-
Custom Update and Installation Stepper:
- For advanced installation steps using the stepper, refer to the Installation Stepper Tips.
- For advanced updating steps using the stepper, refer to the Update Stepper Tips.
-
Build and install your module:
- Automatic build and install:
npm run build:move
- Manual build and install:
Then copy lynxModule.json and the compiled
npm run build
scripts
folder to the app modules folder
- Automatic build and install:
Important
For LynxHub to recognize your module, ensure the following structure:
Root folder
lynxModule.json
filescripts
folder
Inside scripts folder
renderer.mjs
filemain.mjs
file
For detailed information on data types and descriptions, refer to the types.d.ts file. Additional important information not covered in the d.ts file or JSON will be explained below.
lynxModule.json Tips
Fill this file with your repository and information
id
: Unique identifier for your module to prevent conflictsrequireAppBuild
: The LynxHub build number your module is compatible with- Find this in the app under Settings -> About
- Used to check compatibility if the module API changes in future updates
repoUrl
: GitHub repository URL for cloning and updating your module- Where lynxModule.json file exist
changeLog
: Document update changes- Use
\n
for line breaks (other escape characters like\t
are not supported)
- Use
owner
: Is the WebUI or the repository provided by this module owned by you?
renderer.ts Tips
- Must have a default export
- Executes in the Electron renderer process (browser environment)
- Use this file for UI-related functionality and user interactions
- The
setCurrentBuild
method is called within the app, passing the current build number as a parameter.- Use this build number to enable or disable any web UI features or functionality that are incompatible with the current LynxHub version.
main.ts Tips
- Must have a default export
- Executes in the Electron main process (Node.js environment)
- Use this file for system-level operations and background tasks
- The
setCurrentBuild
method is called within the app, passing the current build number as a parameter.- Use this build number to enable or disable any web UI features or functionality that are incompatible with the current LynxHub version.
Follow this general stepper order for installation (although you can customize the order to fit your needs):
- Remove or don't add this method to the
CardRendererMethods
export so app use usual simplegit clone
for installation
Tip
The initialSteps
method must be called first. Use setInstalled
once the installation is complete, and
showFinalStep
when the entire process is finished.
stepper.initialSteps
:Initialize the stepper UI by passing an array of step titles. These titles will be displayed in the stepper modal.stepper.starterStep
: Set up the initial screen where the user chooses between "Install" or "Locate".- If the user selects "Locate", the returned promise will contain the
targetDirectory
. - Use
stepper.utils
for validation, then callstepper.setInstalled
to mark the installation as complete on the card.
- If the user selects "Locate", the returned promise will contain the
stepper.nextStep
: Progress to the next step by calling this method. It updates the stepper to reflect the current step.- Perform the Installation: Carry out the installation steps such as
cloneRepository
,downloadFileFromUrl
, orrunTerminalScript
.- Tip: Always call
nextStep
after completing each installation step.
- Tip: Always call
stepper.setInstalled
: Once installation and validation are complete, call this method with the installation directory to mark it as installed.stepper.showFinalStep
: Display the final message to the user, indicating success or failure with a 'success' or ' error' status.
Note
To simplify the installation process, do not include the startInstall
method in the CardRendererMethods
export.
This ensures the app will default to using a simple git clone
approach for installation.
Important
As of build 11 (V1.3.0)
, you can use the startInstall
method (from the CardRendererMethods
export) to access
advanced installation options with the stepper.
To update the web UI with stepper, use the startUpdate
method with the provided stepper
and dir
, following
the same flow as described in the Installation Stepper Tips.
- In the
updateAvailable
method, check if an update is available. This method returnstrue
if an update is found, otherwisefalse
.
Note
To simplify the updating process, set manager.updater.updateType
to 'git'. This ensures the app will default to
using a simple git pull
approach for updating.