Apostrophe 4.0.0: one important upgrade, and NO other changes at all! #4460
boutell
announced in
Release Notes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you releasing Apostrophe 4.x?
Apostrophe’s admin UI is built on the Vue UI framework. Until recently, it was built on Vue 2.x, which has reached its official end of life. That means there will be no more free upstream support for Vue 2.x from the Vue development team. So, we have migrated ApostropheCMS to the fully supported Vue 3.x release. This ensures ongoing support and also allows admin UI developers to follow new and improved practices when coding with Vue.
Of course, we recognize that our customers’ code needs to be safe and secure and reliable until you upgrade. Therefore we have committed to provide fixes or workarounds for any critical security issues with Apostrophe 3.x and Vue 2.x until April 2025. Note that in practice Vue security issues have been very rare because security is primarily the responsibility of the server (Apostrophe) and not the client (Vue).
As part of releasing Vue 3 support, we are bumping the major version number of Apostrophe from 3.x to 4.x. That might sound like a big deal, so let’s just say it plainly: it’s not a big deal.
We’re doing it purely to ensure we follow semantic versioning best practices, avoiding any inconvenience for customers who have written custom admin UI code that requires modification. However, most projects will not require any modification to work with 4.x other than changing versions in
package.json.There are no changes in Apostrophe 4.x other than the use of Vue 3 for the admin interfaces.
Who should migrate?
That being said, all Apostrophe 3.x projects should be migrated to the 4.x series.
“If it’s not a big deal, why should we migrate?” Because, while we will continue to offer fixes for important security issues in the 3.x series until April 1st, 2025, most development will cease on the 3.x series in the near future. The move isn’t difficult, so we recommend you take care of it sooner rather than later.
We will support Apostrophe 3.x (which is based on Vue 2.x) until April 2025. But since the migration to 4.x is straightforward and our new efforts will be focused there, 3.x support will increasingly be a matter of security fixes only.
Simply put: there’s no rush but we can help you best if you migrate.
For developers: how to upgrade your project
The rest of this announcement is intended for developers, who can
also find this migration guide on our documentation site.
After upgrading Apostrophe will work exactly the same, except as explicitly noted below. You’ll want to make these changes together, and follow them with a single
npm updatecommand.package.json, change your dependency onapostropheto^4.0.0.@apostrophecms-pro/data-set: change to^2.0.0.@apostrophecms-pro/document-versions: change to^2.0.0.@apostrophecms-pro/doc-template-library: change to^2.0.0.@apostrophecms-pro/palette: change to^4.0.0.@apostrophecms-pro/signup: change to^2.0.0.@apostrophecms-pro/advanced-permission: change to^3.0.0. Note that this is based on the new and improved 2.x series in which you can grant individual permissions, so if you are used to the 1.x series with its “roles,” see the documentation for more information about what will change with this upgrade.npm updatecommand. This is necessary to ensure other modules receive required minor or patchlevel version updates.For those who have not customized our admin UI
If you have not created custom admin UI field types, overridden various admin UI Vue components, or otherwise created any code in ui/apos subdirectories of your modules, then you are done. Your project has been upgraded and will work exactly as before. As with any upgrade, we recommend QA in your staging environment before a production release.
Just to be clear… front end code in
ui/srcfolders does not have to change at all. And of course server side code is entirely unaffected by this change.For those who have customized our admin UI
The changes to be made in
ui/aposare surprisingly few in all. Most existing admin UI code can run without modification. Familiar Vue 2 features like single-file components, traditional component structure and mix-ins are still 100% supported by Vue 3.But, often some smaller changes are necessary. Here are the most frequently encountered concerns:
Vue components: stylesheets
Deep selectors have changed
In the
styleelements of your Vue components (look forui/apos/componentssubdirectories in your own code), you will need to modernize anyv-deepselectors:You do not need to touch your
ui/src/index.scssor other stylesheets outside ofui/aposand its Vue components at all.Vue components: JavaScript
v-model props and events have changed
The names of the props and events automatically used by the
v-modelfeature have changed. If you have implemented thev-modelpattern yourself, you will need to update your code:Note that in JavaScript code you would therefore access
this.modelValueinstead ofthis.value.Life cycle events have changed
beforeDestroybecomesbeforeUnmountanddestroyedbecomesunmounted.**Vue.setisn’t necessary anymore**Global functions set and delete, and the instance methods $set and $delete. They are no longer required with proxy-based change detection.
Vue apps
Most projects don’t involve custom Apostrophe Vue “apps,” just custom and overridden Vue components. But, some projects do.
The syntax for instantiating Vue apps has changed in Vue 3. Here’s an example, taken from Apostrophe’s built-in “busy indicator” Vue app:
Important things to note:
createAppfunction, which is new in Vue 3, has been enhanced to automatically register components the same way we did in Vue 2.importit in the usual way, or you can do what we’ve done here, accessing it by name on theapos.vueComponentsobject, which contains all components discovered in theui/apos/componentssubdirectories of any module.Notes on popular Vue libraries used in Apostrophe
Although you normally don’t need to worry about the internal choices we made in our own components, it is worth noting that we replaced certain obsolete packages with new ones that support Vue 3:
@apostrophecms/vue-colorwas replaced by@ckpack/vue-colorvuedraggablewas replaced bysortablejs-vue3v-tooltipwas removed in favor of an internal implementation using@floating-ui/dom(AposContextMenu.vueand the directivev-apos-tooltipwere updated, so they work exactly the same as before).vue-material-design-iconshas been migrated to@apostrophecms/vue-material-design-iconsand packaged for Vue 3, but otherwise left exactly the same so that your icon names will still work without modification.Additional resources
Thanks to the Vue team’s foresight in maintaining such a large degree of backwards compatibility, these notes cover everything most developers will have to do. However, depending on your implementation other changes could be needed. We recommend that you read the Vue 3 official migration guide. Note that we did not use Vue 3’s “compatibility mode” for this migration, as the changes to support Vue 3 fully turned out to be straightforward.
Beta Was this translation helpful? Give feedback.
All reactions