@scayle/add-on-utils
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@scayle/add-on-utils

A small set of utilities that can be helpful for building cloud panel add-ons

Install

npm i --save @scayle/add-on-utils

Functions

config

The config function can be used in the manifest file to add type-checking to the exports.

import { config } from "@scayle/add-on-utils";

export default config(function(registerApplication, registerRoutes) {
    /* ... */
});

mockCustomProps

The mockCustomProps function creates a dummy version of the add-on custom props. If you’re using Jest and Vue test utils, you can install it in your setup script like so:

const { config } = require('@vue/test-utils');
const { AddOnPropsPlugin, mockCustomProps } = require('@scayle/add-on-utils');

config.global.plugins = [[AddOnPropsPlugin, {customProps: mockCustomProps()}]];

Other

AddOnPropsPlugin

The package also contains a Vue plugin, AddOnPropsPlugin which creates a global $addOn object with all the add-on custom props.

It can be combined with mockCustomProps for unit tests or standalone apps, or used with single-spa-vue to expose the actual add-on custom props.

const vueLifecycles = singleSpaVue({
    /* ...*/
    handleInstance(instance, props) {
        instance.use(AddOnPropsPlugin, { customProps: props });
    },
});

export const { bootstrap, mount, unmount } = vueLifecycles;

Readme

Keywords

none

Package Sidebar

Install

npm i @scayle/add-on-utils

Weekly Downloads

67

Version

2.1.0

License

none

Unpacked Size

28 kB

Total Files

7

Last publish

Collaborators

  • p-r-scayle
  • kyosifov
  • cloud-panel-ay
  • marcel-domke-ay
  • hector_gonzalez_ay