-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular.json
More file actions
389 lines (325 loc) · 11.6 KB
/
angular.json
File metadata and controls
389 lines (325 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "pnpm",
"schematicCollections": [
"angular-eslint"
]
},
"newProjectRoot": "projects",
"projects": {
"AngularTemplate": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"fileNameStyleGuide": "2016",
"inlineStyle": false,
"inlineTemplate": false,
"routing": true,
"skipTests": true,
"ssr": true,
"standalone": true,
"strict": true,
"style": "scss",
"zoneless": false
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:component": {
"changeDetection": "OnPush",
"displayBlock": true,
"inlineStyle": false,
"inlineTemplate": false,
"prefix": "",
"skipTests": false,
"standalone": true,
"style": "scss",
"type": "component"
},
"@schematics/angular:directive": {
"prefix": "",
"skipTests": false,
"standalone": true,
"type": "directive"
},
"@schematics/angular:enum": {
"type": "enum"
},
"@schematics/angular:guard": {
"functional": false,
"implements": [
"CanActivate",
"CanActivateChild",
"CanDeactivate",
"CanMatch"
],
"skipTests": true,
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"skipTests": true,
"typeSeparator": "."
},
"@schematics/angular:interface": {
"type": "model"
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"skipTests": false,
"standalone": true,
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"skipTests": true,
"typeSeparator": "."
},
"@schematics/angular:service": {
"skipTests": false,
"type": "service"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"index": "src/index.html",
"browser": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"scripts": [],
"assets": [
{
"glob": "**/*",
"input": "public"
},
"src/favicon.ico",
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets/"
}
],
"styles": [
"src/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": [
"src",
"src/styles"
]
}
},
"configurations": {
"production": {
"optimization": {
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": false
},
"fonts": true
},
"fileReplacements": [
{
"replace": "src/_environments/environment.ts",
"with": "src/_environments/environment.prod.ts"
}
],
"budgets": [
{
"type": "initial",
"maximumWarning": "1MB",
"maximumError": "2MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kB",
"maximumError": "10kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "1.5MB",
"maximumError": "10MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "8kB",
"maximumError": "12kB"
}
]
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "AngularTemplate:build:production"
},
"development": {
"buildTarget": "AngularTemplate:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@analogjs/vitest-angular:test",
"options": {
"configFile": "vitest.config.ts"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
}
}
/* ========================================================================
ANGULAR CLI WORKSPACE CONFIGURATION (angular.json)
This document defines global settings, build targets, and default options
for the 'ng generate' command across the workspace.
=========================================================================
--- BUILD CONFIGURATIONS ------------------------------------------------
- @architect.build.configurations.production.fileReplacements
[Environments] List of files to substitute during Production build.
This is critical for switching configuration variables (e.g., API URLs)
between development and production environments.
* replace: "src/_environments/environment.ts"
The default environment file imported by the application.
* with: "src/_environments/environment.prod.ts"
The file that substitutes the default one when command
`ng build --configuration=production` is executed.
- @architect.build.options.stylePreprocessorOptions
[Sass Resolution] Configures how Sass resolves imports.
* includePaths: ["src/styles"]
Defines the root directories for Sass lookups.
[Benefit] Allows using absolute imports like `@use 'abstracts'` from any component,
eliminating the need for deep relative paths like `../../styles/abstracts`.
--- TESTING CONFIGURATION -----------------------------------------------
- @architect.test
[Unit Testing] Configuration for the test runner.
* builder: "@angular/build:unit-test"
[Modern] Uses the new build system for running unit tests.
* options.tsConfig: "tsconfig.spec.json"
Points to the TypeScript configuration specific to testing.
* options.runnerConfig: "vitest.config.ts"
[Engine] Defines Vitest as test engine instead of Karma.
Using `vitest.config.ts` allows for much faster testing, better ESM support
and native integration with modern tooling.
* options.coverage: true
[Quality] Automatically activates the generation of code coverage reports
during test execution. This allows you to see which parts of the code are
covered by the unit tests.
* options.tsConfig: "tsconfig.spec.json"
Points to TypeScript configuration specific to testing.
--- SCHEMATICS CONFIGURATION (ng generate defaults) ---------------------
1. @schematics/angular:application (Project Initialization)
* fileNameStyleGuide: "2016"
[Convention] Uses the explicit naming convention (e.g., `app.component.ts`).
* inlineStyle: false / inlineTemplate: false
[Clarity] Enforces separation of templates (.html) and styles (.scss)
into dedicated files.
* routing: true
Automatically sets up the router configuration via `app.routes.ts`.
* skipTests: true
[Setup] Skips unit test file generation for the initial application shell.
* ssr: true
[Performance] Configures the application for Server-Side Rendering (SSR).
* standalone: true
[Modern] Generates the initial structure using the Standalone Component API (no NgModules).
* strict: true
Enables strict type checking and bundle budgets.
* style: "scss"
Sets SCSS (Sass) as the default stylesheet format.
* zoneless: false
[Compatibility] Keeps `zone.js` enabled for change detection.
2. @schematics/angular:class (Class)
* skipTests: true
Plain classes/DTOs usually don't need dedicated spec files.
3. @schematics/angular:component (Components)
* changeDetection: "OnPush"
[Performance] Sets the change detection strategy to `OnPush`. Component updates
only when inputs change or events occur.
* displayBlock: true
[Layout] Automatically adds `:host { display: block; }` to the component's styles.
* inlineStyle / inlineTemplate: false
Forces the separation of `.html` and `.scss` files.
* prefix: ""
The selector prefix is explicitly empty.
* skipTests: false
[Quality] Generates a unit test file (`.spec.ts`).
* standalone: true
[Modern] Uses the Standalone API for components.
* style: "scss"
Sets SCSS as the default.
* type: "component"
Adds the `.component.ts` suffix to the file name.
4. @schematics/angular:directive (Directives)
* prefix: ""
The selector prefix is explicitly empty.
* skipTests: false
[Quality] Generates a unit test file (`.spec.ts`).
* standalone: true
[Modern] Uses the Standalone API for directives.
* type: "directive"
Adds the `.directive.ts` suffix to the file name.
5. @schematics/angular:enum (Enum)
* type: "enum"
Adds the `.enum.ts` suffix to the file name.
6. @schematics/angular:guard (Guards)
* functional: false
Generates a Class-based guard (instead of a functional one).
* implements: [Array]
Generates the Guard class implementing the four core routing interfaces.
* skipTests: true
Guards are often better tested via integration or E2E as they rely on the router.
* typeSeparator: "."
Defines the separator style (e.g., `auth.guard.ts`).
7. @schematics/angular:interceptor (HTTP Interceptors)
* skipTests: true
Interceptors are usually better tested via integration/E2E as they handle side effects.
* typeSeparator: "."
Defines the separator style (e.g., `auth.interceptor.ts`).
8. @schematics/angular:interface (Interfaces)
* type: "model"
[DDD/Model] Forces the use of the `.model.ts` suffix for data structures.
9. @schematics/angular:module (Modules)
* typeSeparator: "."
Defines the separator style (only relevant if Standalone is disabled).
10. @schematics/angular:pipe (Pipes)
* skipTests: false
[Quality] Pipes contain critical logic and should have unit tests by default.
* standalone: true
Uses the Standalone API for Pipes.
11. @schematics/angular:resolver (Resolvers)
* skipTests: true
Resolvers are tightly coupled to routing and data fetching, often tested via E2E.
12. @schematics/angular:service (Services)
* skipTests: false
[Quality] Services contain critical business logic and should have unit tests.
* type: "service"
Adds the `.service.ts` suffix to the file name.
*/