What is the difference between ng new and ng generate application?

Asked

Viewed 99 times

3

I know that the ng new nome-projeto creates a directory with the project inside, but I’m not able to understand the difference between it and the ng generation application.

In the Angular documentation it is said that the argument application:

Generates a new basic application definition in the desktop "projects" subfolder.

This command modifies the project files or creates a new project?

I noticed that it only works in the angular app folder but what are the other differences and when to use each of them?

1 answer

1


ng new - creates a new angular solution from scratch, with a project inside and its dependencies and its required files, like angular.json and so on.

already the ng generation application or simply ng g application create a new "project" within your "solution", then your angular.json will have reference to the two projects created.

You can have as many projects as you think you need and node_modules will be shared.

At the wheel the remote ng g application [nome] you will see that a new folder will be created with the project name and within it, every angular structure you already know, minus the angular.json and other files that will be at the root of the "solution".

This link explains better about the "solutions" or workspace as stated in the article in English https://medium.com/@angularlicious/angular-6-Workspace-test-drive-cfe24bbceeb3

I have never worked on a project that needed this structure, perhaps on more robust projects like GMAIL.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.