码迷,mamicode.com
首页 > Web开发 > 详细

angular default project (angular.json的解读)

时间:2019-03-28 11:13:44      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:dep   limits   sel   def   LTP   data   sele   alt   fonts   

Change the default Angular project

Understanding it‘s purpose and limits

Angular‘s default project is nothing more than a string, set in angular.json, to say which project should run with ng commands without a defined project.

Note: The defaultProject key was set to be deprecated in 7.0.0 , but it was blocked because there should be a large discussion about project layout for 8.x.x.

Let‘s create a new project called my-app:

$ ng new my-app

It will create an angular.json with the following structure:

{
...,
"projects": {
"my-app": { ... },
"my-app-e2e": { ... },
},
"defaultProject": "my-app",
}

So, when you run ng serve , it would serve my-app. It would be the same as running ng serve my-app.

Setting a new default project

To understand what values are valid, let‘s create a library and an application.

$ ng create application my-application
$ ng create library my-library

Now, we have the following structure:

{
...,
"projects": {
"my-app": { ... },
"my-app-e2e": { ... },
"my-application": { ... },
"my-application-e2e": { ... },
"my-library": { ... }
},
"defaultProject": "my-app",
}

The highlighted values ( my-appmy-application and my-library) are the valid ones to use as the defaultProject. E2E projects are not valid ones, even if they are listed as projects, because they are used on ng e2e.

If you created a blank workspace or just deleted the default project string, the first project you create (in this case my-application) will automatically be set as the default project.

Commands

Each project type has their own commands to use, for example:
Applications: servebuildteste2e and xi18n.
Libraries: build and test.


angular default project (angular.json的解读)

标签:dep   limits   sel   def   LTP   data   sele   alt   fonts   

原文地址:https://www.cnblogs.com/oxspirt/p/10613554.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!