You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the changes will be simple pattern replacements, to do that we need to take into account some base behavior/abilities.
Before we read and change code, we need to format it to ensure no missed patterns due to unexpected formatting.
For every file we visit (JS or PHP) before we get to the petterns, we need to parse the imports and have solid logic (using lexers) to add/remove imports. Then we can read the pattern replacements and apply any import changes that come with based on what the replacement needs.
Detective steps (:p) where we look into code, gather information, delete code, regenerate new code based on gathered info in hopes that no info was lost (tricky, might drop this idea).
Dependencies ✅
composer.json.require.flarum/* ^2.0 (when not set to*)
composer.json.require-dev.flarum/* ^2.0 (when not set to*)
Infra ✅
flarum/framework/.github/workflows/REUSABLE_backend.yml@main or @1.x => @2.x
flarum/framework/.github/workflows/REUSABLE_frontend.yml@main or @1.x => @2.x
phpstan
Frontend
mithril 2.0 -> 2.2
can't find exact instances of this in the code, but the more common instance is a copy from core of:
before
return[<liclassName="Dropdown-header">{app.translator.trans('core.forum.search.users_heading')}</li>,
...results.map((user)=>{constname=username(user);constchildren=[highlight(name.textasstring,query)];return(<liclassName="UserSearchResult"data-index={'users'+user.id()}><Linkhref={app.route.user(user)}>{avatar(user)}{{ ...name,text: undefined, children }}</Link></li>);}),];
// Before importTagfrom'flarum/tags/common/models/Tag';// After importTagfrom'ext:flarum/tags/common/models/Tag';
warn of existing usage of @flarum/core imports (must remove/replace). ✅
warn of usage of useExtensions must use new import format of ext: instead ✅
Code splitting ✅
auto replace app.modal.show calls for lazy loaded modules ✅
auto replace extend/override of flarum lazy loaded modules ✅
// beforeextend(LogInModal.prototype,'oninit',function(){console.log('LogInModal is loaded');});// afterextend('flarum/forum/components/LogInModal','oninit',function(){console.log('LogInModal is loaded');});
if inherits Page => warn about using PageStructure ✅
if inherits NotificationsDropdown => HeaderDropdown ✅
// before
... extendsNotificationsDropdowngetMenu(){return(<divclassName={'Dropdown-menu '+this.attrs.menuClassName}onclick={this.menuClick.bind(this)}>{this.showing&&<FlagListstate={this.attrs.state}/>}</div>);}// after
... extendsHeaderDropdowngetContent(){return<FlagListstate={this.attrs.state}/>;}
add before and after changes as an example (use the tags extension) ✅
create an api resource class for each type of serialized model ✅
Pre-fill the API resource with endpoints based on the current controllers ✅
Pre-fill the API resource with relationship declarations based on the Serializer ✅
auto insert the extender that registers the new api resource class ✅
add TODO comments on old classes (Serializers and Controllers) and old extenders, so the author knows to migrate their logic to the new api resource class. ✅
Search
Gambits (back to front) (produced js gambit based on pattern) ✅
Brainstorm
Most of the changes will be simple pattern replacements, to do that we need to take into account some base behavior/abilities.
Dependencies ✅
composer.json.require.flarum/*
^2.0 (when not set to*)composer.json.require-dev.flarum/*
^2.0 (when not set to*)Infra ✅
flarum/framework/.github/workflows/REUSABLE_backend.yml@main
or@1.x
=>@2.x
flarum/framework/.github/workflows/REUSABLE_frontend.yml@main
or@1.x
=>@2.x
Frontend
mithril 2.0 -> 2.2
can't find exact instances of this in the code, but the more common instance is a copy from core of:
before
after
Export Registry
Compat API ✅
compat API no longer works, instead all modules must be imported
before
https://github.com/flarum/framework/blob/1.x/extensions/tags/js/src/forum/compat.js
after
https://github.com/flarum/framework/blob/2.x/extensions/tags/js/src/forum/forum.ts
Importing Modules ✅
@flarum/core
imports (must remove/replace). ✅useExtensions
must use new import format ofext:
instead ✅Code splitting ✅
forum
Composer
DiscussionsUserPage
ForgotPasswordModal
NotificationsPage
PostStreamScrubber
SearchModal
SignUpModal
DiscussionComposer
EditPostComposer
LogInModal
PostStream
ReplyComposer
SettingsPage
UserSecurityPage
common
EditUserModal
Misc
IndexPage.prototype.sidebar
->IndexSidebar
✅IndexPage.prototype.navItems
->IndexSidebar.prototype.navItems
✅IndexPage.prototype.sidebarItems
->IndexSidebar.prototype.items
✅IndexPage.prototype.currentTag
->app.currentTag
✅avatar(...)
icon(...)
-><Avatar ... />
<Icon ... />
✅this.currentTag
->app.currentTag
✅UploadImageButton
namespaceadmin
->common
✅UploadImageButton
props ✅FormModal
vsModal
✅onsubmit
method ✅FormModal
inheritance ✅Page
=> warn about usingPageStructure
✅NotificationsDropdown
=>HeaderDropdown
✅Form
: ✅initializers.has('lock')
=>initializers.has('flarum-lock')
✅initializers.has('subscriptions')
=>initializers.has('flarum-subscriptions')
✅initializers.has('flarum/nicknames')
=>initializers.add('flarum-nicknames')
✅Backend
Misc
(Extend\Notification)->type()
remove second arg. ✅$dates
✅Filesystem
NullAdapter
✅✅
Mailer
Swift_Mailer
& warn about the move from swift mailer to symfony mailer: https://symfony.com/doc/current/mailer.html ✅JSON:API
Attempt to use advanced steps for this, but likely not possible to do any automated upgrading. warn instead to read:
http://localhost:3000/extend/update-2_0#jsonapi
Search
Flarum\Search\AbstractSearcher
=>Flarum\Search\Database\AbstractSearcher
✅Flarum\Filter\FilterState
=>Flarum\Search\SearchState
✅Flarum\Query
=>Flarum\Search
✅Flarum\Filter
=>Flarum\Search\Filter
✅LESS ✅
The text was updated successfully, but these errors were encountered: