-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Breaking change]: Extension Manifest Type Architecture + Constants/Modal Tokens/Types moved to their package #22
Comments
@nielslyngsoe Thanks for a great summary of the changes needed for packages on v15! I have a package for which I'll make it possible for other packages/extensions to provide extensions. I have this working on v14 and now looking at migrating to v15. It would be very valuable to understand the reasoning behind the changes made in the core so that package developers can understand how to best provide types in scenarios like the one above. I have a couple of questions and I would love to get your feedback. On a general level, what did you gain by moving all extension types to If I understand things right, extension types used to be exported together with the "feature" that hosted the extension. Basically they would be scattered around the code base. If it better in any way to keep them all in one place? What does this actually do? Does it do a implicit import of all types in from
Are there any guidelines or recommendations around this for package developers like me that want to expose types for others to use? Thank you so much! |
Hi @enkelmedia Thanks for asking — at first I read the article above and did a few optimizations as some of the sentences could be rephrased for the better. Not that I changed much, but it hopefully makes it easier for others to read.
With that you can write this in your project, and the Extension Type coming from Umbraco Commerce would be a valid choice.
I'm sorry we do not have a guideline for this at the moment, but its a good idea. Generally, its about making a Import Map that exposes the Extension Type Types. This can be a single file that contains the additions you want to make to the global interface hope that answers your questions, if I missed please let me know. This is also helpfull for me in terms of getting the right knowledge to write a good documentation article about this. Thanks in advance |
Hi! Thank you Niels! For updating the answer and trying to make things more clear. I still nee to straight things out =D Sorry for "stupid" questions :). In the example your showing to the import is moved:
Then your writing
As I understand that last part, any use of So as a concrete example, when using a extension point in a const before : ManifestWorkspace = {
type: "workspace",
kind : "routable",
name: "My Cars Workspace",
alias: "My.Workspace.Cars",
api: () => import('./my-cars-workspace.context.js'),
meta: {
entityType : 'my-car'
}
};
const after : UmbExtensionManifest = {
type: "workspace",
kind : "routable",
name: "My Cars Workspace",
alias: "My.Workspace.Cars",
api: () => import('./my-cars-workspace.context.js'),
meta: {
entityType : 'my-car'
}
} Or should we keep using I understand that as a package developer I need to ensure to export a import map like The docs for v15 still shows a lot of examples that does not use Cheers! :) Edit:
|
Description
In Umbraco 15, various parts are moved into their respective package, instead of declared centrally in the core, which means many import map/paths are not valid any longer in v.15.
This is done to enable extensions to bring their parts in the same maner as the Core. Enabling Extension Types from Packages to be available for other Packages as long as that Package is declared as a dependency. More on that below.
Imports:
Modal Tokens, Constants, Various TypeScript Types & Extension Manifest Types are moved into their respective package/import map. This means you need to update their import path — Ideally use an IDE that can update this automatically. Remove the import and ask the IDE to import again ( Follow the guide in
TypeScript configuration
below. This will have a positive effect on how well your IDE can pick up the Import Paths.)Example for the
Link Picker Modal Token
:Before it was imported here:
import { UMB_LINK_PICKER_MODAL } from '@umbraco-cms/backoffice/modal';
Now it will be imported from here:
import { UMB_LINK_PICKER_MODAL } from '@umbraco-cms/backoffice/multi-url-picker';
TypeScript configuration:
To be able to use the new Extension Manifest Types, you will need to update the
tsconfig.json
to include the extension-types from backoffice.To do so add
"@umbraco-cms/backoffice/extension-types"
tocompilerOptions->types
If you want to be using extension types from other packages, they should be included in the same maner.
(Notice if you are a package author, and would like others to extend your Package, you should expose the declared Extension Manifest Types via such import map)
Using Extension Manifest Types:
The use of
ManifestTypes
, should be replaced with a global type calledUmbExtensionManifest
(which does not need an import once the TypeScript config includes the backoffice extension types. — The main reasoning for a global type is that this type is not exclusive for Core Extension Types, making it possible for other Packages to declare Manifest Types.If you are looking for specific types, then they must correct their import path to their respective package/import map.
But notice how the specific types are not knowledgable of the additional Kinds of its type, so to be able to use Kinds you must use the
UmbExtensionManifest
type.Example for the
Dashboard Extension Manifest Type
:Before it was imported here:
import type { ManifestDashboard } from '@umbraco-cms/backoffice/extension-registry';
Now it will be imported from here:
import type { ManifestDashboard } from '@umbraco-cms/backoffice/dashboard';
Declaring Extension Manifest Types:
When declaring a new Extension Manifest Type, it must be appended to the Global Extension Manifest Type Map. Here is an example:
Make sure both your manifest-type and your property-name in the UmbExtensionManifestMap is unique (use a unique Prefix for your extension types.)
Declaring Extension Condition Configuration Types:
When declaring a new Extension Condition Type, you must now ensure to additionally declare a configuration type in a global type map specifically for Condition Configuration Types.
Even if you do not have any configuration properties — otherwise the condition will not show up as a valid option.
Example of a Condition Configuration Type:
Notice 'Prefix.Condition.AnimalType' is the alias of the Condition.
Version
Umbraco 15
Previous behavior
Had collected things in one core package, such imports will change.
New behavior
All Extension Manifest Types via a Global Type called
UmbExtensionManifest
. Other things from their respective package.Type of breaking change
Reason for change
Package developers had near to no good opportunities when declaring their own Extension Manifest Types.
This gives them ability to easily declare such and opens up for Packages to extend Packages.
Recommended action
Use
UmbExtensionManifest
instead ofManifestTypes
. Configure your tsconfig for global types. Update various imports to import from the respective package of the part.Affected APIs
Extension Registry, Modal Tokens, Constants and TypeScript Types, Import Maps.
The text was updated successfully, but these errors were encountered: