asciidoctor / asciidoctor-chart

A set of Asciidoctor extensions that add a chart block and block macro to AsciiDoc for including charts in your AsciiDoc document.
Other
29 stars 13 forks source link

Transpile to JavaScript using Opal #23

Open ggrossetie opened 2 years ago

ggrossetie commented 2 years ago

And publish to npmjs as @asciidoctor/chart? @asciidoctor/chart-extension?

We should make sure that we are not missing a feature from https://github.com/mogztter/asciidoctor-chart. Once verified, we can deprecated asciidoctor-chart.

ggrossetie commented 1 year ago

We can take inspiration from https://github.com/asciidoctor/asciidoctor-tabs

I guess the package name should be @asciidoctor/chart.

//cc @mojavelinux

mojavelinux commented 1 year ago

I support the name @asciidoctor/chart as its consistent with how we've named major integration extensions (like Asciidoctor Diagram).

mojavelinux commented 1 year ago

There are three key aspects to supporting the transpiled package:

The transpiled code should never be checked into the repository because that file ends up either being out of date or constantly being updated. Neither is ideal.

The npm script could use the opal-compiler via npx instead of having to declare opal-compiler as a dependency. I might switch to that in Asciidoctor Tabs.

mojavelinux commented 1 year ago

Set up an index.js and extensions.js file that require the transpiled code

I prefer to define index.js so the package can be required directly from the CLI (e.g., -r @asciidoctor/chart). I then create an extensions.js file that provides access to the methods needed to register the extension from the API (which index.js uses), as well as access to the extension classes themselves.