If you have been using the beta release of mirage, chances are that you haven’t made the jump from beta.7 to beta.9 because some of the breaking deprecations.
The deprecations are not super complicated but if you have a lot of tests files then it can be a very boring and task consuming task.
Instead of fixing my code manually, I thought about my old friend recast to automate the whole process , but then I remembered this “new” tool called jscodeshift which offers a nice API on top of recast to do code modifications.
The following script help us with the first deprecation listed
which is pluralizing all the schema models. If we have something like
server.schema.user.all() then after running
the script we’ll have
To run the script we need to install the following npm packages:
For the second breaking deprecation which was calling
Collections, I decided not to use
codeshift since it would be faster for me to just use perl:
I hope you find this useful and if come up with a
please let me know and I’ll link it here.