Skip to content

Module Manager

Module Manager allows you to do three things:

  • Install existing node.js modules from NPM repository (www.npmjs.com). The great thing about NodeActa supporting (the most of) Node.js modules is that you don’t have to reinvent the wheel over and over again, when someone else has already done the work for you. You can simply install needed modules from NPM. Even better, you can install multiple versions of the same module.
  • Create a module in NodeActa by importing a single javascript file or a directory containing multiple javascript files (see Import Module button in the picture below).
  • Create a module in NodeActa from your document class definitions, their data, and applications. After creating this kind of module, you can export it to a .najs file and import it into another NodeActa system, making it useful for migrating between systems. For example, you might have Development and Production system instances. Once your app's development is complete, you can export it from Development and import it into Production. We highly recommend having a Test instance as well, where you can verify package imports, as errors during the import process may be irreversible.

Hint

To use installed modules in your apps, simply import them using one of the following methods, depending on the module's implementation:

import * as twain from 'module:node-twain'
or   
var twain = await import('module:node-twain')
or 
var twain = require('module:node-twain')

Note how all modules in NodeActa are imported using 'module:something'.

module manager

Module Editor

To create a module (package) that includes your document classes, documents or records, and apps, use the Module Editor (refer to the image below). To launch the Module Editor, click the New Module button in the Module Manager app. You can add a document class to a module by clicking the Add Class button in the Module Editor's toolbar, as shown in the image below. Similarly, you can add records/documents and apps using the corresponding toolbar buttons.

Hint

You don’t have to manually import all the dependencies for your document classes and apps. Simply add the class or app you're interested in, and the system will automatically include its dependencies. In the example below, adding the SystemManagement.IconManager app also brought in its parent container, SystemManagement, which is itself an app.

module editor

Once you've created a package like this, you can export it as a .najs file and transfer it to another system. On the new system, use the Import Module button to add it to the system (see the first picture above). After importing, you'll need to install it. This is where the Module Editor becomes useful once again. In 'Install Mode,' the Module Editor appears slightly different, allowing you to compare the package’s classes and apps with those already present in your system. You can selectively apply only the changes you want, preserving your existing system customizations.

Warrning

Please be cautious when updating existing document classes and apps, as you may overwrite your system's existing customizations. To avoid this as much as possible, the Module Editor lets you review the exact changes in class definitions and app code before applying them by comparing them to your existing classes and apps.

The picture below shows changes between app's code in the package vs code already existing in the system. Looks like keyDown event handler was introduced with the new app version present in the package. Finally, to apply changes to you system, you have to press Install button.

module editor install