Updating dependencies for React-Tex

Context

This is about packages version update for a repo that I sometimes maintain.You can check it out here. And I wanted to share what changed in 2 years from 2018 to 2020.I hope still relevant by the time this is read.

Dependencies update

React and Katex had no breaking changes.This was the easiest to do.Just updating version along with some doc update.

Dev dependencies update

Some changes were made to babel,the main thing I realized after this long was that babel changed namespace from babel to @babel.

Changing presets: These are basically babel plugins that help defining.You can read more about the official presets here

Before After
babel-preset-es2015 @babel/preset-env
babel-preset-react @babel/preset-react

This then need to reflect in the .babelrc file

{
-  "presets": ["es2015", "react", "airbnb"]
+  "presets": ["@babel/preset-env", "@babel/preset-react", "airbnb"]
}

Deprecated babel-preset-stage-0. Since babel has decide to stop supporting it.You can read more about it here

Tests update

Changed babel-register to @babel/register,This requires a change in the test script.Which will now be

{
-  "test": "mocha tests/.transpile.js tests/.setup.js tests/**/*.spec.js"
+  "test": "mocha --require @babel/register tests/.setup.js tests/**/*.spec.js"
}

Also deleted the transpile.js since that is no longer needed

Learnings

We should keep things updated, since it also increases confidence in the package.
Might be a good rule to revisit dependencies half yearly.😅

You can check out the change commit here

© 2021