Umbraco-package.json vs UmbExtensionManifest

Ok I think I need some example to make it more clear.
I have a bundle manifest file that looks like this:

//bundle.manifest.ts
import { manifests as entrypoints } from './entrypoints/manifest';
import { manifests as dashboards } from './dashboards/manifest';
import { manifests as propertyeditors } from './propertyeditors/manifest';
import { manifests as workspaces } from './workspaces/manifest';

// Job of the bundle is to collate all the manifests from different parts of the extension and load other manifests
// We load this bundle from umbraco-package.json
export const manifests: Array<UmbExtensionManifest> = [
    ...entrypoints,
    ...dashboards,
    ...propertyeditors,
    ...workspaces
];

This is the starting point for my vite application that will be used to generate a bundle. Each of these individual manifest that are references here look like this for example:

// Registers the workspace, which is the settings workspace for content expiration
export const manifests: Array<UmbExtensionManifest> = [
{
    type: 'workspaceView',
    name: 'example workspace view',
    alias: 'proudnerds.example.workspace.app',
    weight: 101, //The 'info' tab has a weight of 100, the 'content' tab 200
    element: () => import('./example-workspace-view'),
    meta: {
        label: 'Example',
        pathname: 'example',
        icon: 'icon-chip',
    },
    conditions: [
        {
            "alias": "Umb.Condition.WorkspaceAlias",
            "match": "Umb.Workspace.Document"
        }
    ]
}];

So using the extension manifest, I can register extensions in various placed to keep everything organized. Once Vite had generated a bundle, I can just use that bundle in my umbrac-package.json:

{
	"$schema": "../../umbraco-package-schema.json",
	"id": "ProudNerds.Umbraco.AI",
	"name": "Umbraco AI",
	"version": "GetsGenerated",
	"extensions": [
		{
			"name": "Example",
			"alias": "ProudNerds.Example",
			"type": "bundle",
			"js": "/App_Plugins/ProudNerds.Example/example.js"
		}
	]
}

This keeps the umbraco-package.json clean. Also, it helps that the extensions are build into the bundle, so there is compile time checking if something is wrong with it.

3 Likes