@mr.dj2u/knowledge 0.1.0

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.
Files changed (83) hide show
  1. package/dist/content/checklists/ship-test-loop.md +16 -0
  2. package/dist/content/checklists/unified-agent-bundle-validation.md +8 -0
  3. package/dist/content/examples/ship-test-loop.md +13 -0
  4. package/dist/content/examples/unified-agent-bundle-bootstrap.md +8 -0
  5. package/dist/content/guides/animation-performance.md +30 -0
  6. package/dist/content/guides/post-create-onboarding.md +113 -0
  7. package/dist/content/patterns/api/api-routes.md +314 -0
  8. package/dist/content/patterns/api/error-handling.md +311 -0
  9. package/dist/content/patterns/database/drizzle-schema.md +280 -0
  10. package/dist/content/patterns/database/migrations.md +365 -0
  11. package/dist/content/patterns/database/query-organization.md +537 -0
  12. package/dist/content/patterns/database/relations.md +450 -0
  13. package/dist/content/patterns/deployment/build-configuration.md +452 -0
  14. package/dist/content/patterns/deployment/ci-cd-patterns.md +448 -0
  15. package/dist/content/patterns/deployment/environment-config.md +380 -0
  16. package/dist/content/patterns/deployment/hosting-setup.md +425 -0
  17. package/dist/content/patterns/project/configuration-patterns.md +459 -0
  18. package/dist/content/patterns/project/documentation-org.md +506 -0
  19. package/dist/content/patterns/project/folder-structure.md +398 -0
  20. package/dist/content/patterns/project/library-exports.md +465 -0
  21. package/dist/content/patterns/project/monorepo-structure.md +500 -0
  22. package/dist/content/patterns/routing/dynamic-routes.md +221 -0
  23. package/dist/content/patterns/routing/file-based-routing.md +186 -0
  24. package/dist/content/patterns/routing/route-groups.md +429 -0
  25. package/dist/content/patterns/state/persistence-middleware.md +521 -0
  26. package/dist/content/patterns/state/selector-hooks.md +538 -0
  27. package/dist/content/patterns/state/store-organization.md +539 -0
  28. package/dist/content/patterns/state/zustand-patterns.md +348 -0
  29. package/dist/content/patterns/styling/component-styling.md +468 -0
  30. package/dist/content/patterns/styling/responsive-patterns.md +398 -0
  31. package/dist/content/patterns/styling/theme-configuration.md +426 -0
  32. package/dist/content/patterns/styling/uniwind-setup.md +412 -0
  33. package/dist/content/prompts/continue-development.md +27 -0
  34. package/dist/content/prompts/create-expo-super-stack.md +29 -0
  35. package/dist/content/prompts/fix-seo.md +29 -0
  36. package/dist/content/prompts/onboard-new-expo-app.md +11 -0
  37. package/dist/content/prompts/prepare-deploy.md +29 -0
  38. package/dist/content/prompts/project-research-plan.md +29 -0
  39. package/dist/content/prompts/review-expo-project.md +29 -0
  40. package/dist/content/prompts/run-doctor.md +30 -0
  41. package/dist/content/prompts/ship-test-loop.md +24 -0
  42. package/dist/content/reference/create-expo-stack-uniwind.md +29 -0
  43. package/dist/content/reference/doctor-dogfood.md +42 -0
  44. package/dist/content/reference/mcp-sdk-transport.md +30 -0
  45. package/dist/content/reference/package-ci-patterns.md +24 -0
  46. package/dist/content/reference/reference-repo-evacuation.md +31 -0
  47. package/dist/content/resource-index.json +67 -0
  48. package/dist/content/rules/app-folder-architecture.md +13 -0
  49. package/dist/content/rules/env-hygiene.md +9 -0
  50. package/dist/content/rules/seo-metadata.md +7 -0
  51. package/dist/content/rules/ssr-safety.md +9 -0
  52. package/dist/content/skills/api-routes.md +33 -0
  53. package/dist/content/skills/continue-development.md +31 -0
  54. package/dist/content/skills/debugging.md +31 -0
  55. package/dist/content/skills/deployment.md +32 -0
  56. package/dist/content/skills/dev-server-management.md +31 -0
  57. package/dist/content/skills/env-vars.md +32 -0
  58. package/dist/content/skills/expo-router-architecture.md +33 -0
  59. package/dist/content/skills/expo-ssr-safety.md +32 -0
  60. package/dist/content/skills/plugin-creation.md +41 -0
  61. package/dist/content/skills/production-server-patterns.md +31 -0
  62. package/dist/content/skills/project-onboarding.md +31 -0
  63. package/dist/content/skills/research-plan-intake.md +31 -0
  64. package/dist/content/skills/seo-metadata.md +31 -0
  65. package/dist/content/skills/super-stack-startup.md +31 -0
  66. package/dist/content/skills/uniwind-theming.md +32 -0
  67. package/dist/index.d.ts +46 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +369 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/patterns/index.d.ts +78 -0
  72. package/dist/patterns/index.d.ts.map +1 -0
  73. package/dist/patterns/index.js +264 -0
  74. package/dist/patterns/index.js.map +1 -0
  75. package/dist/prompts/index.d.ts +35 -0
  76. package/dist/prompts/index.d.ts.map +1 -0
  77. package/dist/prompts/index.js +270 -0
  78. package/dist/prompts/index.js.map +1 -0
  79. package/dist/skills/index.d.ts +3 -0
  80. package/dist/skills/index.d.ts.map +1 -0
  81. package/dist/skills/index.js +2 -0
  82. package/dist/skills/index.js.map +1 -0
  83. package/package.json +50 -0
@@ -0,0 +1,448 @@
1
+ # CI/CD Patterns
2
+
3
+ ## Description
4
+
5
+ CI/CD patterns involve automating build, test, and deployment workflows using GitHub Actions (or similar platforms). This ensures code quality, consistency, and rapid iteration by running automated checks on every commit and deploying when tests pass.
6
+
7
+ ## When to Use
8
+
9
+ **Implement CI/CD when:**
10
+ - ✅ Need automated testing on every push
11
+ - ✅ Want to prevent broken code from merging
12
+ - ✅ Automating app builds and deployment
13
+ - ✅ Need consistent deployment process
14
+ - ✅ Managing multiple environments (dev, staging, production)
15
+ - ✅ Running linting, type checking, and formatting
16
+ - ✅ Building native apps (iOS/Android)
17
+
18
+ ## Core Concepts
19
+
20
+ **CI/CD Pipeline Stages:**
21
+ ```
22
+ 1. Trigger → Code push to GitHub
23
+ 2. Install → Install dependencies
24
+ 3. Lint → ESLint, TypeScript type check
25
+ 4. Test → Run test suite
26
+ 5. Build → Compile app for platforms
27
+ 6. Deploy → Release to stores or hosting
28
+ ```
29
+
30
+ **Key Workflow Components:**
31
+ 1. Workflows trigger on events (push, PR)
32
+ 2. Jobs run on runners (ubuntu, macos, windows)
33
+ 3. Steps execute commands and actions
34
+ 4. Artifacts store build outputs
35
+ 5. Secrets manage sensitive credentials
36
+ 6. Caching optimizes performance
37
+
38
+ ## Code Examples
39
+
40
+ ### Basic GitHub Actions Workflow
41
+
42
+ ```yaml
43
+ # File: .github/workflows/test.yml
44
+ name: Test & Lint
45
+
46
+ on:
47
+ push:
48
+ branches: [main, develop]
49
+ pull_request:
50
+ branches: [main, develop]
51
+
52
+ jobs:
53
+ lint-and-test:
54
+ runs-on: ubuntu-latest
55
+
56
+ steps:
57
+ # Check out code
58
+ - uses: actions/checkout@v4
59
+
60
+ # Setup Node
61
+ - uses: actions/setup-node@v4
62
+ with:
63
+ node-version: 20
64
+ cache: 'npm'
65
+
66
+ # Install dependencies
67
+ - name: Install dependencies
68
+ run: npm install
69
+
70
+ # Run ESLint
71
+ - name: Lint code
72
+ run: npm run lint
73
+
74
+ # Type check
75
+ - name: Type check
76
+ run: npm run type-check
77
+
78
+ # Run tests
79
+ - name: Run tests
80
+ run: npm test
81
+ ```
82
+
83
+ ### Build Workflow
84
+
85
+ ```yaml
86
+ # File: .github/workflows/build.yml
87
+ name: Build App
88
+
89
+ on:
90
+ push:
91
+ branches: [main]
92
+ pull_request:
93
+ branches: [main]
94
+
95
+ jobs:
96
+ build-web:
97
+ runs-on: ubuntu-latest
98
+
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+
102
+ - uses: actions/setup-node@v4
103
+ with:
104
+ node-version: 20
105
+ cache: 'npm'
106
+
107
+ - name: Install dependencies
108
+ run: npm install
109
+
110
+ - name: Build web
111
+ run: npm run build
112
+
113
+ - name: Upload build artifact
114
+ uses: actions/upload-artifact@v4
115
+ with:
116
+ name: web-build
117
+ path: dist/
118
+ retention-days: 7
119
+
120
+ build-android:
121
+ runs-on: ubuntu-latest
122
+
123
+ steps:
124
+ - uses: actions/checkout@v4
125
+
126
+ - uses: actions/setup-node@v4
127
+ with:
128
+ node-version: 20
129
+ cache: 'npm'
130
+
131
+ - name: Setup Java
132
+ uses: actions/setup-java@v4
133
+ with:
134
+ java-version: 17
135
+ distribution: temurin
136
+
137
+ - name: Install dependencies
138
+ run: npm install
139
+
140
+ - name: Build Android APK
141
+ run: eas build --platform android --local
142
+
143
+ - name: Upload APK
144
+ uses: actions/upload-artifact@v4
145
+ with:
146
+ name: android-build
147
+ path: dist/
148
+ ```
149
+
150
+ ### Deploy Workflow
151
+
152
+ ```yaml
153
+ # File: .github/workflows/deploy.yml
154
+ name: Deploy to Production
155
+
156
+ on:
157
+ push:
158
+ branches: [main]
159
+ paths:
160
+ - 'src/**'
161
+ - 'package.json'
162
+
163
+ jobs:
164
+ deploy:
165
+ runs-on: ubuntu-latest
166
+
167
+ environment: production
168
+
169
+ steps:
170
+ - uses: actions/checkout@v4
171
+
172
+ - uses: actions/setup-node@v4
173
+ with:
174
+ node-version: 20
175
+ cache: 'npm'
176
+
177
+ - name: Install dependencies
178
+ run: npm install
179
+
180
+ - name: Build app
181
+ run: npm run build
182
+ env:
183
+ NODE_ENV: production
184
+
185
+ - name: Deploy to production
186
+ run: npm run deploy
187
+ env:
188
+ DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
189
+ API_URL: ${{ secrets.PROD_API_URL }}
190
+
191
+ - name: Notify deployment
192
+ if: success()
193
+ uses: actions/github-script@v7
194
+ with:
195
+ script: |
196
+ github.rest.issues.createComment({
197
+ issue_number: context.issue.number,
198
+ owner: context.repo.owner,
199
+ repo: context.repo.repo,
200
+ body: '✅ Deployed to production'
201
+ })
202
+ ```
203
+
204
+ ### EAS Build CI/CD
205
+
206
+ ```yaml
207
+ # File: .github/workflows/eas-build.yml
208
+ name: EAS Build
209
+
210
+ on:
211
+ push:
212
+ branches: [main, develop]
213
+ workflow_dispatch:
214
+
215
+ jobs:
216
+ build:
217
+ runs-on: ubuntu-latest
218
+
219
+ steps:
220
+ - uses: actions/checkout@v4
221
+
222
+ - uses: actions/setup-node@v4
223
+ with:
224
+ node-version: 20
225
+
226
+ - name: Setup Expo
227
+ uses: expo/expo-github-action@v8
228
+ with:
229
+ eas-version: latest
230
+ token: ${{ secrets.EXPO_TOKEN }}
231
+
232
+ - name: Install dependencies
233
+ run: npm install
234
+
235
+ - name: Build preview
236
+ run: eas build --platform all --profile preview
237
+
238
+ - name: Build production
239
+ if: github.ref == 'refs/heads/main'
240
+ run: eas build --platform all --profile production
241
+
242
+ - name: Submit to stores
243
+ if: github.ref == 'refs/heads/main'
244
+ run: eas submit --platform all --latest
245
+ ```
246
+
247
+ ### Monorepo Workflow
248
+
249
+ ```yaml
250
+ # File: .github/workflows/monorepo.yml
251
+ name: Monorepo Build
252
+
253
+ on:
254
+ push:
255
+ branches: [main]
256
+ pull_request:
257
+
258
+ jobs:
259
+ build:
260
+ runs-on: ubuntu-latest
261
+
262
+ strategy:
263
+ matrix:
264
+ package: [app1, app2, packages/ui]
265
+
266
+ steps:
267
+ - uses: actions/checkout@v4
268
+
269
+ - uses: actions/setup-node@v4
270
+ with:
271
+ node-version: 20
272
+ cache: 'npm'
273
+
274
+ - name: Install dependencies
275
+ run: npm install
276
+
277
+ - name: Build ${{ matrix.package }}
278
+ run: npm --filter ${{ matrix.package }} run build
279
+
280
+ - name: Test ${{ matrix.package }}
281
+ run: npm --filter ${{ matrix.package }} run test
282
+ ```
283
+
284
+ ### Matrix Strategy for Multiple Platforms
285
+
286
+ ```yaml
287
+ # File: .github/workflows/matrix.yml
288
+ name: Cross-Platform Build
289
+
290
+ on: [push, pull_request]
291
+
292
+ jobs:
293
+ build:
294
+ runs-on: ${{ matrix.os }}
295
+
296
+ strategy:
297
+ matrix:
298
+ os: [ubuntu-latest, macos-latest, windows-latest]
299
+ node-version: [18, 20]
300
+
301
+ steps:
302
+ - uses: actions/checkout@v4
303
+
304
+ - uses: actions/setup-node@v4
305
+ with:
306
+ node-version: ${{ matrix.node-version }}
307
+ cache: 'npm'
308
+
309
+ - name: Install dependencies
310
+ run: npm install
311
+
312
+ - name: Run tests
313
+ run: npm test
314
+
315
+ - name: Upload coverage
316
+ uses: codecov/codecov-action@v4
317
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20'
318
+ with:
319
+ token: ${{ secrets.CODECOV_TOKEN }}
320
+ ```
321
+
322
+ ### Conditional Deployment
323
+
324
+ ```yaml
325
+ # File: .github/workflows/conditional-deploy.yml
326
+ name: Conditional Deployment
327
+
328
+ on:
329
+ push:
330
+ branches: [main, develop]
331
+
332
+ jobs:
333
+ deploy:
334
+ runs-on: ubuntu-latest
335
+
336
+ steps:
337
+ - uses: actions/checkout@v4
338
+
339
+ - uses: actions/setup-node@v4
340
+ with:
341
+ node-version: 20
342
+ cache: 'npm'
343
+
344
+ - name: Install and build
345
+ run: npm install && npm run build
346
+
347
+ - name: Deploy to staging
348
+ if: github.ref == 'refs/heads/develop'
349
+ run: npm run deploy:staging
350
+ env:
351
+ DEPLOY_URL: ${{ secrets.STAGING_URL }}
352
+
353
+ - name: Deploy to production
354
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
355
+ run: npm run deploy:production
356
+ env:
357
+ DEPLOY_URL: ${{ secrets.PROD_URL }}
358
+
359
+ - name: Slack notification
360
+ if: always()
361
+ uses: 8398a7/action-slack@v3
362
+ with:
363
+ status: ${{ job.status }}
364
+ webhook_url: ${{ secrets.SLACK_WEBHOOK }}
365
+ ```
366
+
367
+ ## CI/CD Best Practices
368
+
369
+ ### ✅ DO
370
+
371
+ 1. **Run tests on every push**
372
+ ```yaml
373
+ on:
374
+ push:
375
+ branches: [main]
376
+ pull_request:
377
+ branches: [main]
378
+ ```
379
+
380
+ 2. **Use matrix for multiple environments**
381
+ ```yaml
382
+ strategy:
383
+ matrix:
384
+ os: [ubuntu, macos, windows]
385
+ node-version: [18, 20]
386
+ ```
387
+
388
+ 3. **Cache dependencies**
389
+ ```yaml
390
+ - uses: actions/setup-node@v4
391
+ with:
392
+ cache: 'npm'
393
+ ```
394
+
395
+ 4. **Separate workflows by purpose**
396
+ ```
397
+ workflows/
398
+ ├── test.yml
399
+ ├── build.yml
400
+ ├── deploy.yml
401
+ ├── eas-build.yml
402
+ ```
403
+
404
+ ### ❌ DON'T
405
+
406
+ 1. **Don't skip tests before deployment**
407
+ ```yaml
408
+ # ❌ WRONG - Deploys without testing
409
+ - run: npm deploy
410
+
411
+ # ✅ RIGHT - Test first
412
+ - run: npm test
413
+ - run: npm run build
414
+ - run: npm deploy
415
+ ```
416
+
417
+ 2. **Don't hardcode secrets**
418
+ ```yaml
419
+ # ❌ WRONG
420
+ env:
421
+ API_KEY: "sk-123456"
422
+
423
+ # ✅ RIGHT - Use GitHub Secrets
424
+ env:
425
+ API_KEY: ${{ secrets.API_KEY }}
426
+ ```
427
+
428
+ 3. **Don't deploy on pull requests**
429
+ ```yaml
430
+ # ❌ WRONG
431
+ on: [pull_request]
432
+
433
+ # ✅ RIGHT - Deploy only on main branch
434
+ on:
435
+ push:
436
+ branches: [main]
437
+ ```
438
+
439
+ ## Related Patterns
440
+
441
+ - [Build Configuration](./build-configuration.md) — Metro, EAS, Babel setup
442
+ - [Environment Configuration](./environment-config.md) — Environment variables
443
+ - [Hosting Setup](./hosting-setup.md) — Deployment targets
444
+
445
+ ---
446
+
447
+ *Pattern extracted from production repositories: time2pay, core-monorepo*
448
+ *Files: .github/workflows/*.yml, EAS build configuration*