@donotdev/cli 0.0.3
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/LICENSE.md +48 -0
- package/README.md +291 -0
- package/dependencies-matrix.json +694 -0
- package/dist/bin/commands/build.d.ts +11 -0
- package/dist/bin/commands/build.d.ts.map +1 -0
- package/dist/bin/commands/build.js +8162 -0
- package/dist/bin/commands/build.js.map +1 -0
- package/dist/bin/commands/bump.d.ts +11 -0
- package/dist/bin/commands/bump.d.ts.map +1 -0
- package/dist/bin/commands/bump.js +8004 -0
- package/dist/bin/commands/bump.js.map +1 -0
- package/dist/bin/commands/cacheout.d.ts +11 -0
- package/dist/bin/commands/cacheout.d.ts.map +1 -0
- package/dist/bin/commands/cacheout.js +7630 -0
- package/dist/bin/commands/cacheout.js.map +1 -0
- package/dist/bin/commands/create-app.d.ts +11 -0
- package/dist/bin/commands/create-app.d.ts.map +1 -0
- package/dist/bin/commands/create-app.js +9032 -0
- package/dist/bin/commands/create-app.js.map +1 -0
- package/dist/bin/commands/create-project.d.ts +11 -0
- package/dist/bin/commands/create-project.d.ts.map +1 -0
- package/dist/bin/commands/create-project.js +9643 -0
- package/dist/bin/commands/create-project.js.map +1 -0
- package/dist/bin/commands/deploy.d.ts +11 -0
- package/dist/bin/commands/deploy.d.ts.map +1 -0
- package/dist/bin/commands/deploy.js +9007 -0
- package/dist/bin/commands/deploy.js.map +1 -0
- package/dist/bin/commands/dev.d.ts +11 -0
- package/dist/bin/commands/dev.d.ts.map +1 -0
- package/dist/bin/commands/dev.js +7892 -0
- package/dist/bin/commands/dev.js.map +1 -0
- package/dist/bin/commands/emu.d.ts +11 -0
- package/dist/bin/commands/emu.d.ts.map +1 -0
- package/dist/bin/commands/emu.js +8302 -0
- package/dist/bin/commands/emu.js.map +1 -0
- package/dist/bin/commands/format.d.ts +11 -0
- package/dist/bin/commands/format.d.ts.map +1 -0
- package/dist/bin/commands/format.js +8009 -0
- package/dist/bin/commands/format.js.map +1 -0
- package/dist/bin/commands/lint.d.ts +11 -0
- package/dist/bin/commands/lint.d.ts.map +1 -0
- package/dist/bin/commands/lint.js +7481 -0
- package/dist/bin/commands/lint.js.map +1 -0
- package/dist/bin/commands/preview.d.ts +11 -0
- package/dist/bin/commands/preview.d.ts.map +1 -0
- package/dist/bin/commands/preview.js +7909 -0
- package/dist/bin/commands/preview.js.map +1 -0
- package/dist/bin/commands/sync-secrets.d.ts +11 -0
- package/dist/bin/commands/sync-secrets.d.ts.map +1 -0
- package/dist/bin/commands/sync-secrets.js +8227 -0
- package/dist/bin/commands/sync-secrets.js.map +1 -0
- package/dist/bin/dndev.js +222 -0
- package/dist/bin/donotdev.js +222 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12820 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
- package/templates/app-demo/index.html.example +20 -0
- package/templates/app-demo/public/favicon.ico.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-cyrillic-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-cyrillic.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-greek-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-greek.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-latin-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-latin.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-400-vietnamese.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-cyrillic-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-cyrillic.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-greek-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-greek.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-latin-ext.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-latin.woff2.example +0 -0
- package/templates/app-demo/public/fonts/Roboto-700-vietnamese.woff2.example +0 -0
- package/templates/app-demo/public/fonts/fonts.css.example +144 -0
- package/templates/app-demo/public/logo.png.example +0 -0
- package/templates/app-demo/public/logo.svg.example +1 -0
- package/templates/app-demo/public/manifest.json.example +10 -0
- package/templates/app-demo/src/App.tsx.example +17 -0
- package/templates/app-demo/src/Routes.tsx.example +20 -0
- package/templates/app-demo/src/components/ThemeToggle.tsx.example +48 -0
- package/templates/app-demo/src/globals.css.example +4 -0
- package/templates/app-demo/src/main.tsx.example +27 -0
- package/templates/app-demo/src/pages/DetailPage.tsx.example +103 -0
- package/templates/app-demo/src/pages/FullPage.tsx.example +142 -0
- package/templates/app-demo/src/pages/HomePage.tsx.example +79 -0
- package/templates/app-demo/src/pages/components/ComponentRenderer.tsx.example +511 -0
- package/templates/app-demo/src/pages/components/ComponentsData.tsx.example +152 -0
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +266 -0
- package/templates/app-demo/src/pages/components/LayoutRoute.tsx.example +20 -0
- package/templates/app-demo/src/pages/components/componentConfig.ts.example +921 -0
- package/templates/app-demo/src/themes.css.example +179 -0
- package/templates/app-demo/tsconfig.json.example +9 -0
- package/templates/app-demo/vite.config.ts.example +53 -0
- package/templates/app-next/.env.example +92 -0
- package/templates/app-next/next.config.ts.example +8 -0
- package/templates/app-next/postcss.config.js.example +58 -0
- package/templates/app-next/service-account-key.json.example +2 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +39 -0
- package/templates/app-next/src/app/layout.tsx.example +52 -0
- package/templates/app-next/src/app/not-found.tsx.example +21 -0
- package/templates/app-next/src/config/app.ts.example +75 -0
- package/templates/app-next/src/config/legal.ts.example +170 -0
- package/templates/app-next/src/globals.css.example +15 -0
- package/templates/app-next/src/locales/dndev_en.json.example +516 -0
- package/templates/app-next/src/pages/HomePage.tsx.example +20 -0
- package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +75 -0
- package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +69 -0
- package/templates/app-next/src/pages/legal/TermsPage.tsx.example +71 -0
- package/templates/app-next/src/themes.css.example +179 -0
- package/templates/app-next/tsconfig.json.example +11 -0
- package/templates/app-payload/.env.example +28 -0
- package/templates/app-payload/README.md.example +233 -0
- package/templates/app-payload/collections/Company.ts.example +125 -0
- package/templates/app-payload/collections/Hero.ts.example +62 -0
- package/templates/app-payload/collections/Media.ts.example +41 -0
- package/templates/app-payload/collections/Products.ts.example +115 -0
- package/templates/app-payload/collections/Services.ts.example +104 -0
- package/templates/app-payload/collections/Testimonials.ts.example +92 -0
- package/templates/app-payload/collections/Users.ts.example +35 -0
- package/templates/app-payload/src/server.ts.example +79 -0
- package/templates/app-payload/tsconfig.json.example +24 -0
- package/templates/app-vite/.env.example +77 -0
- package/templates/app-vite/index.html.example +127 -0
- package/templates/app-vite/service-account-key.json.example +2 -0
- package/templates/app-vite/src/App.tsx.example +39 -0
- package/templates/app-vite/src/Routes.tsx.example +16 -0
- package/templates/app-vite/src/config/app.ts.example +75 -0
- package/templates/app-vite/src/config/legal.ts.example +170 -0
- package/templates/app-vite/src/globals.css.example +11 -0
- package/templates/app-vite/src/locales/dndev_en.json.example +516 -0
- package/templates/app-vite/src/main.tsx.example +21 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +22 -0
- package/templates/app-vite/src/pages/NotFoundPage.tsx.example +33 -0
- package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +75 -0
- package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +69 -0
- package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +71 -0
- package/templates/app-vite/src/pages/locales/README.md.example +1 -0
- package/templates/app-vite/src/pages/locales/example_en.json.example +5 -0
- package/templates/app-vite/src/themes.css.example +179 -0
- package/templates/app-vite/tsconfig.json.example +9 -0
- package/templates/app-vite/vite.config.ts.example +9 -0
- package/templates/functions-firebase/README.md.example +129 -0
- package/templates/functions-firebase/build.mjs.example +52 -0
- package/templates/functions-firebase/functions-firebase/.env.example.example +45 -0
- package/templates/functions-firebase/functions-firebase/README.md.example +123 -0
- package/templates/functions-firebase/functions-firebase/build.mjs.example +52 -0
- package/templates/functions-firebase/functions-firebase/src/auth/getCustomClaims.ts.example +19 -0
- package/templates/functions-firebase/functions-firebase/src/auth/getUserAuthStatus.ts.example +21 -0
- package/templates/functions-firebase/functions-firebase/src/auth/index.ts.example +11 -0
- package/templates/functions-firebase/functions-firebase/src/auth/removeCustomClaims.ts.example +21 -0
- package/templates/functions-firebase/functions-firebase/src/auth/setCustomClaims.ts.example +21 -0
- package/templates/functions-firebase/functions-firebase/src/billing/handleStripeWebhook.ts.example +24 -0
- package/templates/functions-firebase/functions-firebase/src/billing/index.ts.example +10 -0
- package/templates/functions-firebase/functions-firebase/src/billing/processPaymentSuccess.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/crud/createEntity.ts.example +19 -0
- package/templates/functions-firebase/functions-firebase/src/crud/deleteEntity.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/crud/getEntity.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/crud/index.ts.example +12 -0
- package/templates/functions-firebase/functions-firebase/src/crud/listEntities.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/crud/updateEntity.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/index.ts.example +45 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/checkGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/disconnect.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/exchangeToken.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/getConnections.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/grantGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/index.ts.example +17 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/refreshToken.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/functions-firebase/tsconfig.json.example +21 -0
- package/templates/functions-firebase/functions.yaml.example +14 -0
- package/templates/functions-firebase/src/auth/getCustomClaims.ts.example +19 -0
- package/templates/functions-firebase/src/auth/getUserAuthStatus.ts.example +21 -0
- package/templates/functions-firebase/src/auth/index.ts.example +11 -0
- package/templates/functions-firebase/src/auth/removeCustomClaims.ts.example +21 -0
- package/templates/functions-firebase/src/auth/setCustomClaims.ts.example +21 -0
- package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +24 -0
- package/templates/functions-firebase/src/billing/index.ts.example +10 -0
- package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +14 -0
- package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +14 -0
- package/templates/functions-firebase/src/crud/createEntity.ts.example +19 -0
- package/templates/functions-firebase/src/crud/deleteEntity.ts.example +14 -0
- package/templates/functions-firebase/src/crud/getEntity.ts.example +14 -0
- package/templates/functions-firebase/src/crud/index.ts.example +12 -0
- package/templates/functions-firebase/src/crud/listEntities.ts.example +14 -0
- package/templates/functions-firebase/src/crud/updateEntity.ts.example +14 -0
- package/templates/functions-firebase/src/index.ts.example +45 -0
- package/templates/functions-firebase/src/oauth/checkGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/disconnect.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/exchangeToken.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/getConnections.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/grantGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/index.ts.example +17 -0
- package/templates/functions-firebase/src/oauth/refreshToken.ts.example +14 -0
- package/templates/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +14 -0
- package/templates/functions-firebase/tsconfig.json.example +24 -0
- package/templates/functions-vercel/README.md.example +116 -0
- package/templates/functions-vercel/build.mjs.example +52 -0
- package/templates/functions-vercel/functions-vercel/.env.example.example +37 -0
- package/templates/functions-vercel/functions-vercel/README.md.example +116 -0
- package/templates/functions-vercel/functions-vercel/build.mjs.example +52 -0
- package/templates/functions-vercel/functions-vercel/src/api/auth/getCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/auth/removeCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/auth/setCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/crud/createEntity.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/crud/deleteEntity.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/crud/getEntity.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/crud/listEntities.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/crud/updateEntity.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/disconnect.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/exchangeToken.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/getConnections.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/refreshToken.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/functions-vercel/tsconfig.json.example +21 -0
- package/templates/functions-vercel/functions-vercel/vercel.json.example +14 -0
- package/templates/functions-vercel/src/api/auth/getCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +20 -0
- package/templates/functions-vercel/src/api/auth/removeCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/src/api/auth/setCustomClaims.ts.example +20 -0
- package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +20 -0
- package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +20 -0
- package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +20 -0
- package/templates/functions-vercel/src/api/crud/createEntity.ts.example +20 -0
- package/templates/functions-vercel/src/api/crud/deleteEntity.ts.example +20 -0
- package/templates/functions-vercel/src/api/crud/getEntity.ts.example +20 -0
- package/templates/functions-vercel/src/api/crud/listEntities.ts.example +20 -0
- package/templates/functions-vercel/src/api/crud/updateEntity.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/disconnect.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/exchangeToken.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/getConnections.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/refreshToken.ts.example +20 -0
- package/templates/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +20 -0
- package/templates/functions-vercel/tsconfig.json.example +24 -0
- package/templates/functions-vercel/vercel.json.example +14 -0
- package/templates/github/github/workflows/firebase-deploy.yml.example +79 -0
- package/templates/github/workflows/firebase-deploy.yml.example +79 -0
- package/templates/root-consumer/.env.example +19 -0
- package/templates/root-consumer/.gitignore.example +82 -0
- package/templates/root-consumer/.prettierrc.cjs.example +12 -0
- package/templates/root-consumer/CLAUDE.md.example +73 -0
- package/templates/root-consumer/README.md.example +295 -0
- package/templates/root-consumer/bunfig.toml.example +68 -0
- package/templates/root-consumer/eslint.config.js.example +336 -0
- package/templates/root-consumer/firebase.json.example +348 -0
- package/templates/root-consumer/guides/AGENT_START_HERE.md.example +98 -0
- package/templates/root-consumer/guides/APP_CHECK_SETUP.md.example +111 -0
- package/templates/root-consumer/guides/AUTH_SETUP.md.example +92 -0
- package/templates/root-consumer/guides/BILLING_SETUP.md.example +120 -0
- package/templates/root-consumer/guides/CLI.md.example +293 -0
- package/templates/root-consumer/guides/COMPONENTS.md.example +875 -0
- package/templates/root-consumer/guides/CONFIG_SETUP.md.example +132 -0
- package/templates/root-consumer/guides/EMULATOR_SETUP.md.example +48 -0
- package/templates/root-consumer/guides/FEATURES.md.example +286 -0
- package/templates/root-consumer/guides/FRAMEWORK_OVERVIEW.md.example +97 -0
- package/templates/root-consumer/guides/FUNCTIONS.md.example +177 -0
- package/templates/root-consumer/guides/GETTING_STARTED.md.example +451 -0
- package/templates/root-consumer/guides/HOW_TO_USE.md.example +296 -0
- package/templates/root-consumer/guides/I18N_SETUP.md.example +204 -0
- package/templates/root-consumer/guides/IMPORT_PATTERNS.md.example +79 -0
- package/templates/root-consumer/guides/INDEX.md.example +50 -0
- package/templates/root-consumer/guides/INSTALLATION.md.example +296 -0
- package/templates/root-consumer/guides/LAYOUTS.md.example +310 -0
- package/templates/root-consumer/guides/PAGES_SETUP.md.example +123 -0
- package/templates/root-consumer/guides/STYLING.md.example +273 -0
- package/templates/root-consumer/guides/THEMING_SETUP.md.example +119 -0
- package/templates/root-consumer/guides/VERSION_CONTROL.md.example +181 -0
- package/templates/root-consumer/tsconfig.functions.json.example +15 -0
- package/templates/root-consumer/tsconfig.json.example +18 -0
- package/templates/root-consumer/turbo.json.example +46 -0
- package/templates/root-consumer/vercel.json.example +124 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{APP_NAME}} Get Custom Claims Wrapper
|
|
3
|
+
* @description Wrapper for framework's getCustomClaims with {{APP_NAME}}-specific configuration
|
|
4
|
+
* @version 0.0.1
|
|
5
|
+
* @since 0.0.1
|
|
6
|
+
* @author AMBROISE PARK Consulting
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getCustomClaims as frameworkGetCustomClaims } from '@donotdev/functions/firebase';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* {{APP_NAME}} custom claims retrieval
|
|
13
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
14
|
+
*
|
|
15
|
+
* @version 0.0.1
|
|
16
|
+
* @since 0.0.1
|
|
17
|
+
* @author AMBROISE PARK Consulting
|
|
18
|
+
*/
|
|
19
|
+
export const getCustomClaims = frameworkGetCustomClaims;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// functions/src/auth/getUserAuthStatus.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} User Auth Status Wrapper
|
|
5
|
+
* @description Wrapper for framework's getUserAuthStatus with {{APP_NAME}}-specific configuration
|
|
6
|
+
* @version 0.0.1
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getUserAuthStatus as frameworkGetUserAuthStatus } from '@donotdev/functions/firebase';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* {{APP_NAME}} user authentication status
|
|
15
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
+
*
|
|
17
|
+
* @version 0.0.1
|
|
18
|
+
* @since 0.0.1
|
|
19
|
+
* @author AMBROISE PARK Consulting
|
|
20
|
+
*/
|
|
21
|
+
export const getUserAuthStatus = frameworkGetUserAuthStatus;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// functions/src/auth/index.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Auth Functions
|
|
5
|
+
* @description Exports all auth-related functions for the {{APP_NAME}} app
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { setCustomClaims } from './setCustomClaims';
|
|
9
|
+
export { getCustomClaims } from './getCustomClaims';
|
|
10
|
+
export { removeCustomClaims } from './removeCustomClaims';
|
|
11
|
+
export { getUserAuthStatus } from './getUserAuthStatus';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// functions/src/auth/removeCustomClaims.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Remove Custom Claims Wrapper
|
|
5
|
+
* @description Wrapper for framework's removeCustomClaims with {{APP_NAME}}-specific configuration
|
|
6
|
+
* @version 0.0.1
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { removeCustomClaims as frameworkRemoveCustomClaims } from '@donotdev/functions/firebase';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* {{APP_NAME}} custom claims removal
|
|
15
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
+
*
|
|
17
|
+
* @version 0.0.1
|
|
18
|
+
* @since 0.0.1
|
|
19
|
+
* @author AMBROISE PARK Consulting
|
|
20
|
+
*/
|
|
21
|
+
export const removeCustomClaims = frameworkRemoveCustomClaims;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// functions/src/auth/setCustomClaims.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Set Custom Claims Wrapper
|
|
5
|
+
* @description Wrapper for framework's setCustomClaims with {{APP_NAME}}-specific configuration
|
|
6
|
+
* @version 0.0.1
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { setCustomClaims as frameworkSetCustomClaims } from '@donotdev/functions/firebase';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* {{APP_NAME}} custom claims setting
|
|
15
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
16
|
+
*
|
|
17
|
+
* @version 0.0.1
|
|
18
|
+
* @since 0.0.1
|
|
19
|
+
* @author AMBROISE PARK Consulting
|
|
20
|
+
*/
|
|
21
|
+
export const setCustomClaims = frameworkSetCustomClaims;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// functions/src/billing/handleStripeWebhook.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Stripe Webhook Wrapper
|
|
5
|
+
* @description Wrapper for framework's createStripeWebhookHandler with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createStripeWebhookHandler } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} Stripe webhook handler
|
|
12
|
+
* Configured with {{APP_NAME}}-specific product types and settings
|
|
13
|
+
*/
|
|
14
|
+
export const stripeWebhook = createStripeWebhookHandler({
|
|
15
|
+
productTypes: {
|
|
16
|
+
// Add your product types here
|
|
17
|
+
// Example:
|
|
18
|
+
// premium_plan: {
|
|
19
|
+
// tier: 'premium',
|
|
20
|
+
// subscriptionEnd: '2099-12-31T23:59:59.000Z',
|
|
21
|
+
// githubRepo: { owner: 'your-org', repo: 'your-repo' },
|
|
22
|
+
// },
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// functions/src/billing/index.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Billing Functions
|
|
5
|
+
* @description Exports all billing-related functions for the {{APP_NAME}} app
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { processPaymentSuccess } from './processPaymentSuccess';
|
|
9
|
+
export { refreshSubscriptionStatus } from './refreshSubscriptionStatus';
|
|
10
|
+
export { stripeWebhook } from './handleStripeWebhook';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/billing/processPaymentSuccess.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Payment Success Wrapper
|
|
5
|
+
* @description Wrapper for framework's processPaymentSuccess with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { processPaymentSuccess as frameworkProcessPaymentSuccess } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} payment success processing
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const processPaymentSuccess = frameworkProcessPaymentSuccess;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/billing/refreshSubscriptionStatus.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Subscription Status Wrapper
|
|
5
|
+
* @description Wrapper for framework's refreshSubscriptionStatus with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { refreshSubscriptionStatus as frameworkRefreshSubscriptionStatus } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} subscription status refresh
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const refreshSubscriptionStatus = frameworkRefreshSubscriptionStatus;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{APP_NAME}} Create Entity Wrapper
|
|
3
|
+
* @description Wrapper for framework's createEntity with {{APP_NAME}}-specific configuration
|
|
4
|
+
* @version 0.0.1
|
|
5
|
+
* @since 0.0.1
|
|
6
|
+
* @author AMBROISE PARK Consulting
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createEntity as frameworkCreateEntity } from '@donotdev/functions/firebase';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* {{APP_NAME}} entity creation
|
|
13
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
14
|
+
*
|
|
15
|
+
* @version 0.0.1
|
|
16
|
+
* @since 0.0.1
|
|
17
|
+
* @author AMBROISE PARK Consulting
|
|
18
|
+
*/
|
|
19
|
+
export const createEntity = frameworkCreateEntity;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/crud/deleteEntity.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Delete Entity Wrapper
|
|
5
|
+
* @description Wrapper for framework's deleteEntity with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { deleteEntity as frameworkDeleteEntity } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} entity deletion
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const deleteEntity = frameworkDeleteEntity;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/crud/getEntity.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Get Entity Wrapper
|
|
5
|
+
* @description Wrapper for framework's getEntity with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getEntity as frameworkGetEntity } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} entity retrieval
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const getEntity = frameworkGetEntity;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// functions/src/crud/index.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} CRUD Functions
|
|
5
|
+
* @description Exports all CRUD-related functions for the {{APP_NAME}} app
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { createEntity } from './createEntity';
|
|
9
|
+
export { updateEntity } from './updateEntity';
|
|
10
|
+
export { deleteEntity } from './deleteEntity';
|
|
11
|
+
export { getEntity } from './getEntity';
|
|
12
|
+
export { listEntities } from './listEntities';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/crud/listEntities.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} List Entities Wrapper
|
|
5
|
+
* @description Wrapper for framework's listEntities with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { listEntities as frameworkListEntities } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} entities listing
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const listEntities = frameworkListEntities;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/crud/updateEntity.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Update Entity Wrapper
|
|
5
|
+
* @description Wrapper for framework's updateEntity with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { updateEntity as frameworkUpdateEntity } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} entity update
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const updateEntity = frameworkUpdateEntity;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// functions/src/index.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Firebase Functions
|
|
5
|
+
* @description {{APP_NAME}} functions that wrap framework functions with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
9
|
+
|
|
10
|
+
// Initialize Firebase Admin if not already initialized
|
|
11
|
+
if (!(globalThis as any).__FIREBASE_ADMIN_INITIALIZED__) {
|
|
12
|
+
initializeApp();
|
|
13
|
+
(globalThis as any).__FIREBASE_ADMIN_INITIALIZED__ = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Export auth functions
|
|
17
|
+
export {
|
|
18
|
+
setCustomClaims,
|
|
19
|
+
getCustomClaims,
|
|
20
|
+
removeCustomClaims,
|
|
21
|
+
getUserAuthStatus,
|
|
22
|
+
} from './auth';
|
|
23
|
+
|
|
24
|
+
// Export OAuth functions
|
|
25
|
+
export {
|
|
26
|
+
grantGitHubAccess,
|
|
27
|
+
revokeGitHubAccess,
|
|
28
|
+
checkGitHubAccess,
|
|
29
|
+
} from './oauth';
|
|
30
|
+
|
|
31
|
+
// Export CRUD functions
|
|
32
|
+
export {
|
|
33
|
+
createEntity,
|
|
34
|
+
updateEntity,
|
|
35
|
+
deleteEntity,
|
|
36
|
+
getEntity,
|
|
37
|
+
listEntities,
|
|
38
|
+
} from './crud';
|
|
39
|
+
|
|
40
|
+
// Export billing functions
|
|
41
|
+
export {
|
|
42
|
+
processPaymentSuccess,
|
|
43
|
+
refreshSubscriptionStatus,
|
|
44
|
+
stripeWebhook,
|
|
45
|
+
} from './billing';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/checkGitHubAccess.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} GitHub Access Check Wrapper
|
|
5
|
+
* @description Wrapper for framework's checkGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { checkGitHubAccess as frameworkCheckGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} GitHub access checking
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const checkGitHubAccess = frameworkCheckGitHubAccess;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/disconnect.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Disconnect OAuth Wrapper
|
|
5
|
+
* @description Wrapper for framework's disconnect with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { disconnect as frameworkDisconnect } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} OAuth disconnection
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const disconnect = frameworkDisconnect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/exchangeToken.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Exchange Token Wrapper
|
|
5
|
+
* @description Wrapper for framework's exchangeToken with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { exchangeToken as frameworkExchangeToken } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} OAuth token exchange
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const exchangeToken = frameworkExchangeToken;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/getConnections.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Get Connections Wrapper
|
|
5
|
+
* @description Wrapper for framework's getConnections with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getConnections as frameworkGetConnections } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} OAuth connections retrieval
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const getConnections = frameworkGetConnections;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/grantGitHubAccess.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} GitHub Access Wrapper
|
|
5
|
+
* @description Wrapper for framework's grantGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { grantGitHubAccess as frameworkGrantGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} GitHub access granting
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const grantGitHubAccess = frameworkGrantGitHubAccess;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// functions/src/oauth/index.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} OAuth Functions
|
|
5
|
+
* @description Exports all OAuth-related functions for the {{APP_NAME}} app
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Generic OAuth functions
|
|
9
|
+
export { exchangeToken } from './exchangeToken';
|
|
10
|
+
export { getConnections } from './getConnections';
|
|
11
|
+
export { disconnect } from './disconnect';
|
|
12
|
+
export { refreshToken } from './refreshToken';
|
|
13
|
+
|
|
14
|
+
// GitHub-specific OAuth functions
|
|
15
|
+
export { grantGitHubAccess } from './grantGitHubAccess';
|
|
16
|
+
export { revokeGitHubAccess } from './revokeGitHubAccess';
|
|
17
|
+
export { checkGitHubAccess } from './checkGitHubAccess';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/refreshToken.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} Refresh Token Wrapper
|
|
5
|
+
* @description Wrapper for framework's refreshToken with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { refreshToken as frameworkRefreshToken } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} OAuth token refresh
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const refreshToken = frameworkRefreshToken;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// functions/src/oauth/revokeGitHubAccess.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview {{APP_NAME}} GitHub Access Revocation Wrapper
|
|
5
|
+
* @description Wrapper for framework's revokeGitHubAccess with {{APP_NAME}}-specific configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { revokeGitHubAccess as frameworkRevokeGitHubAccess } from '@donotdev/functions/firebase';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* {{APP_NAME}} GitHub access revocation
|
|
12
|
+
* Wraps the framework function with {{APP_NAME}}-specific configuration
|
|
13
|
+
*/
|
|
14
|
+
export const revokeGitHubAccess = frameworkRevokeGitHubAccess;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"noUncheckedIndexedAccess": true,
|
|
15
|
+
"types": ["node"],
|
|
16
|
+
"outDir": "./lib",
|
|
17
|
+
"rootDir": "./src",
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
"sourceMap": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*"],
|
|
23
|
+
"exclude": ["node_modules", "lib", "**/*.test.ts"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# {{APP_NAME}} Functions
|
|
2
|
+
|
|
3
|
+
This directory contains the Vercel Functions for the {{APP_NAME}} app, generated using the DoNotDev framework's scaffolding system.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
functions/
|
|
9
|
+
āāā src/
|
|
10
|
+
ā āāā api/
|
|
11
|
+
ā āāā auth/ # Authentication functions
|
|
12
|
+
ā āāā oauth/ # OAuth functions
|
|
13
|
+
ā āāā billing/ # Billing functions
|
|
14
|
+
āāā package.json # Dependencies and scripts
|
|
15
|
+
āāā tsconfig.json # TypeScript configuration
|
|
16
|
+
āāā vercel.json # Vercel configuration
|
|
17
|
+
āāā .env.example # Environment variables template
|
|
18
|
+
āāā README.md # This file
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Authentication Management**: User custom claims and auth status
|
|
24
|
+
- **OAuth Integration**: GitHub access management
|
|
25
|
+
- **Billing Processing**: Stripe checkout and webhook handling
|
|
26
|
+
- **Secure API Layer**: Professional frontend-backend communication
|
|
27
|
+
- **Error Handling**: Comprehensive error handling and logging
|
|
28
|
+
|
|
29
|
+
## Environment Variables
|
|
30
|
+
|
|
31
|
+
### File Structure
|
|
32
|
+
|
|
33
|
+
**Functions use a different .env system than Vite/Next.js:**
|
|
34
|
+
- `.env` ā Local development only (not automatically loaded, use with dotenv if needed)
|
|
35
|
+
- Production ā Use Vercel Environment Variables (synced automatically during `dndev deploy`)
|
|
36
|
+
|
|
37
|
+
**Note:** Functions don't follow Vite/Next.js `.env.local` priority rules. Use Vercel Environment Variables for production.
|
|
38
|
+
|
|
39
|
+
### Required Environment Variables
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Stripe Configuration
|
|
43
|
+
STRIPE_SECRET_KEY=sk_live_...
|
|
44
|
+
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
45
|
+
|
|
46
|
+
# GitHub Configuration
|
|
47
|
+
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
|
|
48
|
+
GITHUB_REPO_OWNER=your-org
|
|
49
|
+
GITHUB_REPO_NAME=your-repo
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Setup Instructions
|
|
53
|
+
|
|
54
|
+
1. **Stripe Setup**:
|
|
55
|
+
- Create products in Stripe Dashboard
|
|
56
|
+
- Get price IDs and add to frontend `.env.local` (dev) or `.env.production.local` (prod)
|
|
57
|
+
- Configure webhook endpoint in Stripe
|
|
58
|
+
- Add webhook secret to functions `.env` (local) or Vercel Environment Variables (production)
|
|
59
|
+
|
|
60
|
+
2. **GitHub Setup**:
|
|
61
|
+
- Create Personal Access Token with `repo` scope
|
|
62
|
+
- Add token to functions `.env` (local) or Vercel Environment Variables (production)
|
|
63
|
+
- Configure repository owner/name
|
|
64
|
+
|
|
65
|
+
3. **Vercel Setup**:
|
|
66
|
+
- Deploy: `dndev deploy` (from workspace root)
|
|
67
|
+
- Set environment variables in Vercel dashboard
|
|
68
|
+
- Update webhook URL in Stripe dashboard
|
|
69
|
+
|
|
70
|
+
## Deployment
|
|
71
|
+
|
|
72
|
+
Use the unified deployment command from workspace root:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Deploy everything (interactive)
|
|
76
|
+
dndev deploy
|
|
77
|
+
|
|
78
|
+
# Deploy specific app
|
|
79
|
+
dndev deploy <app-name>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Start Vercel development server
|
|
86
|
+
bun run dev
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API Endpoints
|
|
90
|
+
|
|
91
|
+
### Stripe Webhook
|
|
92
|
+
|
|
93
|
+
- **URL**: `https://your-app.vercel.app/api/billing/handleStripeWebhook`
|
|
94
|
+
- **Events**: `checkout.session.completed`
|
|
95
|
+
- **Purpose**: Processes purchases and grants access
|
|
96
|
+
|
|
97
|
+
### Checkout Session
|
|
98
|
+
|
|
99
|
+
- **Integration**: Direct Stripe calls (no API needed)
|
|
100
|
+
- **Purpose**: Creates Stripe checkout sessions for purchases
|
|
101
|
+
|
|
102
|
+
## Security
|
|
103
|
+
|
|
104
|
+
- All functions require authentication
|
|
105
|
+
- Webhook signature verification
|
|
106
|
+
- Secure GitHub token management
|
|
107
|
+
- Environment variable protection
|
|
108
|
+
|
|
109
|
+
## Framework Integration
|
|
110
|
+
|
|
111
|
+
This functions package demonstrates how to:
|
|
112
|
+
|
|
113
|
+
- Use the framework's scaffolding system
|
|
114
|
+
- Implement secure API communication
|
|
115
|
+
- Handle complex purchase flows
|
|
116
|
+
- Integrate with external services (Stripe, GitHub)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Build script for {{APP_NAME}} Vercel functions
|
|
4
|
+
* @description Bundles @donotdev/types and imports framework functions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { build } from 'esbuild';
|
|
8
|
+
import { createAppFunctionsConfig } from '@donotdev/core/functions';
|
|
9
|
+
|
|
10
|
+
async function buildFunctions() {
|
|
11
|
+
console.log('šØ Building {{APP_NAME}} Vercel functions...');
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const config = createAppFunctionsConfig({
|
|
15
|
+
entry: 'src/index.ts',
|
|
16
|
+
outDir: 'lib',
|
|
17
|
+
minify: process.env.NODE_ENV === 'production',
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log('š¦ Bundling @donotdev/types and importing framework functions...');
|
|
22
|
+
|
|
23
|
+
const result = await build(config);
|
|
24
|
+
|
|
25
|
+
if (result.errors.length > 0) {
|
|
26
|
+
console.error('ā Build errors:', result.errors);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (result.warnings.length > 0) {
|
|
31
|
+
console.warn('ā ļø Build warnings:', result.warnings);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.log('ā
{{APP_NAME}} Vercel functions built successfully!');
|
|
35
|
+
console.log('š Output directory: lib/');
|
|
36
|
+
|
|
37
|
+
// Log bundle info if metafile is available
|
|
38
|
+
if (result.metafile) {
|
|
39
|
+
const { analyzeMetafile } = await import('esbuild');
|
|
40
|
+
const analysis = await analyzeMetafile(result.metafile);
|
|
41
|
+
console.log('\nš Bundle analysis:');
|
|
42
|
+
console.log(analysis);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('ā Build failed:', error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Run the build
|
|
52
|
+
buildFunctions();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# {{APP_NAME}} Vercel Functions Environment Variables
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Copy this file to .env.local in the functions directory and update with your values
|
|
5
|
+
|
|
6
|
+
# =============================================================================
|
|
7
|
+
# Stripe Configuration
|
|
8
|
+
# =============================================================================
|
|
9
|
+
# Stripe Secret Key (server-side only)
|
|
10
|
+
STRIPE_SECRET_KEY=sk_test_1234567890abcdef
|
|
11
|
+
|
|
12
|
+
# Stripe Webhook Secret (for webhook signature verification)
|
|
13
|
+
STRIPE_WEBHOOK_SECRET=whsec_1234567890abcdef
|
|
14
|
+
|
|
15
|
+
# =============================================================================
|
|
16
|
+
# GitHub Configuration
|
|
17
|
+
# =============================================================================
|
|
18
|
+
# GitHub Personal Access Token (for repository access management)
|
|
19
|
+
# Required scopes: repo (full control of private repositories)
|
|
20
|
+
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_1234567890abcdef
|
|
21
|
+
|
|
22
|
+
# GitHub Repository Configuration
|
|
23
|
+
GITHUB_REPO_OWNER=your-org
|
|
24
|
+
GITHUB_REPO_NAME=your-repo
|
|
25
|
+
|
|
26
|
+
# =============================================================================
|
|
27
|
+
# Development Configuration
|
|
28
|
+
# =============================================================================
|
|
29
|
+
# Node Environment
|
|
30
|
+
NODE_ENV=development
|
|
31
|
+
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# Setup Instructions
|
|
34
|
+
# =============================================================================
|
|
35
|
+
# 1. Get Stripe keys from: https://dashboard.stripe.com/apikeys
|
|
36
|
+
# 2. Get GitHub token from: https://github.com/settings/tokens
|
|
37
|
+
# 3. Set environment variables in Vercel dashboard for production
|