@donotdev/cli 0.3.0 → 0.3.2

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 (104) hide show
  1. package/dependencies-matrix.json +51 -27
  2. package/dist/bin/commands/agent-setup.js +28 -18
  3. package/dist/bin/commands/build.js +1086 -58
  4. package/dist/bin/commands/bump.js +337 -53
  5. package/dist/bin/commands/cacheout.js +28 -18
  6. package/dist/bin/commands/coach.js +33 -25
  7. package/dist/bin/commands/create-app.js +597 -244
  8. package/dist/bin/commands/create-project.js +607 -254
  9. package/dist/bin/commands/db-check.js +37 -28
  10. package/dist/bin/commands/db.js +37 -28
  11. package/dist/bin/commands/deploy.js +13758 -11807
  12. package/dist/bin/commands/dev.js +50 -34
  13. package/dist/bin/commands/doctor.js +33 -25
  14. package/dist/bin/commands/emu.js +65 -43
  15. package/dist/bin/commands/format.js +28 -18
  16. package/dist/bin/commands/get-demo.js +81 -46
  17. package/dist/bin/commands/make-admin.js +966 -896
  18. package/dist/bin/commands/preview.js +50 -34
  19. package/dist/bin/commands/seed.js +37 -28
  20. package/dist/bin/commands/setup-cicd.js +1286 -87
  21. package/dist/bin/commands/setup.js +152 -138
  22. package/dist/bin/commands/staging.js +13758 -11807
  23. package/dist/bin/commands/sync-secrets.js +152 -132
  24. package/dist/bin/commands/type-check.js +1086 -39
  25. package/dist/bin/commands/wai.js +28 -18
  26. package/dist/bin/dndev.js +513 -30
  27. package/dist/bin/donotdev.js +33 -8
  28. package/dist/index.js +14568 -12497
  29. package/package.json +1 -1
  30. package/templates/app-demo/index.html.example +0 -1
  31. package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
  32. package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
  33. package/templates/app-demo/tsconfig.json.example +1 -1
  34. package/templates/app-dndev/index.html.example +1 -3
  35. package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +1 -0
  36. package/templates/app-expo/app/_layout.tsx.example +1 -1
  37. package/templates/app-expo/app/form.tsx.example +10 -3
  38. package/templates/app-expo/app/index.tsx.example +3 -3
  39. package/templates/app-expo/app/list.tsx.example +2 -2
  40. package/templates/app-expo/app/profile.tsx.example +4 -3
  41. package/templates/app-expo/app/signin.tsx.example +2 -2
  42. package/templates/app-expo/babel.config.js.example +23 -6
  43. package/templates/app-expo/metro.config.js.example +7 -17
  44. package/templates/app-expo/tsconfig.json.example +2 -1
  45. package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
  46. package/templates/app-vite/index.html.example +1 -3
  47. package/templates/app-vite/src/locales/home_en.json.example +6 -6
  48. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
  49. package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
  50. package/templates/app-vite/src/pages/NotFoundPage.tsx.example +1 -0
  51. package/templates/deploy-config/firebase.json.example +6 -5
  52. package/templates/deploy-config/tsconfig.functions.json.example +2 -7
  53. package/templates/deploy-config/vercel.json.example +6 -420
  54. package/templates/functions-firebase/README.md.example +8 -8
  55. package/templates/functions-firebase/functions.config.js.example +2 -1
  56. package/templates/functions-firebase/src/index.ts.example +4 -3
  57. package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
  58. package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
  59. package/templates/functions-firebase/tsconfig.json.example +3 -5
  60. package/templates/functions-supabase/supabase/config.toml.example +2 -1
  61. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
  62. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
  63. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
  64. package/templates/functions-vercel/README.md.example +15 -25
  65. package/templates/functions-vercel/build.mjs.example +4 -46
  66. package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
  67. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
  68. package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
  69. package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
  70. package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
  71. package/templates/functions-vercel/tsconfig.json.example +5 -6
  72. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  73. package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
  74. package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
  75. package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
  76. package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
  77. package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
  78. package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
  79. package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
  80. package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
  81. package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
  82. package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
  83. package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
  84. package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
  85. package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
  86. package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
  87. package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
  88. package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
  89. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
  90. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  91. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  92. package/templates/root-consumer/.claude/settings.json.example +0 -11
  93. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  94. package/templates/root-consumer/.dndev/args.json.example +2 -2
  95. package/templates/root-consumer/.env.example +1 -1
  96. package/templates/root-consumer/.gitignore.example +2 -0
  97. package/templates/root-consumer/AGENTS.md.example +3 -3
  98. package/templates/root-consumer/README.md.example +1 -1
  99. package/templates/app-vite/csp.example.json +0 -44
  100. package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  101. package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  102. package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  103. package/templates/functions-vercel/vercel.json.example +0 -14
  104. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +0 -18
@@ -1,429 +1,15 @@
1
1
  {{#isNextjs}}{
2
2
  "framework": "nextjs",
3
- "installCommand": "bun install",{{#includeVercelFunctions}}
4
- "functions": {
5
- "functions/src/api/**/*.ts": {
6
- "runtime": "@vercel/node@3"
7
- }
8
- },
9
- "rewrites": [
10
- {
11
- "source": "/api/(.*)",
12
- "destination": "/functions/src/api/$1"
13
- }
14
- ],{{/includeVercelFunctions}}
15
- "headers": [
16
- {
17
- "source": "/(.*)",
18
- "headers": [
19
- {
20
- "key": "Content-Security-Policy",
21
- "value": "default-src 'self'; script-src 'self' 'unsafe-inline'{{#isFirebase}}{{#needsAuth}} https://accounts.google.com https://apis.google.com{{/needsAuth}}{{/isFirebase}}{{#needsBilling}} https://js.stripe.com{{/needsBilling}}; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self'{{#isFirebase}}{{#needsAuth}} https://identitytoolkit.googleapis.com https://securetoken.googleapis.com https://www.googleapis.com https://*.googleapis.com https://{{firebaseProjectId}}.firebaseio.com{{/needsAuth}}{{/isFirebase}}{{#isSupabase}} https://*.supabase.co wss://*.supabase.co{{/isSupabase}}{{#needsBilling}} https://api.stripe.com{{/needsBilling}}; frame-src 'none'{{#isFirebase}}{{#needsAuth}} https://accounts.google.com{{/needsAuth}}{{/isFirebase}}{{#needsBilling}} https://js.stripe.com https://hooks.stripe.com{{/needsBilling}}; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests"
22
- },
23
- {
24
- "key": "X-Content-Type-Options",
25
- "value": "nosniff"
26
- },
27
- {
28
- "key": "X-Frame-Options",
29
- "value": "DENY"
30
- },
31
- {
32
- "key": "X-XSS-Protection",
33
- "value": "1; mode=block"
34
- },
35
- {
36
- "key": "Referrer-Policy",
37
- "value": "strict-origin-when-cross-origin"
38
- },
39
- {
40
- "key": "Permissions-Policy",
41
- "value": "geolocation=(), microphone=(), camera=()"
42
- }
43
- ]
44
- },
45
- {
46
- "source": "/_next/static/:path*",
47
- "headers": [
48
- {
49
- "key": "Cache-Control",
50
- "value": "public, max-age=31536000, immutable"
51
- }
52
- ]
53
- },
54
- {
55
- "source": "/assets/:path*.woff",
56
- "headers": [
57
- {
58
- "key": "Cache-Control",
59
- "value": "public, max-age=31536000, immutable"
60
- }
61
- ]
62
- },
63
- {
64
- "source": "/assets/:path*.woff2",
65
- "headers": [
66
- {
67
- "key": "Cache-Control",
68
- "value": "public, max-age=31536000, immutable"
69
- }
70
- ]
71
- },
72
- {
73
- "source": "/assets/:path*.ttf",
74
- "headers": [
75
- {
76
- "key": "Cache-Control",
77
- "value": "public, max-age=31536000, immutable"
78
- }
79
- ]
80
- },
81
- {
82
- "source": "/assets/:path*.eot",
83
- "headers": [
84
- {
85
- "key": "Cache-Control",
86
- "value": "public, max-age=31536000, immutable"
87
- }
88
- ]
89
- },
90
- {
91
- "source": "/assets/:path*.js",
92
- "headers": [
93
- {
94
- "key": "Cache-Control",
95
- "value": "public, max-age=31536000, immutable"
96
- }
97
- ]
98
- },
99
- {
100
- "source": "/assets/:path*.css",
101
- "headers": [
102
- {
103
- "key": "Cache-Control",
104
- "value": "public, max-age=31536000, immutable"
105
- }
106
- ]
107
- },
108
- {
109
- "source": "/:path*.jpg",
110
- "headers": [
111
- {
112
- "key": "Cache-Control",
113
- "value": "public, max-age=86400"
114
- }
115
- ]
116
- },
117
- {
118
- "source": "/:path*.jpeg",
119
- "headers": [
120
- {
121
- "key": "Cache-Control",
122
- "value": "public, max-age=86400"
123
- }
124
- ]
125
- },
126
- {
127
- "source": "/:path*.png",
128
- "headers": [
129
- {
130
- "key": "Cache-Control",
131
- "value": "public, max-age=86400"
132
- }
133
- ]
134
- },
135
- {
136
- "source": "/:path*.svg",
137
- "headers": [
138
- {
139
- "key": "Cache-Control",
140
- "value": "public, max-age=86400"
141
- }
142
- ]
143
- },
144
- {
145
- "source": "/:path*.webp",
146
- "headers": [
147
- {
148
- "key": "Cache-Control",
149
- "value": "public, max-age=86400"
150
- }
151
- ]
152
- },
153
- {
154
- "source": "/:path*.ico",
155
- "headers": [
156
- {
157
- "key": "Cache-Control",
158
- "value": "public, max-age=86400"
159
- }
160
- ]
161
- },
162
- {
163
- "source": "/:path*.json",
164
- "headers": [
165
- {
166
- "key": "Cache-Control",
167
- "value": "public, max-age=3600"
168
- },
169
- {
170
- "key": "Content-Type",
171
- "value": "application/json; charset=utf-8"
172
- }
173
- ]
174
- }{{#includeVercelFunctions}},
175
- {
176
- "source": "/api/(.*)",
177
- "headers": [
178
- {
179
- "key": "Access-Control-Allow-Origin",
180
- "value": "*"
181
- },
182
- {
183
- "key": "Access-Control-Allow-Methods",
184
- "value": "GET, POST, PUT, DELETE, OPTIONS, PATCH"
185
- },
186
- {
187
- "key": "Access-Control-Allow-Headers",
188
- "value": "Content-Type, Authorization, X-Requested-With, X-Stripe-Signature"
189
- },
190
- {
191
- "key": "Access-Control-Allow-Credentials",
192
- "value": "true"
193
- },
194
- {
195
- "key": "Access-Control-Max-Age",
196
- "value": "86400"
197
- }
198
- ]
199
- }{{/includeVercelFunctions}}
200
- ]{{#includeVercelFunctions}},
201
- "env": {
202
- "STRIPE_SECRET_KEY": "@stripe-secret-key",
203
- "STRIPE_WEBHOOK_SECRET": "@stripe-webhook-secret",
204
- "STRIPE_PUBLISHABLE_KEY": "@stripe-publishable-key"{{#isFirebase}},
205
- "FIREBASE_ADMIN_PRIVATE_KEY": "@firebase-admin-private-key",
206
- "FIREBASE_PROJECT_ID": "@firebase-project-id",
207
- "FIREBASE_CLIENT_EMAIL": "@firebase-client-email"{{/isFirebase}}{{#isSupabase}},
208
- "SUPABASE_URL": "@supabase-url",
209
- "SUPABASE_SERVICE_ROLE_KEY": "@supabase-service-role-key"{{/isSupabase}}{{#needsOAuth}},
210
- "GITHUB_PERSONAL_ACCESS_TOKEN": "@github-token",
211
- "GITHUB_REPO_OWNER": "@github-repo-owner",
212
- "GITHUB_REPO_NAME": "@github-repo-name"{{/needsOAuth}}
213
- }{{/includeVercelFunctions}}
3
+ "installCommand": "bun install"
214
4
  }{{/isNextjs}}{{^isNextjs}}{
215
5
  "buildCommand": "bun run build",
216
6
  "outputDirectory": "dist",
217
- "installCommand": "bun install",{{#includeVercelFunctions}}
218
- "functions": {
219
- "functions/src/api/**/*.ts": {
220
- "runtime": "@vercel/node@3"
221
- }
222
- },
223
- "rewrites": [
224
- {
225
- "source": "/api/(.*)",
226
- "destination": "/functions/src/api/$1"
227
- },
228
- {
229
- "source": "/(.*)",
230
- "destination": "/index.html"
231
- }
232
- ],{{/includeVercelFunctions}}{{^includeVercelFunctions}}
7
+ "installCommand": "bun install",
8
+ "cleanUrls": true,
233
9
  "rewrites": [
234
10
  {
235
11
  "source": "/(.*)",
236
- "destination": "/index.html"
12
+ "destination": "/_shell"
237
13
  }
238
- ],{{/includeVercelFunctions}}
239
- "headers": [
240
- {
241
- "source": "/(.*)",
242
- "headers": [
243
- {
244
- "key": "Content-Security-Policy",
245
- "value": "default-src 'self'; script-src 'self' 'unsafe-inline'{{#isFirebase}}{{#needsAuth}} https://accounts.google.com https://apis.google.com{{/needsAuth}}{{/isFirebase}}{{#needsBilling}} https://js.stripe.com{{/needsBilling}}; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self'{{#isFirebase}}{{#needsAuth}} https://identitytoolkit.googleapis.com https://securetoken.googleapis.com https://www.googleapis.com https://*.googleapis.com https://{{firebaseProjectId}}.firebaseio.com{{/needsAuth}}{{/isFirebase}}{{#isSupabase}} https://*.supabase.co wss://*.supabase.co{{/isSupabase}}{{#needsBilling}} https://api.stripe.com{{/needsBilling}}; frame-src 'none'{{#isFirebase}}{{#needsAuth}} https://accounts.google.com{{/needsAuth}}{{/isFirebase}}{{#needsBilling}} https://js.stripe.com https://hooks.stripe.com{{/needsBilling}}; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests"
246
- },
247
- {
248
- "key": "X-Content-Type-Options",
249
- "value": "nosniff"
250
- },
251
- {
252
- "key": "X-Frame-Options",
253
- "value": "DENY"
254
- },
255
- {
256
- "key": "X-XSS-Protection",
257
- "value": "1; mode=block"
258
- },
259
- {
260
- "key": "Referrer-Policy",
261
- "value": "strict-origin-when-cross-origin"
262
- },
263
- {
264
- "key": "Permissions-Policy",
265
- "value": "geolocation=(), microphone=(), camera=()"
266
- }
267
- ]
268
- },
269
- {
270
- "source": "/assets/:path*.woff",
271
- "headers": [
272
- {
273
- "key": "Cache-Control",
274
- "value": "public, max-age=31536000, immutable"
275
- }
276
- ]
277
- },
278
- {
279
- "source": "/assets/:path*.woff2",
280
- "headers": [
281
- {
282
- "key": "Cache-Control",
283
- "value": "public, max-age=31536000, immutable"
284
- }
285
- ]
286
- },
287
- {
288
- "source": "/assets/:path*.ttf",
289
- "headers": [
290
- {
291
- "key": "Cache-Control",
292
- "value": "public, max-age=31536000, immutable"
293
- }
294
- ]
295
- },
296
- {
297
- "source": "/assets/:path*.eot",
298
- "headers": [
299
- {
300
- "key": "Cache-Control",
301
- "value": "public, max-age=31536000, immutable"
302
- }
303
- ]
304
- },
305
- {
306
- "source": "/assets/:path*.js",
307
- "headers": [
308
- {
309
- "key": "Cache-Control",
310
- "value": "public, max-age=31536000, immutable"
311
- }
312
- ]
313
- },
314
- {
315
- "source": "/assets/:path*.css",
316
- "headers": [
317
- {
318
- "key": "Cache-Control",
319
- "value": "public, max-age=31536000, immutable"
320
- }
321
- ]
322
- },
323
- {
324
- "source": "/:path*.jpg",
325
- "headers": [
326
- {
327
- "key": "Cache-Control",
328
- "value": "public, max-age=86400"
329
- }
330
- ]
331
- },
332
- {
333
- "source": "/:path*.jpeg",
334
- "headers": [
335
- {
336
- "key": "Cache-Control",
337
- "value": "public, max-age=86400"
338
- }
339
- ]
340
- },
341
- {
342
- "source": "/:path*.png",
343
- "headers": [
344
- {
345
- "key": "Cache-Control",
346
- "value": "public, max-age=86400"
347
- }
348
- ]
349
- },
350
- {
351
- "source": "/:path*.svg",
352
- "headers": [
353
- {
354
- "key": "Cache-Control",
355
- "value": "public, max-age=86400"
356
- }
357
- ]
358
- },
359
- {
360
- "source": "/:path*.webp",
361
- "headers": [
362
- {
363
- "key": "Cache-Control",
364
- "value": "public, max-age=86400"
365
- }
366
- ]
367
- },
368
- {
369
- "source": "/:path*.ico",
370
- "headers": [
371
- {
372
- "key": "Cache-Control",
373
- "value": "public, max-age=86400"
374
- }
375
- ]
376
- },
377
- {
378
- "source": "/:path*.json",
379
- "headers": [
380
- {
381
- "key": "Cache-Control",
382
- "value": "public, max-age=3600"
383
- },
384
- {
385
- "key": "Content-Type",
386
- "value": "application/json; charset=utf-8"
387
- }
388
- ]
389
- }{{#includeVercelFunctions}},
390
- {
391
- "source": "/api/(.*)",
392
- "headers": [
393
- {
394
- "key": "Access-Control-Allow-Origin",
395
- "value": "*"
396
- },
397
- {
398
- "key": "Access-Control-Allow-Methods",
399
- "value": "GET, POST, PUT, DELETE, OPTIONS, PATCH"
400
- },
401
- {
402
- "key": "Access-Control-Allow-Headers",
403
- "value": "Content-Type, Authorization, X-Requested-With, X-Stripe-Signature"
404
- },
405
- {
406
- "key": "Access-Control-Allow-Credentials",
407
- "value": "true"
408
- },
409
- {
410
- "key": "Access-Control-Max-Age",
411
- "value": "86400"
412
- }
413
- ]
414
- }{{/includeVercelFunctions}}
415
- ]{{#includeVercelFunctions}},
416
- "env": {
417
- "STRIPE_SECRET_KEY": "@stripe-secret-key",
418
- "STRIPE_WEBHOOK_SECRET": "@stripe-webhook-secret",
419
- "STRIPE_PUBLISHABLE_KEY": "@stripe-publishable-key"{{#isFirebase}},
420
- "FIREBASE_ADMIN_PRIVATE_KEY": "@firebase-admin-private-key",
421
- "FIREBASE_PROJECT_ID": "@firebase-project-id",
422
- "FIREBASE_CLIENT_EMAIL": "@firebase-client-email"{{/isFirebase}}{{#isSupabase}},
423
- "SUPABASE_URL": "@supabase-url",
424
- "SUPABASE_SERVICE_ROLE_KEY": "@supabase-service-role-key"{{/isSupabase}}{{#needsOAuth}},
425
- "GITHUB_PERSONAL_ACCESS_TOKEN": "@github-token",
426
- "GITHUB_REPO_OWNER": "@github-repo-owner",
427
- "GITHUB_REPO_NAME": "@github-repo-name"{{/needsOAuth}}
428
- }{{/includeVercelFunctions}}
429
- }{{/isNextjs}}
14
+ ]
15
+ }{{/isNextjs}}
@@ -33,9 +33,9 @@ import { handleError } from '@donotdev/core';
33
33
  functions/
34
34
  ├── src/
35
35
  │ ├── auth/ # Authentication functions
36
- │ ├── oauth/ # OAuth functions
37
- │ ├── billing/ # Billing functions
38
- │ └── index.ts # Main functions entry point
36
+ {{#needsOAuth}}│ ├── oauth/ # OAuth functions
37
+ {{/needsOAuth}}{{#needsBilling}}│ ├── billing/ # Billing functions
38
+ {{/needsBilling}}│ └── index.ts # Main functions entry point
39
39
  ├── package.json # Dependencies and scripts
40
40
  ├── tsconfig.json # TypeScript configuration
41
41
  ├── functions.yaml # Firebase function manifest (manually maintained - must match functions exported from src/index.ts)
@@ -47,9 +47,9 @@ functions/
47
47
  ## Features
48
48
 
49
49
  - **Authentication Management**: User custom claims and auth status
50
- - **OAuth Integration**: GitHub access management
51
- - **Billing Processing**: Stripe checkout and webhook handling
52
- - **Secure API Layer**: Professional frontend-backend communication
50
+ {{#needsOAuth}}- **OAuth Integration**: GitHub access management
51
+ {{/needsOAuth}}{{#needsBilling}}- **Billing Processing**: Stripe checkout and webhook handling
52
+ {{/needsBilling}}- **Secure API Layer**: Professional frontend-backend communication
53
53
  - **Error Handling**: Comprehensive error handling and logging
54
54
 
55
55
  ## Environment Variables
@@ -124,7 +124,7 @@ bun run serve
124
124
  bun run dev
125
125
  ```
126
126
 
127
- ## API Endpoints
127
+ {{#needsBilling}}## API Endpoints
128
128
 
129
129
  ### Stripe Webhook
130
130
 
@@ -137,7 +137,7 @@ bun run dev
137
137
  - **Integration**: Direct Stripe calls (no function needed)
138
138
  - **Purpose**: Creates Stripe checkout sessions for purchases
139
139
 
140
- ## Security
140
+ {{/needsBilling}}## Security
141
141
 
142
142
  - All functions require authentication
143
143
  - Webhook signature verification
@@ -6,7 +6,8 @@
6
6
  * @type {import('@donotdev/types').FunctionsConfig}
7
7
  *
8
8
  * Static functions are AUTO-DETECTED from src/index.ts exports.
9
- * Secrets are AUTO-DETECTED from .env (non-config keys).
9
+ * Secrets are bound per function from its declaration in code
10
+ * (`secrets: [defineSecret('X')]`); values go in .dndev.secrets at the project root.
10
11
  * You only need to list CRUD entities and set defaults.
11
12
  *
12
13
  * Use the `functions` object ONLY for overrides (e.g., HTTP triggers for webhooks).
@@ -20,14 +20,14 @@ export {
20
20
  removeCustomClaims,
21
21
  getUserAuthStatus,
22
22
  } from './auth';
23
-
23
+ {{#needsOAuth}}
24
24
  // Export OAuth functions
25
25
  export {
26
26
  grantGitHubAccess,
27
27
  revokeGitHubAccess,
28
28
  checkGitHubAccess,
29
29
  } from './oauth';
30
-
30
+ {{/needsOAuth}}
31
31
  // Export CRUD functions
32
32
  export {
33
33
  createEntity,
@@ -36,9 +36,10 @@ export {
36
36
  getEntity,
37
37
  listEntities,
38
38
  } from './crud';
39
-
39
+ {{#needsBilling}}
40
40
  // Export billing functions
41
41
  export {
42
42
  refreshSubscriptionStatus,
43
43
  stripeWebhook,
44
44
  } from './billing';
45
+ {{/needsBilling}}
@@ -1,14 +1,16 @@
1
1
  // functions/src/oauth/exchangeToken.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Exchange Token Wrapper
5
- * @description Wrapper for framework's exchangeToken with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Exchange Token
5
+ * @description Framework OAuth code exchange for the providers {{APP_NAME}} uses
6
6
  */
7
7
 
8
- import { exchangeToken as frameworkExchangeToken } from '@donotdev/functions/firebase';
8
+ import { createExchangeToken } from '@donotdev/functions/firebase';
9
9
 
10
10
  /**
11
- * {{APP_NAME}} OAuth token exchange
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
11
+ * {{APP_NAME}} OAuth token exchange.
12
+ * List every provider the app connects: each one's `{PROVIDER}_CLIENT_SECRET`
13
+ * is declared (bound at deploy, value in .dndev.secrets) and any other provider
14
+ * is rejected. `{PROVIDER}_CLIENT_ID` goes in functions/.env.
13
15
  */
14
- export const exchangeToken = frameworkExchangeToken;
16
+ export const exchangeToken = createExchangeToken(['github']);
@@ -1,14 +1,16 @@
1
1
  // functions/src/oauth/refreshToken.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Refresh Token Wrapper
5
- * @description Wrapper for framework's refreshToken with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Refresh Token
5
+ * @description Framework OAuth token refresh for the providers {{APP_NAME}} uses
6
6
  */
7
7
 
8
- import { refreshToken as frameworkRefreshToken } from '@donotdev/functions/firebase';
8
+ import { createRefreshToken } from '@donotdev/functions/firebase';
9
9
 
10
10
  /**
11
- * {{APP_NAME}} OAuth token refresh
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
11
+ * {{APP_NAME}} OAuth token refresh.
12
+ * Same provider list as exchangeToken: each one's `{PROVIDER}_CLIENT_SECRET`
13
+ * is declared (bound at deploy, value in .dndev.secrets) and any other provider
14
+ * is rejected. `{PROVIDER}_CLIENT_ID` goes in functions/.env.
13
15
  */
14
- export const refreshToken = frameworkRefreshToken;
16
+ export const refreshToken = createRefreshToken(['github']);
@@ -3,11 +3,9 @@
3
3
  "compilerOptions": {
4
4
  "module": "preserve",
5
5
  "moduleResolution": "bundler",
6
- "outDir": "./lib",
7
- "rootDir": "./src",
8
- "declaration": true,
9
- "declarationMap": true,
10
- "sourceMap": true
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+ "noUncheckedIndexedAccess": false
11
9
  },
12
10
  "include": ["src/**/*"],
13
11
  "exclude": ["node_modules", "lib", "**/*.test.ts"]
@@ -57,7 +57,8 @@ inspector_port = 8083
57
57
  enabled = true
58
58
  port = 54327
59
59
  backend = "postgres"
60
-
60
+ {{#needsBilling}}
61
61
  # Stripe authenticates webhook calls with its signature, not a Supabase JWT
62
62
  [functions.stripe-webhook]
63
63
  verify_jwt = false
64
+ {{/needsBilling}}
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { createChangePlan } from '@donotdev/functions/supabase';
6
6
 
7
- // Import your billing config
8
- // import { billingConfig } from '../_shared/billingConfig.ts';
9
- const billingConfig = {}; // TODO: Replace with your StripeBackConfig
7
+ // TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
8
+ const billingConfig = {};
10
9
 
11
10
  Deno.serve(createChangePlan(billingConfig));
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { createCheckoutSession } from '@donotdev/functions/supabase';
6
6
 
7
- // Import your billing config
8
- // import { billingConfig } from '../_shared/billingConfig.ts';
9
- const billingConfig = {}; // TODO: Replace with your StripeBackConfig
7
+ // TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
8
+ const billingConfig = {};
10
9
 
11
10
  Deno.serve(createCheckoutSession(billingConfig));
@@ -5,8 +5,7 @@
5
5
 
6
6
  import { createStripeWebhook } from '@donotdev/functions/supabase';
7
7
 
8
- // Import your billing config
9
- // import { billingConfig } from '../_shared/billingConfig.ts';
10
- const billingConfig = {}; // TODO: Replace with your StripeBackConfig
8
+ // TODO: replace with your StripeBackConfig (define it inline or in a shared module you create)
9
+ const billingConfig = {};
11
10
 
12
11
  Deno.serve(createStripeWebhook(billingConfig));