Aurelia 2 Plugin Sample or Docs

I would like to update a Plugin from Aurelia 1, to Aurelia 2.

This is the plugin I would like to convert: https://github.com/AmericanPowerAndGas/aurelia-syncfusion-bridge

I have looked in the V2 docs, but the docs are just a placeholder at this time: [https://docs.aurelia.io/advanced-scenarios/shipping-your-own-aurelia-plugin]

Is there a sample plug-in for V2 so that I can use that to see what needs to be done? Or some sort of doc or guidance so I can move forward with this?

1 Like

Maybe first try to write a simple one in https://gist.dumber.app first and share here? We can try to discuss a bit more. I’m not aware of any guide, since mostly it’s the same:

@customElement(...)
export class MyElement {

}
.bind
.two-way
${...}
1 Like

I mean an actual plug-in, not a custom element. Aurelia 1 Plugin

For example, in Aurelia 1, this is the Aurelia-Dialog plugin which gets registered in boot.ts:

aurelia.use.plugin(PLATFORM.moduleName('aurelia-dialog'))

By the way, thanks for the tip on gist.dumber.app, I was unaware of that :slight_smile:

1 Like

Hi @gregoryagu. As you already know from Au1, there is not much special about the plugin, except the plugin’s configuration function, which is used during bootstrap, to setup global resources, and configuration options.

The same goes also for Au2. As an example, take a look at the i18n plugin in Au2:

The most interesting thing here is the register method. During "bootstrap"ing phase, an instance of IContainer is passed on to this. You can use that to register “global resources”, such as custom elements/attributes, value converters, binding behavior etc.

And then where this plugin is used, you do something like this:

container.register(I18nConfiguration);

If you allow customization from the client code, you can also do so. Clients may choose to setup the configuration by themselves completely ignoring your OOTB configurations. Or you may choose ease up the situation by exposing APIs to customize. In the example above, this is done in the customize method.

If you are not already familiar with the Au2 API, you may take a look here on how to migrate your CEs: https://docs.aurelia.io/getting-started/components#working-without-conventions.

And that’s all! Have fun with Au2 :slight_smile:

3 Likes

@gregoryagu

You can consider this project too (Aurelia 2 + Lerna)

Definition

Usage

Configuration

I think it is easy to follow. (More easier than version 1)

4 Likes