This is a TypeScript fork of https://github.com/DunedinJS/migrating-to-modern-js
A simple stopwatch application which serves as an example of how to migrate an old JavaScript application to modern syntax, features, and technologies.
-
Git
-
Git Bash — if using Windows (included with Git)
-
Node.js version 6.9
Everything probably works with version 4 or higher but has not been checked. Run
node -vto check your current version. Follow the instructions here to install Node.js -
A text editor with first-class JavaScript and TypeScript support.
VSCode strongly recommended because it is ready to go and has the best support for TypeScript.
-
A modern web browser with good debugging tools such as Chrome, Firefox, or Edge.
-
Clone this repository by running
git clone https://github.com/DunedinJS/migrating-to-modern-js-typescript.git -
cd ./migrating-to-modern-js-typescript
If using NVM to manage Node.js versions you can also run nvm use here to
make sure that the correct version is active.
-
Checkout the
00-originalbranch by runninggit checkout 00-original -
Make sure to view the readme file for each branch. These contain any further setup instructions and information about each stage.
-
Explore the code.
Make changes if you'd like. To discard changes before checking out another
branch run git reset --hard HEAD.
- Checkout the next branch and continue.
Our starting application. Built on Backbone.js and state of the art from late 2010 to around 2013.
- Add NPM for package management
- Remove third-party libraries from repository
- Add Webpack and TypeScript to compile and bundle modular source code into a single browser-ready script
- Import third-party libraries as modules
- Add type definitions for third-party libraries
- Use TypeScript features in source file
- Separate all source code into TypeScript modules