This document summarizes a presentation about migrating a large AngularJS application from CoffeeScript to TypeScript. It discusses:
1) The Koofr application was a large AngularJS app with over 6,000 lines of CoffeeScript code across its controllers, directives, filters, and services.
2) They migrated to TypeScript to gain its type safety features and enable easier refactoring of the codebase. CoffeeScript had led to technical debt without enough tests.
3) Tools like TypeScript, Browserify, and DefinitelyTyped were used to help with the migration. DefinitelyTyped provided type definitions for over 30 JavaScript libraries they used.
4) The migration involved trans-
2024: Domino Containers - The Next Step. News from the Domino Container commu...
How we migrated our huge AngularJS app from CoffeeScript to TypeScript
1. HOW WE MIGRATED OUR HUGE ANGULAR.JS
APP FROM COFFEESCRIPT TO TYPESCRIPT
Luka Zakrajšek
CTO @ Koofr
@bancek
Ljubljana Spring-ish JavaScript Meetup
February 10, 2015
2. ABOUT ME
FRI graduate
CTO and cofounder at Koofr
frontend, backend, iOS, Windows Phone
almost 3 years of Angular.js
5. HUGE APP?
26 route controllers
90 directives
22 factories
14 filters
15 services
6012 LOC of Coffee (30 files)
2937 LOC of Angular HTML templates (101 files)
6. WE WERE HAPPY WITH COFFEESCRIPT
Pros
clean code
classes
Cons
technical debt
fear of refactoring
not enough tests
7. COFFEESCRIPT
Launched in 2010.
Gained traction with Rails support in 2011
$(function(){
//Initializationcodegoeshere
})
$->
#Initializationcodegoeshere
8. BROWSERIFY
Lets you require('modules') in the browser by bundling up all of your
dependencies.
varunique=require('uniq');
vardata=[1,2,2,3,4,5,5,5,6];
console.log(unique(data));
$npminstalluniq
$browserifymain.js-obundle.js
<scriptsrc="bundle.js"></script>
9. TYPESCRIPT
a typed superset of JavaScript that compiles to plain
JavaScript
any existing JavaScript program is also valid TypeScript
program
developed by Microsoft
from lead architect of C# and creator of Delphi and Turbo
Pascal
21. EXISTING LIBRARIES
we use more than 30 libraries
to be completely type-safe,
you need definitions for all external libraries
DefinitelyTyped - more than 700 libraries
https://github.com/borisyankov/DefinitelyTyped
30. HOW TO TEST EVERYTHING?
code coverage to the rescue
usually used for test code coverage
we can use it to see which lines were covered by manually
"testing" the app