@alistigo/artifact-manager
v0.2.1
Published
Artifact configuration management for Alistigo — reads, validates, and resolves artifact config at runtime.
Maintainers
Readme
@alistigo/artifact-manager
The entrypoint to use Alistigo applications in an artifact. Include the manager then give a manager configuration with what application you want + its plugins, options and a document.
Minimal usage
<script src="https://cdn.jsdelivr.net/npm/@alistigo/artifact-manager@0/dist/index.umd.js"></script>
<script id="alistigo-manager-config" type="application/json">
{
"app": "@alistigo/artifact-list"
}
</script>That's it. In this example the manager will load the list application with its default configuration.
Config reference
The #alistigo-manager-config script tag must contain valid JSON matching the @alistigo/artifact-config-format schema.
Only the field app is required.
See @alistigo/artifact-config-format for more details.
Programmatic API
For environments where you control initialization yourself (e.g. a framework or custom boot sequence), import the package as an ES module:
import { init } from "@alistigo/artifact-manager";
init('#selector', {
app: "@alistigo/artifact-list"
});The first argument is a target where to insert the application. The second argument is the artifact-config.
How it works
- The UMD bundle loads and runs immediately (or on
DOMContentLoadedif the script is in<head>) - It reads and parses the JSON in
<script id="alistigo-manager-config" type="application/json"> - Config is validated against
@alistigo/artifact-config-format— aTypeErroris thrown on invalid input - If no
<div id="app">exists, one is appended to<body> - The artifact's UMD bundle is injected as a
<script>tag into<head>and runs, auto-mounting into#app
Error handling
If the config tag is missing or contains invalid JSON or an invalid config shape, the manager renders a red error banner at the top of <body> rather than silently failing:
@alistigo/artifact-manager: Missing required <script id="alistigo-manager-config" ...> tag.