@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.
- package/dependencies-matrix.json +51 -27
- package/dist/bin/commands/agent-setup.js +28 -18
- package/dist/bin/commands/build.js +1086 -58
- package/dist/bin/commands/bump.js +337 -53
- package/dist/bin/commands/cacheout.js +28 -18
- package/dist/bin/commands/coach.js +33 -25
- package/dist/bin/commands/create-app.js +597 -244
- package/dist/bin/commands/create-project.js +607 -254
- package/dist/bin/commands/db-check.js +37 -28
- package/dist/bin/commands/db.js +37 -28
- package/dist/bin/commands/deploy.js +13758 -11807
- package/dist/bin/commands/dev.js +50 -34
- package/dist/bin/commands/doctor.js +33 -25
- package/dist/bin/commands/emu.js +65 -43
- package/dist/bin/commands/format.js +28 -18
- package/dist/bin/commands/get-demo.js +81 -46
- package/dist/bin/commands/make-admin.js +966 -896
- package/dist/bin/commands/preview.js +50 -34
- package/dist/bin/commands/seed.js +37 -28
- package/dist/bin/commands/setup-cicd.js +1286 -87
- package/dist/bin/commands/setup.js +152 -138
- package/dist/bin/commands/staging.js +13758 -11807
- package/dist/bin/commands/sync-secrets.js +152 -132
- package/dist/bin/commands/type-check.js +1086 -39
- package/dist/bin/commands/wai.js +28 -18
- package/dist/bin/dndev.js +513 -30
- package/dist/bin/donotdev.js +33 -8
- package/dist/index.js +14568 -12497
- package/package.json +1 -1
- package/templates/app-demo/index.html.example +0 -1
- package/templates/app-demo/src/pages/ConditionalFormPage.tsx.example +2 -2
- package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +1 -0
- package/templates/app-demo/tsconfig.json.example +1 -1
- package/templates/app-dndev/index.html.example +1 -3
- package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +1 -0
- package/templates/app-expo/app/_layout.tsx.example +1 -1
- package/templates/app-expo/app/form.tsx.example +10 -3
- package/templates/app-expo/app/index.tsx.example +3 -3
- package/templates/app-expo/app/list.tsx.example +2 -2
- package/templates/app-expo/app/profile.tsx.example +4 -3
- package/templates/app-expo/app/signin.tsx.example +2 -2
- package/templates/app-expo/babel.config.js.example +23 -6
- package/templates/app-expo/metro.config.js.example +7 -17
- package/templates/app-expo/tsconfig.json.example +2 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +2 -3
- package/templates/app-vite/index.html.example +1 -3
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -1
- package/templates/app-vite/src/pages/HomePage.tsx.example +3 -3
- package/templates/app-vite/src/pages/NotFoundPage.tsx.example +1 -0
- package/templates/deploy-config/firebase.json.example +6 -5
- package/templates/deploy-config/tsconfig.functions.json.example +2 -7
- package/templates/deploy-config/vercel.json.example +6 -420
- package/templates/functions-firebase/README.md.example +8 -8
- package/templates/functions-firebase/functions.config.js.example +2 -1
- package/templates/functions-firebase/src/index.ts.example +4 -3
- package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +8 -6
- package/templates/functions-firebase/src/oauth/refreshToken.ts.example +8 -6
- package/templates/functions-firebase/tsconfig.json.example +3 -5
- package/templates/functions-supabase/supabase/config.toml.example +2 -1
- package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +2 -3
- package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +2 -3
- package/templates/functions-vercel/README.md.example +15 -25
- package/templates/functions-vercel/build.mjs.example +4 -46
- package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +6 -11
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +2 -3
- package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +5 -11
- package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +5 -11
- package/templates/functions-vercel/tsconfig.json.example +5 -6
- package/templates/github/workflows/firebase-deploy.yml.example +1 -1
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +3 -2
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +13 -12
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +5 -5
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +13 -12
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +5 -5
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +1 -4
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +10 -12
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +7 -4
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +11 -9
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +13 -7
- package/templates/preset-landing/src/pages/HomePage.tsx.example +50 -32
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +1 -1
- package/templates/preset-saas/src/pages/HomePage.tsx.example +3 -2
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +4 -3
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +7 -7
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +3 -3
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +101 -10
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
- package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
- package/templates/root-consumer/.claude/settings.json.example +0 -11
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
- package/templates/root-consumer/.dndev/args.json.example +2 -2
- package/templates/root-consumer/.env.example +1 -1
- package/templates/root-consumer/.gitignore.example +2 -0
- package/templates/root-consumer/AGENTS.md.example +3 -3
- package/templates/root-consumer/README.md.example +1 -1
- package/templates/app-vite/csp.example.json +0 -44
- package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
- package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
- package/templates/functions-vercel/vercel.json.example +0 -14
- 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"
|
|
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",
|
|
218
|
-
"
|
|
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": "/
|
|
12
|
+
"destination": "/_shell"
|
|
237
13
|
}
|
|
238
|
-
]
|
|
239
|
-
|
|
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
|
|
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
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} Exchange Token
|
|
5
|
+
* @description Framework OAuth code exchange for the providers {{APP_NAME}} uses
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { createExchangeToken } from '@donotdev/functions/firebase';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* {{APP_NAME}} OAuth token exchange
|
|
12
|
-
*
|
|
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 =
|
|
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
|
|
5
|
-
* @description
|
|
4
|
+
* @fileoverview {{APP_NAME}} Refresh Token
|
|
5
|
+
* @description Framework OAuth token refresh for the providers {{APP_NAME}} uses
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { createRefreshToken } from '@donotdev/functions/firebase';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* {{APP_NAME}} OAuth token refresh
|
|
12
|
-
*
|
|
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 =
|
|
16
|
+
export const refreshToken = createRefreshToken(['github']);
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"module": "preserve",
|
|
5
5
|
"moduleResolution": "bundler",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
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"]
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createChangePlan } from '@donotdev/functions/supabase';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
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));
|
package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { createCheckoutSession } from '@donotdev/functions/supabase';
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
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
|
-
//
|
|
9
|
-
|
|
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));
|