Updating to cli final from a angular2 project
Bug Report or Feature Request (mark with an x)
- [ ] bug report -> please search issues before submitting
- [ ] feature request
I have a existing angular2 project which uses the cli rc3. When updating to cli final it create new project in angular4. Also there is no information regarding updating to latest final using angular2. Since its in production its not easy to switch to ng4. So please provide guidelines for the exisiting ng2 application . And also how to cretae angular 2 application in cli final version.
Versions.
Repro steps.
The log given by the failure.
Desired functionality.
Mention any other details that might be useful.
In the final version of the @Angular/cli, which set the ng4 as default project. Btw the NG4 is fully compatible with NG2 projects. The only thing that you need to check is your 3rd-party Angular library.
Then how to create a fresh NG2 application using CLI final version?
There is not way to create an ng2 app with the final version of the cli, the cli will support building them, but ng new will always be latest major.
That's kinda weird. Its better to have an option to create a ng2 application. So i think we need to switch to rc4 to create a ng2 application?
also in the wiki it's says
ng4
`--ng4` _default value: false_
Create a project with Angular 4 in the template.
That's totally misleading. https://github.com/angular/angular-cli/wiki/new
You are right! Thanks for reporting that, I have created a PR to fix this: https://github.com/angular/angular-cli/pull/5680
In regards to your main issue, I don't see why you would want to create a ng2 project at this stage as ng4 will support your existing ng2 projects.
@RicardoVaranda That's mostly based on client requirement. Most of them were not ready to use latest/cutting edge one. Since NG2 is almost stable they like to stick to them rather than switching to the new one. Also NG2 to NG4 does have some serious breaking change like in template. That will be huge code rewrite in case of production big projects. As a developer i like to use the latest one. That's not case when we develop for a client. :) just Practicality :)
I understand where you are coming from the best way to approach this then would be like you said, if you need to create a new ng2 project then revert to rc4 and create one, from then on just create copies of that project so you don't have to keep reverting back to rc4 since you can still build and serve ng2 on the latest cli.
@RicardoVaranda Yeah that's the idea. :+1: Other thing is third party libraries. That also needed to be tested before we use it . Will it work if we create a NG4 application and copy the existing NG2 code in to the application?
@harilal What I did with my projects was the following:
-
Created an ng4 application with the cli
-
copy and replaced the differences between the package.json
-
move tsconfig.json from /src/ folder to the root of the project /
-
Rename angular-cli.json to .angular-cli.json
@RicardoVaranda that doesn't worked well for me. So what i did was in a separate machine i updated the cli to final. :) that's more safe. Also my project is in rc4 so it only needs changing the code to work with NG4. :) I will try it and let you the results. Also i read somewhere that there is a big change in bundle sice in NG4. That's one big thing am looking for . So planning to switch to NG4 in near future.
Misleading flag fixed in https://github.com/angular/angular-cli/pull/5649.
The easiest way to make a new project use Angular version 2 is to just update the third party deps as shown here: https://github.com/angular/angular-cli/blob/master/tests/e2e/utils/project.ts#L81-L98
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.