Larkinabout / fvtt-token-action-hud-core

Token Action HUD is a repositionable HUD of actions for a selected token.
14 stars 17 forks source link

[Documentation] Migration guide #209

Closed mrcomac closed 6 months ago

mrcomac commented 8 months ago

Describe your idea I would like to have a documentation to guide how to migrate to THC 1.5

Versions N/A

Additional context The documentation needs to show what changed showing what to change in terms of code.

I saw the link in the release however, it shows what the version has and doesn't show what we need to change.

Larkinabout commented 8 months ago

Hi @mrcomac, the wiki article lists both additions and changes. Anything that is described as replacing something needs updating to the renamed methods to avoid the deprecation messages. For example:

Screenshot_20231030-214401_Chrome

Which tells you to replace doHandleActionEvent with handleActionClick.

There should otherwise be no breaking changes as the old methods will continue to work with deprecation messages until 1.6.

The methods were renamed in this version to simplify them on the system module side for new developers, but also allow new methods like handleActionHover and handleGroupClick

The only other thing you need to do is update your required core version, which is detailed in the Developing a System Module article.

Larkinabout commented 8 months ago

I should note that there are no major code changes for TAH system module developers in this version, it's just renaming a number of the override methods.

mrcomac commented 8 months ago

Hi, I see.

To migrate the code i created a new world and started making the name migration. I've migrated all names, however I was getting an error that says customLayout doesn't exist (at TokenActionHud.init (token-action-hud.js:77:28)).

After reset the layout, i'm getting the error the customLayoutSetting doesn't exist (same file and line, but now is the variable on the left that doesn't exist).

So, i'll back to work on this next weekend (i'm little busy at work right now). If you have any idea what it can be I appreciate any direction.

Thank you

Larkinabout commented 8 months ago

I've tested switching your SWADE module over to 1.5 by just changing the requiredCoreModuleVersion and it worked on a new world albeit with deprecation warnings for the old method names. The error suggests your ActionHandler is not being returned as customLayoutSetting is the first variable to be added to it. Without looking at your updated code, it should still be something like this:

import { ActionHandler } from './action-handler.js'

export let SystemManager = null

Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
    SystemManager = class SystemManager extends coreModule.api.SystemManager {
    /** @override */
    getActionHandler () {
        return new ActionHandler()
    }

    ...
})