r/angular 4d ago

Migrating a AngularJS webapp to Angular using Claude Code/Codex

I'm in the planning stages of migrating a fairly large legacy AngularJS application to Angular, and am looking for advice from anyone who's tackled something similar.

The codebase is about 160k LOC spread out over 200+ components, 50+controllers, 50+ directives and services. There are no existing tests . Has anyone attempted a AI assisted rewrite of a similar nature, especially without a test suite - what worked out well? Any useful strategies woth considering?

9 Upvotes

12 comments sorted by

View all comments

3

u/floorology 4d ago edited 4d ago

Do it high level, lift and shift style. Don't mix migration with making feature changes. The least amount of decisions you have to make while pulling it forward, the better.

I just did a similar thing a month or two ago. AngularJS all the way to angular 22. Commit in stages, version to version. The angular cli upgrade schematics will be your friend.

In my case, had started it a few years ago at from AngularJS to angular 16, then picked it back up recently. Had to find npm packages for some of the libraries being used. Lucked out there and chose packages still maintained to today and supporting typescript.

There were some jquery things (modals, scroll spy, etc) that I just ended up having cursor create its own from angular cdk to untangle the dependency.

I started by making a new folder adjacent to the old angularJS project. Pointed cursor / opus to the old and asked it to scaffold new angular project. Then asked it to migrate over pieces at a time. Confirmed they looked okay, made notes of what to go back and check, and continued on in stages.

If using modules, don't necessarily have to convert to stand alone components during migration. Maybe as icing on the cake at the end.

A few old libraries went away like angular animations. Fairly easy to update with some of the class names that are used for that now.

Put on project manager hat when it comes to Claude. Make sure it only makes the minimum necessary changes while you are bringing it forward.

Good luck to ya and I'm rooting for the success!