Use jscodeshift
to help automate the transition from mithril@0.2.x
to mithril@1.x
based on the sections of the Migration Guide
> npm i -g mithril-codemods
> mithril-codemods --help
Transform mithril@0.2.x code into mithril@1.x using jscodeshift
Usage
$ mithril-codemods [<file|glob> ...]
Options
--run, -r Run transforms
-
m.component()
👉🏻m()
📓 -
controller
👉🏻oninit
📓 -
m.route.mode
👉🏻m.route.prefix()
📓 -
m.route()
/m.route("route")
👉🏻m.route.get()
/m.route.set("route")
📓 -
config: m.route
👉🏻oncreate: m.route.link
📓 -
m.route.param()
👉🏻vnode.attrs
📓 - Raw vnodes in
m.mount()
/m.route()
👉🏻 Component wrapped vnodes 📓 - Component options 👉🏻
vnode.attrs
📓 -
⚠️ m.redraw.strategy("none")
👉🏻e.redraw = false
📓 -
⚠️ m()
unwrapped components 👉🏻 wrapped components️ 📓 -
⚠️ config
👉🏻oninit
/onupdate
📓 -
⚠️ m.request().then()
👉🏻m.request().run()
📓 - ⚠
m.sync
👉🏻m.prop.merge
📓
⚠️ Potentially unsafe transform- 📓 Mithril rewrite migration docs