Automated porting of mithril@0.2
code to mithril@1.0
.
> npm i -g mithril-codemods
> mithril-codemods --help
Usage
$ mithril-codemods [<file|glob> ...]
Options
--unsafe, -u Use unsafe transforms
--apply, -a Apply transforms (instead of a dry run)
Examples
mithril-codemods **/*.js
mithril-codemods --apply **/*.js
mithril-codemods -ua some/specific/file.js
These transforms are pretty safe and unlikely to have many false positives.
m.component()
with m()
controller
️ to oninit
m.route.mode
to m.route.prefix()
and adjust argsm.route()
to m.route.get()
and m.route("route")
to m.route.set("route")
config: m.route
️w️i️t️h️ oncreate: m.route.link
m.mount()
/m.route()
options
with vnode.attrs
xlink
namespacing to <svg>
m.sync
with Promise.all
m.startComputation
/m.endComputation
m.route.build/parseQueryString
with m.build/parseQueryString
These transform are usually fine, but not applied by default since they can have unfortunate side-effects.
m.redraw.strategy("none")
to e.redraw = false
config
with oninit
/onupdate
view(ctrl, options)
as view(vnode)
There are certain classes of changes that are impossible to automatically convert.