create-huenei-template 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/templates.js +3 -3
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
# Angular Tooling Patterns
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Custom Schematics](#custom-schematics)
|
|
5
|
+
- [Build Optimization](#build-optimization)
|
|
6
|
+
- [Multi-Project Workspace](#multi-project-workspace)
|
|
7
|
+
- [CI/CD Configuration](#cicd-configuration)
|
|
8
|
+
- [Path Aliases](#path-aliases)
|
|
9
|
+
- [Proxy Configuration](#proxy-configuration)
|
|
10
|
+
|
|
11
|
+
## Custom Schematics
|
|
12
|
+
|
|
13
|
+
### Generate Schematic Collection
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Install schematics CLI
|
|
17
|
+
npm install -g @angular-devkit/schematics-cli
|
|
18
|
+
|
|
19
|
+
# Create schematic collection
|
|
20
|
+
schematics blank --name=my-schematics
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Simple Component Schematic
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// src/my-component/index.ts
|
|
27
|
+
import { Rule, SchematicContext, Tree, apply, url, template, move, mergeWith } from '@angular-devkit/schematics';
|
|
28
|
+
import { strings } from '@angular-devkit/core';
|
|
29
|
+
|
|
30
|
+
export function myComponent(options: { name: string; path: string }): Rule {
|
|
31
|
+
return (tree: Tree, context: SchematicContext) => {
|
|
32
|
+
const templateSource = apply(url('./files'), [
|
|
33
|
+
template({
|
|
34
|
+
...options,
|
|
35
|
+
...strings,
|
|
36
|
+
}),
|
|
37
|
+
move(options.path),
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
return mergeWith(templateSource)(tree, context);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Use Custom Schematics
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Link locally
|
|
49
|
+
npm link ./my-schematics
|
|
50
|
+
|
|
51
|
+
# Use
|
|
52
|
+
ng generate my-schematics:my-component --name=test --path=src/app
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Build Optimization
|
|
56
|
+
|
|
57
|
+
### Budget Configuration
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"budgets": [
|
|
62
|
+
{
|
|
63
|
+
"type": "initial",
|
|
64
|
+
"maximumWarning": "500kB",
|
|
65
|
+
"maximumError": "1MB"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "anyComponentStyle",
|
|
69
|
+
"maximumWarning": "4kB",
|
|
70
|
+
"maximumError": "8kB"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "anyScript",
|
|
74
|
+
"maximumWarning": "100kB",
|
|
75
|
+
"maximumError": "200kB"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Differential Loading
|
|
82
|
+
|
|
83
|
+
Automatic in v20+ - builds for modern browsers by default.
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
// .browserslistrc
|
|
87
|
+
last 2 Chrome versions
|
|
88
|
+
last 2 Firefox versions
|
|
89
|
+
last 2 Safari versions
|
|
90
|
+
last 2 Edge versions
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Code Splitting
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Lazy load routes for automatic code splitting
|
|
97
|
+
export const routes: Routes = [
|
|
98
|
+
{
|
|
99
|
+
path: 'admin',
|
|
100
|
+
loadChildren: () => import('./admin/admin.routes').then(m => m.adminRoutes),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
path: 'reports',
|
|
104
|
+
loadComponent: () => import('./reports/reports.component').then(m => m.Reports),
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Tree Shaking
|
|
110
|
+
|
|
111
|
+
Ensure proper imports for tree shaking:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Good - tree shakeable
|
|
115
|
+
import { map, filter } from 'rxjs';
|
|
116
|
+
|
|
117
|
+
// Avoid - imports entire library
|
|
118
|
+
import * as rxjs from 'rxjs';
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Preload Strategy
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// app.config.ts
|
|
125
|
+
import { provideRouter, withPreloading, PreloadAllModules } from '@angular/router';
|
|
126
|
+
|
|
127
|
+
export const appConfig: ApplicationConfig = {
|
|
128
|
+
providers: [
|
|
129
|
+
provideRouter(routes, withPreloading(PreloadAllModules)),
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Multi-Project Workspace
|
|
135
|
+
|
|
136
|
+
### Create Workspace
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Create empty workspace
|
|
140
|
+
ng new my-workspace --create-application=false
|
|
141
|
+
|
|
142
|
+
cd my-workspace
|
|
143
|
+
|
|
144
|
+
# Add applications
|
|
145
|
+
ng generate application main-app
|
|
146
|
+
ng generate application admin-app
|
|
147
|
+
|
|
148
|
+
# Add library
|
|
149
|
+
ng generate library shared-ui
|
|
150
|
+
ng generate library data-access
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Workspace Structure
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
my-workspace/
|
|
157
|
+
├── projects/
|
|
158
|
+
│ ├── main-app/
|
|
159
|
+
│ │ └── src/
|
|
160
|
+
│ ├── admin-app/
|
|
161
|
+
│ │ └── src/
|
|
162
|
+
│ ├── shared-ui/
|
|
163
|
+
│ │ └── src/
|
|
164
|
+
│ └── data-access/
|
|
165
|
+
│ └── src/
|
|
166
|
+
├── angular.json
|
|
167
|
+
└── package.json
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Build Specific Project
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
ng build main-app
|
|
174
|
+
ng build shared-ui
|
|
175
|
+
ng serve admin-app
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Library Configuration
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
// projects/shared-ui/ng-package.json
|
|
182
|
+
{
|
|
183
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
184
|
+
"dest": "../../dist/shared-ui",
|
|
185
|
+
"lib": {
|
|
186
|
+
"entryFile": "src/public-api.ts"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Using Library in App
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
// After building library: ng build shared-ui
|
|
195
|
+
import { Button } from 'shared-ui';
|
|
196
|
+
|
|
197
|
+
@Component({
|
|
198
|
+
imports: [Button],
|
|
199
|
+
template: `<lib-button>Click</lib-button>`,
|
|
200
|
+
})
|
|
201
|
+
export class App {}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## CI/CD Configuration
|
|
205
|
+
|
|
206
|
+
### GitHub Actions
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
# .github/workflows/ci.yml
|
|
210
|
+
name: CI
|
|
211
|
+
|
|
212
|
+
on:
|
|
213
|
+
push:
|
|
214
|
+
branches: [main]
|
|
215
|
+
pull_request:
|
|
216
|
+
branches: [main]
|
|
217
|
+
|
|
218
|
+
jobs:
|
|
219
|
+
build:
|
|
220
|
+
runs-on: ubuntu-latest
|
|
221
|
+
|
|
222
|
+
steps:
|
|
223
|
+
- uses: actions/checkout@v4
|
|
224
|
+
|
|
225
|
+
- name: Setup Node.js
|
|
226
|
+
uses: actions/setup-node@v4
|
|
227
|
+
with:
|
|
228
|
+
node-version: '20'
|
|
229
|
+
cache: 'npm'
|
|
230
|
+
|
|
231
|
+
- name: Install dependencies
|
|
232
|
+
run: npm ci
|
|
233
|
+
|
|
234
|
+
- name: Lint
|
|
235
|
+
run: npm run lint
|
|
236
|
+
|
|
237
|
+
- name: Test
|
|
238
|
+
run: npm run test -- --watch=false --browsers=ChromeHeadless --code-coverage
|
|
239
|
+
|
|
240
|
+
- name: Build
|
|
241
|
+
run: npm run build -- -c production
|
|
242
|
+
|
|
243
|
+
- name: Upload coverage
|
|
244
|
+
uses: codecov/codecov-action@v3
|
|
245
|
+
with:
|
|
246
|
+
files: ./coverage/lcov.info
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### GitLab CI
|
|
250
|
+
|
|
251
|
+
```yaml
|
|
252
|
+
# .gitlab-ci.yml
|
|
253
|
+
image: node:20
|
|
254
|
+
|
|
255
|
+
cache:
|
|
256
|
+
paths:
|
|
257
|
+
- node_modules/
|
|
258
|
+
- .angular/cache/
|
|
259
|
+
|
|
260
|
+
stages:
|
|
261
|
+
- install
|
|
262
|
+
- test
|
|
263
|
+
- build
|
|
264
|
+
|
|
265
|
+
install:
|
|
266
|
+
stage: install
|
|
267
|
+
script:
|
|
268
|
+
- npm ci
|
|
269
|
+
|
|
270
|
+
test:
|
|
271
|
+
stage: test
|
|
272
|
+
script:
|
|
273
|
+
- npm run lint
|
|
274
|
+
- npm run test -- --watch=false --browsers=ChromeHeadless
|
|
275
|
+
|
|
276
|
+
build:
|
|
277
|
+
stage: build
|
|
278
|
+
script:
|
|
279
|
+
- npm run build -- -c production
|
|
280
|
+
artifacts:
|
|
281
|
+
paths:
|
|
282
|
+
- dist/
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Path Aliases
|
|
286
|
+
|
|
287
|
+
### Configure tsconfig.json
|
|
288
|
+
|
|
289
|
+
```json
|
|
290
|
+
{
|
|
291
|
+
"compilerOptions": {
|
|
292
|
+
"baseUrl": ".",
|
|
293
|
+
"paths": {
|
|
294
|
+
"@app/*": ["src/app/*"],
|
|
295
|
+
"@env/*": ["src/environments/*"],
|
|
296
|
+
"@shared/*": ["src/app/shared/*"],
|
|
297
|
+
"@features/*": ["src/app/features/*"],
|
|
298
|
+
"@core/*": ["src/app/core/*"]
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Usage
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
// Instead of relative imports
|
|
308
|
+
import { User } from '../../../core/services/user.service';
|
|
309
|
+
|
|
310
|
+
// Use path alias
|
|
311
|
+
import { User } from '@core/services/user.service';
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Proxy Configuration
|
|
315
|
+
|
|
316
|
+
### Development Proxy
|
|
317
|
+
|
|
318
|
+
```json
|
|
319
|
+
// proxy.conf.json
|
|
320
|
+
{
|
|
321
|
+
"/api": {
|
|
322
|
+
"target": "http://localhost:3000",
|
|
323
|
+
"secure": false,
|
|
324
|
+
"changeOrigin": true
|
|
325
|
+
},
|
|
326
|
+
"/auth": {
|
|
327
|
+
"target": "http://localhost:4000",
|
|
328
|
+
"secure": false,
|
|
329
|
+
"pathRewrite": {
|
|
330
|
+
"^/auth": ""
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Configure in angular.json
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"serve": {
|
|
341
|
+
"options": {
|
|
342
|
+
"proxyConfig": "proxy.conf.json"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Or via CLI
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
ng serve --proxy-config proxy.conf.json
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Custom Builders
|
|
355
|
+
|
|
356
|
+
### Using esbuild (Default in v20+)
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"architect": {
|
|
361
|
+
"build": {
|
|
362
|
+
"builder": "@angular-devkit/build-angular:application",
|
|
363
|
+
"options": {
|
|
364
|
+
"browser": "src/main.ts"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### SSR Configuration
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
# Add SSR
|
|
375
|
+
ng add @angular/ssr
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"architect": {
|
|
381
|
+
"build": {
|
|
382
|
+
"options": {
|
|
383
|
+
"server": "src/main.server.ts",
|
|
384
|
+
"prerender": true,
|
|
385
|
+
"ssr": {
|
|
386
|
+
"entry": "server.ts"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Debugging
|
|
395
|
+
|
|
396
|
+
### Source Maps
|
|
397
|
+
|
|
398
|
+
```json
|
|
399
|
+
{
|
|
400
|
+
"configurations": {
|
|
401
|
+
"development": {
|
|
402
|
+
"sourceMap": true
|
|
403
|
+
},
|
|
404
|
+
"production": {
|
|
405
|
+
"sourceMap": {
|
|
406
|
+
"scripts": true,
|
|
407
|
+
"styles": false,
|
|
408
|
+
"hidden": true,
|
|
409
|
+
"vendor": false
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Verbose Logging
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
ng build --verbose
|
|
420
|
+
ng serve --verbose
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Debug Tests
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Run tests with debugging
|
|
427
|
+
ng test --browsers=Chrome
|
|
428
|
+
|
|
429
|
+
# In Chrome DevTools, open Sources tab and set breakpoints
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Package Scripts
|
|
433
|
+
|
|
434
|
+
```json
|
|
435
|
+
{
|
|
436
|
+
"scripts": {
|
|
437
|
+
"start": "ng serve",
|
|
438
|
+
"build": "ng build",
|
|
439
|
+
"build:prod": "ng build -c production",
|
|
440
|
+
"test": "ng test",
|
|
441
|
+
"test:ci": "ng test --watch=false --browsers=ChromeHeadless --code-coverage",
|
|
442
|
+
"lint": "ng lint",
|
|
443
|
+
"lint:fix": "ng lint --fix",
|
|
444
|
+
"analyze": "ng build -c production --stats-json && npx esbuild-visualizer --metadata dist/my-app/browser/stats.json --open",
|
|
445
|
+
"update": "ng update"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|