The Lazy Developer Guide: How to Automate Code Updates?

Rate this content
Bookmark

How to update hundreds of projects all at once? With organizations rapidly growing, demand for the scalability of the teams grows which directly impacts projects structure and ownership. The usual dilemma is mono- vs. multi-repos, but ... What if I tell you that it does not matter much? Both approaches can punch you in the face at some point, so perhaps it is better to think bottom-up.


Today I will walk you through some of the biggest challenges that exist in both approaches and those are managing dependencies across a few hundred projects, global code updates and many other things. I will also show you examples of how we solved this inside Infobip through building our own internal libraries.

FAQ

Ante is a senior software engineer at Neo4j with nearly 6 years of experience. He focuses on bad infrastructure and is also a frequent speaker at meetups.

Ante has several interests including React, Webpack, Application Build, Application Optimization, Performance, Web Architecture, Automation, and User Experience.

Ante's presentation focuses on code automations, particularly how repetitive tasks are managed and automated in software development using Neo4j.

Ante mentioned several tools for automation, including ESLint, ShellJS for executing Unix commands, and oclf for CLI tasks.

Ante highlights automation as a crucial element to save time, reduce repetitive tasks, and improve efficiency in handling multiple projects, emphasizing working smart over just working hard.

Ante discusses updating dependencies in projects, such as upgrading from React 16 to React 17, and automating linting in codebases to enhance code quality.

Ante believes that choosing to automate tasks reflects a desire to work efficiently rather than lazily, aiming to allocate more time to challenging and impactful tasks.

Outside of his professional work, Ante is passionate about photography, which he shares on his Instagram blog.

Ante Tomić
Ante Tomić
22 min
25 Mar, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Code automations can save time and effort in development tasks. There are tools and examples available for automating tasks like updating dependencies and code formatting. Automation allows teams to focus on valuable work and improves overall performance. Deciding when to automate depends on the impact and type of code. The last automated task discussed was applying translation updates to multiple projects.

1. Introduction to Code Automations

Short description:

Hi all and I'm sending you a big hello from Croatia. Today, I will talk about code automations and how we did them in Neo4j. Working smart and choosing battles wisely are key in development. Thinking is a powerful tool, but we should avoid overthinking. Let's jump into the coding examples and explore the dependencies in the package.json file.

Hi all and I'm sending you a big, big, big hello from Croatia. My name is Ante and I am going to talk to you today about very interesting topics which are code automations and how we did them in Neo4j. I hope that you will enjoy my session so let me begin.

Hi, I'm Ante and I'm 28 years old. I am senior software engineer working in Neo4j for nearly 6 years and I am focused on bad infrastructure. I am also a frequent speaker on meetups and and I have a lot of interests like React, Webpack, Application Build, Application Optimization, Performance, Web Architecture, Automation and Experience. And you know everyone who knows me would tell you that I am a huge photography buff and I love photography and I'm a happy photographer. So if you are interested, feel free to check out my photography blog on Instagram but let me start from a question, how do you handle repeating tasks at work? This is something I would like you to answer in the poll so let's see, maybe we are doing copy, paste and then repeat, repeat and repeat for the same thing or for example, we count 20 projects and then we change the same thing in all of them. Well, we do have a lot of repetitive tasks and this can take us a lot of time, especially with you know 50 or more projects, and we can see like in this blue line that we can do this manually you know, and we can also see this red which is actually what I want to explore in this session as it is also related to the concept of automation, which is extremely important, and I would like to start from a quote and that is I will always choose a lazy person to do a difficult job because a lazy person will find an easy way to do it and let's see actually how this applies.

First things first it is not related to that we should be lazy about learning. No, programming is a skill that takes hours and hours to perfect and we definitely should work hard to become better developers and to expand our knowledge. And then really then what the hell am I talking about? Well, we need to be able to choose our battles wisely because working hard is just as important as working smart. And in development or the missions are the key to achieving all of this and we are going to check this on a few examples. But you also need to mention thinking. Obviously it is the hardest part of development right? Especially when you have to name them. But thinking is actually a really powerful tool for the missions because it helps us produce ideas and solutions and also helps us actively seek challenges and improvements. But wait! We have to be careful not to overthink it because our time is valuable and we shouldn't spend too much time on complications as it will make it harder to support and update code in the future. Maybe we can have good intentions but our code can simply be too complex to understand. And this is something we will check in the coding examples. You can see QR code and repository link here so you can follow with me or you can check the repository later.

Okay then let's jump onto it. What I want to show you is this package.json file. This is my project for the dummy project or example one for the medical equations and I want to point your attention to these dependencies. What I have on the dependencies is CLI tool that is called oclf. Now it is your preference for what you would choose. I simply chose oclf because it is easy to integrate and it sets up a lot of stuff out of the box. So it helps me and it offers a lot of possibilities and integrations. But you know you have more options like commander or yars and of course you have oclf as well if you want to use it. But what you can also see is some other dependencies. You have some minor ones maybe less known ones like edit json file or replace-in file which you know you will maybe search for and use based on your necessity.

2. Tools, Examples, and Update Dependencies

Short description:

You have popular tools like stemware for semantic versioning, shelljs for executing unix commands in any environment, and examples of eslint-update commands and update dependencies. The eslint upgrade command has four parts: filter, cloning the project, checking migrations, and executing the main migration. The main migration command is written in index.js and additional dependencies are installed. The update dependencies step will be discussed next.

And you have more popular tools like stemware which is used for semantic versioning. It can help you you know check what version you have and if it is matching with the version that you need and yada yada yada.

Then we have shelljs which is unix-like library which offers you the option to execute unix commands in any environment like windows or mac os or linux or any of the other ones. And you know some of you definitely are familiar with uh you just go ships for doing updates and of course it can be used as well. But I would like to talk about two examples I'm going to show you.

The first one is eslint-update commands where we are simply going to check if we have eslint link fix which you can see also in packages on the right and if you check scripts here you will see that we don't have it. So we will add link fix to auto updating. The second command is update dependencies where we will simply check if we have react 16 and if we do we will simply bump the version to react 17.

Okay let's check so I have eslint upgrade commands with four parts the first one is filter where usually in gi I we use big packet api to download the package json file so that we can do some sort of quick checks. As you can see here in the filter so we use package.json file for each downloaded package.json for the project to check if we have eslint of course we have eslint so if I execute the command that you have here in the sample which can also help you you will see that I will get through azure result which means that my migration will execute. So that's the first step done. The second step is cloning the project. Every project for which we run filter every turn true will be cloned and then before executing the migration inside indexts I first check these migrations and this is a expanded filter where thanks to package package, you know, thanks to the whole project cloned, I can check absolutely anything I want to. I don't know for simplicity reasons I'm checking package.json here to simply see if I have linpicks command and since I don't have linpicks command, here you can see that it will return true. So, if I execute my migration command, it will return true and I will then be able to execute the main migration or at least it will be executed in the TI job. So, I go to index.js and I can see my main migration command. But it's written here like you can see here is additional dependencies that you usually install. This is where you will mostly use them. So, inside your migration job. And here I'm using the JSON file. As you can see here in the migrate command where I first get my path to the project, then I have added a JSON file and inside my lintfix step where I simply also check if I already have lintfix command. And if I don't have lintfix command, then I add it to a JSON file and it will also be automatically saved. And again, let's check the code sample here. So I will copy paste it and I will execute the run eslintupgrade command. And you will see here that now lintfix has appeared and I have changes inside my github project. So, voila, I know that it is working. The second step that I want to show you is update dependencies. But before I jump on to update dependencies, I want to mention briefly get migration options, which I won't get it but you can use it to get whichever options and information you need for automatic job execution or even for pull requests and that. So here you can pass, you can retrieve, you can calculate any information you need for your TI environment. But what I would like to do is I would like to jump on to update dependencies.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
Learn more about how to leverage the default features of npm workspaces to help you manage your monorepo project while also checking out some of the new npm cli features.
Automating All the Code & Testing Things with GitHub Actions
React Advanced Conference 2021React Advanced Conference 2021
19 min
Automating All the Code & Testing Things with GitHub Actions
Top Content
Code tasks like linting and testing are critical pieces of a developer’s workflow that help keep us sane like preventing syntax or style issues and hardening our core business logic. We’ll talk about how we can use GitHub Actions to automate these tasks and help keep our projects running smoothly.
Fine-tuning DevOps for People over Perfection
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Fine-tuning DevOps for People over Perfection
Top Content
Demand for DevOps has increased in recent years as more organizations adopt cloud native technologies. Complexity has also increased and a "zero to hero" mentality leaves many people chasing perfection and FOMO. This session focusses instead on why maybe we shouldn't adopt a technology practice and how sometimes teams can achieve the same results prioritizing people over ops automation & controls. Let's look at amounts of and fine-tuning everything as code, pull requests, DevSecOps, Monitoring and more to prioritize developer well-being over optimization perfection. It can be a valid decision to deploy less and sleep better. And finally we'll examine how manual practice and discipline can be the key to superb products and experiences.
Why is CI so Damn Slow?
DevOps.js Conf 2022DevOps.js Conf 2022
27 min
Why is CI so Damn Slow?
We've all asked ourselves this while waiting an eternity for our CI job to finish. Slow CI not only wrecks developer productivity breaking our focus, it costs money in cloud computing fees, and wastes enormous amounts of electricity. Let’s take a dive into why this is the case and how we can solve it with better, faster tools.
The Zen of Yarn
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
The Zen of Yarn
In the past years Yarn took a spot as one of the most common tools used to develop JavaScript projects, in no small part thanks to an opinionated set of guiding principles. But what are they? How do they apply to Yarn in practice? And just as important: how do they benefit you and your projects?
In this talk we won't dive into benchmarks or feature sets: instead, you'll learn how we approach Yarn’s development, how we explore new paths, how we keep our codebase healthy, and generally why we think Yarn will remain firmly set in our ecosystem for the years to come.
Atomic Deployment for JS Hipsters
DevOps.js Conf 2024DevOps.js Conf 2024
25 min
Atomic Deployment for JS Hipsters
Deploying an app is all but an easy process. You will encounter a lot of glitches and pain points to solve to have it working properly. The worst is: that now that you can deploy your app in production, how can't you also deploy all branches in the project to get access to live previews? And be able to do a fast-revert on-demand?Fortunately, the classic DevOps toolkit has all you need to achieve it without compromising your mental health. By expertly mixing Git, Unix tools, and API calls, and orchestrating all of them with JavaScript, you'll master the secret of safe atomic deployments.No more need to rely on commercial services: become the perfect tool master and netlifize your app right at home!

Workshops on related topic

Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
MERN Stack Application Deployment in Kubernetes
DevOps.js Conf 2022DevOps.js Conf 2022
152 min
MERN Stack Application Deployment in Kubernetes
Workshop
Joel Lord
Joel Lord
Deploying and managing JavaScript applications in Kubernetes can get tricky. Especially when a database also has to be part of the deployment. MongoDB Atlas has made developers' lives much easier, however, how do you take a SaaS product and integrate it with your existing Kubernetes cluster? This is where the MongoDB Atlas Operator comes into play. In this workshop, the attendees will learn about how to create a MERN (MongoDB, Express, React, Node.js) application locally, and how to deploy everything into a Kubernetes cluster with the Atlas Operator.
Automated accessibility testing with jest-axe and Lighthouse CI
TestJS Summit 2021TestJS Summit 2021
85 min
Automated accessibility testing with jest-axe and Lighthouse CI
Workshop
Bonnie Schulkin
Bonnie Schulkin
Do your automated tests include a11y checks? This workshop will cover how to get started with jest-axe to detect code-based accessibility violations, and Lighthouse CI to validate the accessibility of fully rendered pages. No amount of automated tests can replace manual accessibility testing, but these checks will make sure that your manual testers aren't doing more work than they need to.
Azure Static Web Apps (SWA) with Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
13 min
Azure Static Web Apps (SWA) with Azure DevOps
WorkshopFree
Juarez Barbosa Junior
Juarez Barbosa Junior
Azure Static Web Apps were launched earlier in 2021, and out of the box, they could integrate your existing repository and deploy your Static Web App from Azure DevOps. This workshop demonstrates how to publish an Azure Static Web App with Azure DevOps.
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
163 min
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
Workshop
Alex Korzhikov
Andrew Reddikh
2 authors
The workshop gives a practical perspective of key principles needed to develop, build, and maintain a set of microservices in the Node.js stack. It covers specifics of creating isolated TypeScript services using the monorepo approach with lerna and yarn workspaces. The workshop includes an overview and a live exercise to create cloud environment with Pulumi framework and Azure services. The sessions fits the best developers who want to learn and practice build and deploy techniques using Azure stack and Pulumi for Node.js.