←back to thread

22 points ninocan | 1 comments | | HN request time: 0.222s | source

Context: I was tasked with migrating a legacy workflow system (Broadcom CA Workflow Automation) to Airflow.

There are some jobs that contain rather simple JavaScript snippets, and I was trying to design a first prototype that simply takes the JS parts and runs them in a transpiler.

In this respect, I found a couple of packages that could be leveraged: - js2py: https://github.com/PiotrDabkowski/Js2Py - mini-racer: https://github.com/bpcreech/PyMiniRacer Yet, both seem to be abandoned packages that might not be suitable for usage in production.

Therefore, I was thinking about parsing and translating Javascript's abstract syntax trees to Python. Whereas a colleague suggested I bring up an LLM pipeline.

How much of an overkill that might be? Has anyone else ever dealt with a JavaScript-to-Python migration and could share heads-ups on strategies or pitfalls to avoid?

1. from-nibly ◴[] No.43378653[source]
How to translate JavaScript to Python is a bike shed.

The thing that really matters is how are you going to ship this?

You should figure out if there is a way it can be delivered incrementally.

Make sure it's easy yo roll back from new to old on as small a chunk as possible.

Make sure rollbacks and deploys don't require manual futzing.

Make sure it's easy for outside people to KNOW the status of things without asking you.

Make sure you have a way to coordinate with feature devs on when it's OK to work on a specific chunk.

Make sure you can test if things are working after you deploy a change.

After that you'll probably come up with like 30 ways to translate the code and use all of them until you find one that's actually tollerable.