Enabling plugins

Enable plugins by using nocto-config

How to enable plugin?

Existence of plugin in your project does not mean that it is enabled by default. Nocto differentiates this by using nocto-config.ts for enabling plugins.

The reason of such way working comes from the fact that you shall be able to disable (hide) default plugins which comes from Nocto. Finally, you have freedom what to enable or disable, even if implementation is there.

Enable of plugin is simple - its ID shall visible in nocto-config.ts. You have two places where you can enable plugin: sidebar and plugins. Let's take this structure as example:

import { NoctoConfig } from "@rsc-labs/noctojs-plugin-system"
import {
  Sparkles,
} from "@medusajs/icons"

export const noctoConfig: NoctoConfig = {
  plugins: {
    "@login": {
      config: {
        title: "Welcome to Nocto",
        hint: "Sign in to access",
        mainIcon: Sparkles
      }
    },
    "@orders": {},
    "@order-detail": {},
    "@campaigns-routes": {},
    "@categories-routes": {},
    "@collections-routes": {},
    "@core-routes": {},
    "@customer-groups-routes": {},
    "@public-routes": {},
    "@reservations-routes": {},
    "@settings-routes": {}
  },
  sidebar: {
    "@orders": { order: 1 },
    "@products": { order: 2 },
    "@inventory": { order: 3 },
    "@customers": { order: 4 },
    "@promotions": { order: 5 },
    "@price-lists": { order: 6 },
  }
}

You can see a lot of plugins there - all of them are enabled because of their presence. You can also notice that @orders plugin is duplicated - that's totally fine, because plugins sections is for configuring plugins, while sidebar section is to configure a sidebar. Because @orders does not have any configuration in plugins section, it can be removed from there.

Consistency:

In practice, above structure is just a proposal. Please be aware that you have full control even over nocto-config.ts. When using CLI setup, you are getting utils.ts file which is used for loading plugins and it assumes above structure. But, if you want to change it - feel free, but you need to properly use registries to register all plugins.