Friday, May 10, 2019

How to run an old legacy Angular 2 App from the local?

Today, one of my teammate gave me a old legacy AngularJS app which is implemented
with Angluar 2. the Angular framework have been evolved into Angular 7. we usually start the project with angular/CLI. it is much easy and faster to spin up a project and make it running.


Since the legacy project is running under Angular 2,I try to migrate it to latest Angular 7. the structure and configuration is much different between the legacy AngularJs and new Angular.

I try different approaches with upgrade to lastest @angular/CLI, clear the cache. added all latest component in the node_modules folder.

unfortunately those tries were never succeed. After i check the project configuration setting in Package.json file. under Scripts section

"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"serve": "lite-server -c=bs-config.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"lint": "tslint ./src/**/*.ts -t verbose"
},

we can use npm to manuplate the project, instead of ng serve and ng command

launch CMD Window and go to angular project

run npm install to get all the requirement components for the project.

run npm start to launch the project in the browser.


Now i can play around with this legacy App. it is a good way to start the migration. you can launch it and see how it work..



No comments:

Post a Comment