You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Important:** After editing `deploy/schema.json`, you MUST run `npm run build` to regenerate `schema.d.ts` and sync `dist/deploy/schema.json`. The build artifacts are gitignored (as they should be), so they won't be committed.
27
-
28
-
**Schema Artifact Sync:**
29
-
-`src/deploy/schema.json` - Source of truth (edit this)
30
-
-`src/deploy/schema.d.ts` - Generated TypeScript types (auto-generated via `json-schema-to-typescript`)
31
-
-`src/dist/deploy/schema.json` - Distributed schema (copied during build)
32
-
33
-
**npm scripts compatibility:** This project does NOT use lifecycle hooks (`prepare`, `postinstall`, etc.). All build steps are manual via `npm run <script>`. Safe to use with `ignore-scripts=true` in global `.npmrc` for security.
23
+
`schema.json` is source of truth for deployment options. Editing it requires rebuild.
34
24
35
25
### Test
36
26
```bash
37
27
npm test
38
28
```
39
-
Runs Jest test suite. Uses `jest.config.js` in the `src` directory.
40
-
41
-
To run tests in watch mode:
42
-
```bash
43
-
npm test -- --watch
44
-
```
45
29
46
30
### Local Development with npm link
47
31
@@ -141,8 +125,6 @@ actions.ts (deploy function)
141
125
142
126
### Build Target Resolution
143
127
144
-
**Important:** With Angular 17+, the build target resolution follows a strict precedence order. The builder evaluates targets in this order and uses the first one found:
145
-
146
128
**Internal Implementation Precedence (what the code actually does):**
147
129
1.`prerenderTarget` - For SSG/prerendering builds (if specified, overrides all others)
148
130
2.`browserTarget` - **DEPRECATED** legacy option (if specified, takes precedence over buildTarget for backward compatibility)
**Policy:** DO NOT promote deprecated options in user-facing docs (README.md). Hide `browserTarget` from precedence explanations and configuration examples.
238
193
239
-
**Example:**
194
+
**Schema deprecation format:**
240
195
```json
241
196
"browserTarget": {
242
197
"type": "string",
@@ -246,149 +201,33 @@ Angular CLI does NOT rename kebab-case to camelCase for boolean flags with "no"
246
201
}
247
202
```
248
203
249
-
**Auditing for Deprecated Option Mentions:**
204
+
## Testing
250
205
251
-
Run these checks before releases:
252
-
```bash
253
-
# Check README for browserTarget mentions (should be zero in user-facing sections)
254
-
grep -n "browserTarget" README.md
206
+
- Uses Jest (`npm test`), tests in `*.spec.ts` files
207
+
- Requires git clone with `origin` remote (see `test-prerequisites.spec.ts`)
208
+
- All tests preserve/restore `process.env` using `originalEnv` pattern
255
209
256
-
# Check README for noSilent mentions (should be zero)
257
-
grep -n "noSilent" README.md
210
+
### Testing Rules
258
211
259
-
# Verify schema.json has deprecation flags
260
-
grep -A3 "browserTarget" src/deploy/schema.json
261
-
```
212
+
1. Use `.toBe()` for scalar equality (strings, numbers, booleans)
213
+
2. Use `.toContain()` for array membership or substring checks in long messages
214
+
3. Variable reuse for passthrough (same var = no transformation)
215
+
4. Separate variables for transformations (input != expected)
262
216
263
-
**Current deprecated options:**
264
-
-`browserTarget` - Replaced by `buildTarget`, still works for compatibility
265
-
-`noSilent` - No longer needed, parameter is ignored with warning
266
-
267
-
**Avoid Test Count Bragging**:
268
-
- Don't include specific test counts in documentation
269
-
- Numbers go stale immediately and provide no value
270
-
- Let `npm test` output speak for itself
271
-
272
-
## Testing Strategy
273
-
274
-
Tests use Jest and are located alongside source files with `.spec.ts` extension:
// ✅ Substring in long CI message - .toContain() is appropriate
338
-
expect(options.message).toContain('Travis CI build: https://travis-ci.org/');
339
-
340
-
// ✅ Exact message for simple case - use .toBe()
341
-
const expected ='Deploy to gh-pages';
342
-
expect(options.message).toBe(expected);
343
-
```
344
-
345
-
**Bad examples:**
346
-
```typescript
347
-
// ❌ Weak - doesn't verify exact value when you could
348
-
expect(result.repo).toContain('github.com'); // Could use .toBe() with full URL
349
-
350
-
// ❌ Unclear - is this supposed to change or not?
351
-
const options = { branch: 'main' };
352
-
expect(result.branch).toBe('main'); // Should use same variable!
353
-
```
354
-
355
-
**Guideline:** Use `.toBe()` for exact equality when the full value is known and reasonable to assert. Use `.toContain()` for array membership or when asserting the full value would make tests brittle (e.g., long autogenerated messages).
217
+
**Avoid:**
218
+
-`.toContain('partial')` when you could use `.toBe(fullExpectedValue)`
219
+
- Reusing literals instead of variables to show intent
356
220
357
-
### TypeScript: NEVER Use `any`
221
+
### TypeScript: No `any` Type
358
222
359
-
**HARD RULE: The `any` type is FORBIDDEN in all code.**
360
-
361
-
- Never use `any` type
362
-
- Use proper types, `unknown`, or `Partial<T>` instead
363
-
- If mocking complex types, use `Partial<T>` and cast: `mockObject as CompleteType`
364
-
- If type is truly unknown, use `unknown` and add type guards
365
-
366
-
**Bad:**
367
-
```typescript
368
-
const result:any=getValue();
369
-
const mock = {} asany;
370
-
```
371
-
372
-
**Good:**
373
-
```typescript
374
-
const result:string|number=getValue();
375
-
const mock:Partial<ComplexType> = { ...props };
376
-
const typedMock =mockasComplexType;
377
-
```
378
-
379
-
This explicit style makes tests serve as precise documentation of behavior and catches subtle regressions.
223
+
Use proper types, `unknown`, or `Partial<T>` instead. For mocks: `Partial<ComplexType>` cast to `CompleteType`.
When performing GitHub operations (creating issues, PRs, etc.), use the `gh` CLI tool instead of web requests to avoid rate limiting and authentication issues.
233
+
When performing GitHub operations (creating issues, PRs, etc.), use the `gh` CLI tool instead of web requests to avoid rate limiting and authentication issues.
0 commit comments