Applet

Bajo has a built-in applet system that allows you to run your app as an applet. An applet is a small command-line app that can be embedded inside a plugin, purposefully designed to run a simple task mostly bound to the plugin itself. It is a convenient way to run a plugin's task without having to write a separate script.

Since it is embedded inside a plugin, it behaves like running the whole app but doing only task that you want to run.

Applet needs bajo-cli plugin to be installed and loaded. This is because applet is a command-line app and bajo-cli plugin is specifically designed to provide the necessary command-line interface and function helpers to run command-line based app.

So please make sure that bajo-cli is in your app's package.json file and in the plugins array of your app's config before you run an applet. Otherwise, it will throw an error.

You can run an applet by using the following command:

  • node index.js -a or node index.js --applet to list all available applets and choose one to run
  • node index.js -a <pluginNs> to list all pluginNs only applets and choose one to run
  • node index.js -a <pluginNs:appletName> to run the specific applet directly

On all cases, you might require to provide additional arguments and/or options to the applet.

By default, applet won't show you any log output. This is by design because it could clutter your terminal output. If you insist on seeing the log output, you have to add the --log-applet option.

Note: all standard bajo's command line arguments and options are also available to applet, e.g. --env=prod, --lang=id, --log-level=trace, etc.

Development : Please visit applet development for more details on how to create an applet.