@donotdev/cli 0.0.3 → 0.0.4
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 +12 -24
- package/dist/bin/commands/bump.d.ts +1 -1
- package/dist/bin/commands/format.d.ts +1 -1
- package/dist/bin/commands/lint.d.ts +1 -1
- package/package.json +1 -9
- package/templates/app-demo/src/themes.css.example +108 -156
- package/templates/app-next/src/locales/home_en.json.example +6 -0
- package/templates/app-next/src/pages/HomePage.tsx.example +152 -8
- package/templates/app-next/src/themes.css.example +92 -140
- package/templates/app-vite/src/App.tsx.example +2 -2
- package/templates/app-vite/src/locales/home_en.json.example +6 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +149 -8
- package/templates/app-vite/src/themes.css.example +90 -138
- package/templates/root-consumer/guides/AGENT_START_HERE.md.example +83 -61
- package/templates/root-consumer/guides/COMPONENTS_ATOMIC.md.example +134 -0
- package/templates/root-consumer/guides/COMPONENTS_CRUD.md.example +70 -0
- package/templates/root-consumer/guides/COMPONENTS_UI.md.example +135 -0
- package/templates/root-consumer/guides/ENV_SETUP.md.example +14 -0
- package/templates/root-consumer/guides/INDEX.md.example +17 -25
- package/templates/root-consumer/guides/SETUP_AUTH.md.example +77 -0
- package/templates/root-consumer/guides/SETUP_BILLING.md.example +78 -0
- package/templates/root-consumer/guides/SETUP_FUNCTIONS.md.example +62 -0
- package/templates/root-consumer/guides/SETUP_I18N.md.example +48 -0
- package/templates/root-consumer/guides/SETUP_LAYOUTS.md.example +108 -0
- package/templates/root-consumer/guides/SETUP_OAUTH.md.example +53 -0
- package/templates/root-consumer/guides/SETUP_PAGES.md.example +112 -0
- package/templates/root-consumer/guides/SETUP_THEMES.md.example +107 -0
- package/templates/root-consumer/guides/advanced/COOKIE_REFERENCE.md.example +252 -0
- package/templates/root-consumer/guides/{EMULATOR_SETUP.md.example → advanced/EMULATORS.md.example} +1 -1
- package/templates/root-consumer/guides/{VERSION_CONTROL.md.example → advanced/VERSION_CONTROL.md.example} +0 -7
- package/templates/root-consumer/guides/AUTH_SETUP.md.example +0 -92
- package/templates/root-consumer/guides/BILLING_SETUP.md.example +0 -120
- package/templates/root-consumer/guides/CLI.md.example +0 -293
- package/templates/root-consumer/guides/COMPONENTS.md.example +0 -875
- package/templates/root-consumer/guides/FEATURES.md.example +0 -286
- package/templates/root-consumer/guides/FRAMEWORK_OVERVIEW.md.example +0 -97
- package/templates/root-consumer/guides/FUNCTIONS.md.example +0 -177
- package/templates/root-consumer/guides/GETTING_STARTED.md.example +0 -451
- package/templates/root-consumer/guides/HOW_TO_USE.md.example +0 -296
- package/templates/root-consumer/guides/I18N_SETUP.md.example +0 -204
- package/templates/root-consumer/guides/IMPORT_PATTERNS.md.example +0 -79
- package/templates/root-consumer/guides/INSTALLATION.md.example +0 -296
- package/templates/root-consumer/guides/LAYOUTS.md.example +0 -310
- package/templates/root-consumer/guides/PAGES_SETUP.md.example +0 -123
- package/templates/root-consumer/guides/STYLING.md.example +0 -273
- package/templates/root-consumer/guides/THEMING_SETUP.md.example +0 -119
- /package/templates/root-consumer/guides/{CONFIG_SETUP.md.example → SETUP_APP_CONFIG.md.example} +0 -0
- /package/templates/root-consumer/guides/{APP_CHECK_SETUP.md.example → advanced/APP_CHECK.md.example} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# UI Package Reference
|
|
2
|
+
|
|
3
|
+
**Check JSDoc in your IDE** - Hover over any component import to see props, types, and examples.
|
|
4
|
+
|
|
5
|
+
**Import from:** `@donotdev/ui` (layout/composition components)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Layout Components
|
|
10
|
+
|
|
11
|
+
- **PageContainer** - Page wrapper with width constraints, spacing, and density system.
|
|
12
|
+
- **GameContainer** - Game preset container with fixed header/footer layout.
|
|
13
|
+
- **GameFlow** - Game flow component for step-by-step game interfaces.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Layout Sub-Components
|
|
18
|
+
|
|
19
|
+
- **AppBranding** - App branding display with logo and name.
|
|
20
|
+
- **AppIcon** - App icon component.
|
|
21
|
+
- **AppTitle** - App title display component.
|
|
22
|
+
- **GameTitle** - Game title component for game preset.
|
|
23
|
+
- **Breadcrumbs** - Breadcrumb navigation component.
|
|
24
|
+
- **HeaderNavigation** - Header navigation menu component.
|
|
25
|
+
- **DropdownNavigation** - Dropdown navigation menu.
|
|
26
|
+
- **HeaderMenu** - Header menu component.
|
|
27
|
+
- **SettingsMenu** - Settings menu component.
|
|
28
|
+
- **ThemeToggle** - Theme toggle button component.
|
|
29
|
+
- **CacheSettings** - Cache settings component.
|
|
30
|
+
- **Notifications** - Notifications component.
|
|
31
|
+
- **FloatingLanguageSwitcher** - Floating language selector component.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Auth Components
|
|
36
|
+
|
|
37
|
+
- **AuthHeader** - Header component with authentication UI (sign in/out, user menu).
|
|
38
|
+
- **AuthMenu** - Authentication menu component.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Common Components
|
|
43
|
+
|
|
44
|
+
- **AppLoading** - App-level loading component.
|
|
45
|
+
- **FeatureDisabled** - Component shown when features are disabled.
|
|
46
|
+
- **Icon** - Icon component wrapper.
|
|
47
|
+
- **Loader** - Loading spinner component.
|
|
48
|
+
- **LoadingMessage** - Loading message with variants (processing, saving, uploading, etc.).
|
|
49
|
+
- **LoadingOverlay** - Overlay component for loading states.
|
|
50
|
+
- **LoadingScreen** - Full-screen loading component.
|
|
51
|
+
- **ProgressBar** - Progress bar component.
|
|
52
|
+
- **Skeleton** - Skeleton loading component.
|
|
53
|
+
- **FeatureCard** - Feature showcase card component.
|
|
54
|
+
- **TechBento** - Tech stack showcase component.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Routing Components
|
|
59
|
+
|
|
60
|
+
- **Link** - Platform-agnostic link component (works in Vite + Next.js).
|
|
61
|
+
- **AuthGuard** - Route guard component for protected routes.
|
|
62
|
+
- **AuthGuardFallback** - Fallback component for auth-guarded routes.
|
|
63
|
+
- **GoTo** - Programmatic navigation component.
|
|
64
|
+
- **GoToWrapper** - Wrapper for GoTo navigation.
|
|
65
|
+
- **GoToInput** - Input component for GoTo navigation.
|
|
66
|
+
- **GoToDialog** - Dialog for GoTo navigation.
|
|
67
|
+
- **DnDevNavigationMenu** - Framework navigation menu component.
|
|
68
|
+
- **NotFoundPage** - 404 page component.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Routing Hooks
|
|
73
|
+
|
|
74
|
+
- **useNavigate** - Navigate to routes programmatically.
|
|
75
|
+
- **useBack** - Navigate back in history.
|
|
76
|
+
- **useRefresh** - Refresh current route.
|
|
77
|
+
- **usePrefetch** - Prefetch route data.
|
|
78
|
+
- **useLocation** - Get current location.
|
|
79
|
+
- **useParams** - Get route parameters.
|
|
80
|
+
- **useSearchParams** - Get URL search parameters.
|
|
81
|
+
- **useMatch** - Match current route pattern.
|
|
82
|
+
- **useQueryParams** - Get and set query parameters.
|
|
83
|
+
- **useRedirectGuard** - Guard against redirects.
|
|
84
|
+
- **useNavigation** - Navigation state and methods.
|
|
85
|
+
- **useGoTo** - GoTo navigation hook.
|
|
86
|
+
- **useRouteDiscovery** - Route discovery hook.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Cookie Consent
|
|
91
|
+
|
|
92
|
+
- **CookieConsent** - Cookie consent management component.
|
|
93
|
+
- **ConsentBanner** - Cookie consent banner component.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Platform-Specific Providers
|
|
98
|
+
|
|
99
|
+
- **ViteAppProviders** - App providers for Vite (import from `@donotdev/ui/vite`).
|
|
100
|
+
- **NextJsAppProviders** - App providers for Next.js (import from `@donotdev/ui/next`).
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## CRUD Display Components (from @donotdev/ui)
|
|
105
|
+
|
|
106
|
+
- **DisplayFieldRenderer** - Renders read-only field displays.
|
|
107
|
+
- **EntityDisplayRenderer** - Renders complete entity displays.
|
|
108
|
+
- **TextFieldDisplay** - Text field display component.
|
|
109
|
+
- **BadgeFieldDisplay** - Badge field display component.
|
|
110
|
+
- **AvatarFieldDisplay** - Avatar field display component.
|
|
111
|
+
- **LinkFieldDisplay** - Link field display component.
|
|
112
|
+
- **DateFieldDisplay** - Date field display component.
|
|
113
|
+
- **NumberFieldDisplay** - Number field display component.
|
|
114
|
+
- **PhoneNumberDisplay** - Phone number display component.
|
|
115
|
+
- **TextAreaDisplay** - Textarea display component.
|
|
116
|
+
- **CheckboxFieldDisplay** - Checkbox display component.
|
|
117
|
+
- **DropdownDisplay** - Dropdown display component.
|
|
118
|
+
- **MultiDropdownDisplay** - Multi-select dropdown display component.
|
|
119
|
+
- **MultiInputTextFieldDisplay** - Multi-input text field display component.
|
|
120
|
+
- **RadioFieldDisplay** - Radio field display component.
|
|
121
|
+
- **RangeFieldDisplay** - Range field display component.
|
|
122
|
+
- **FileFieldDisplay** - File field display component.
|
|
123
|
+
- **ImageFieldDisplay** - Image field display component.
|
|
124
|
+
- **GeoPointFieldDisplay** - GeoPoint field display component.
|
|
125
|
+
- **MapFieldDisplay** - Map field display component.
|
|
126
|
+
- **ReferenceFieldDisplay** - Reference field display component.
|
|
127
|
+
- **TimestampFieldDisplay** - Timestamp field display component.
|
|
128
|
+
- **HiddenFieldDisplay** - Hidden field display component.
|
|
129
|
+
- **ButtonFieldDisplay** - Button field display component.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
**For MVP:** Only `PageContainer` is needed. All other components are optional.
|
|
134
|
+
|
|
135
|
+
**All props documented in JSDoc** - Hover in IDE for complete reference.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Environment Setup
|
|
2
|
+
|
|
3
|
+
If you see this guide, you've already installed `@donotdev/cli` and ran `dndev init`.
|
|
4
|
+
|
|
5
|
+
## Next Steps
|
|
6
|
+
|
|
7
|
+
1. **AI Agent?** Have them read [AGENT_START_HERE.md](./AGENT_START_HERE.md)
|
|
8
|
+
2. **Create app:** `dndev create-app` - choose Vite (SPA) or Next.js (SSR), with optional backend
|
|
9
|
+
3. **Build:** Use auto-routing, auth, and translations
|
|
10
|
+
|
|
11
|
+
## Resources
|
|
12
|
+
|
|
13
|
+
- https://donotdev.com
|
|
14
|
+
- Discord: https://discord.gg/fbeYWDak
|
|
@@ -4,46 +4,38 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## Quick Setup
|
|
8
|
-
|
|
9
|
-
1. [INSTALLATION.md](./INSTALLATION.md) - Install framework packages
|
|
10
|
-
2. [GETTING_STARTED.md](./GETTING_STARTED.md) - Scaffold first app
|
|
11
|
-
3. [FRAMEWORK_OVERVIEW.md](./FRAMEWORK_OVERVIEW.md) - Package structure
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
7
|
## Core Setup
|
|
16
8
|
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
9
|
+
- [SETUP_PAGES.md](./SETUP_PAGES.md) - Pages & routing (pre-configured)
|
|
10
|
+
- [SETUP_APP_CONFIG.md](./SETUP_APP_CONFIG.md) - App + Vite configuration
|
|
11
|
+
- [SETUP_I18N.md](./SETUP_I18N.md) - Translations (pre-configured)
|
|
12
|
+
- [SETUP_THEMES.md](./SETUP_THEMES.md) - Themes & CSS variables (pre-configured)
|
|
13
|
+
- [SETUP_LAYOUTS.md](./SETUP_LAYOUTS.md) - Layout presets (pre-configured)
|
|
21
14
|
|
|
22
15
|
---
|
|
23
16
|
|
|
24
17
|
## Feature Setup
|
|
25
18
|
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
- [
|
|
19
|
+
- [SETUP_AUTH.md](./SETUP_AUTH.md) - Authentication (pre-configured)
|
|
20
|
+
- [SETUP_OAUTH.md](./SETUP_OAUTH.md) - OAuth connections (pre-configured)
|
|
21
|
+
- [SETUP_BILLING.md](./SETUP_BILLING.md) - Stripe subscriptions (pre-configured)
|
|
22
|
+
- [SETUP_FUNCTIONS.md](./SETUP_FUNCTIONS.md) - Firebase Functions (pre-configured)
|
|
30
23
|
|
|
31
24
|
---
|
|
32
25
|
|
|
33
|
-
##
|
|
26
|
+
## Component Reference
|
|
34
27
|
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
- [LAYOUTS.md](./LAYOUTS.md) - Layout presets
|
|
39
|
-
- [STYLING.md](./STYLING.md) - Styling system
|
|
40
|
-
- [IMPORT_PATTERNS.md](./IMPORT_PATTERNS.md) - Import conventions
|
|
28
|
+
- [COMPONENTS_ATOMIC.md](./COMPONENTS_ATOMIC.md) - Atomic components (@donotdev/components)
|
|
29
|
+
- [COMPONENTS_UI.md](./COMPONENTS_UI.md) - Layout/composition components (@donotdev/ui)
|
|
30
|
+
- [COMPONENTS_CRUD.md](./COMPONENTS_CRUD.md) - CRUD components (@donotdev/crud)
|
|
41
31
|
|
|
42
32
|
---
|
|
43
33
|
|
|
44
|
-
##
|
|
34
|
+
## Advanced
|
|
45
35
|
|
|
46
|
-
- [
|
|
36
|
+
- [advanced/APP_CHECK.md](./advanced/APP_CHECK.md) - Abuse protection
|
|
37
|
+
- [advanced/EMULATORS.md](./advanced/EMULATORS.md) - Local emulator setup
|
|
38
|
+
- [advanced/VERSION_CONTROL.md](./advanced/VERSION_CONTROL.md) - Package upgrades
|
|
47
39
|
|
|
48
40
|
---
|
|
49
41
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Setup: Authentication (Firebase Auth)
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Firebase Auth for user sign-in/sign-up. Add env vars and config. Framework handles providers, callbacks, sessions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Environment:**
|
|
10
|
+
```bash
|
|
11
|
+
# .env
|
|
12
|
+
VITE_AUTH_PARTNERS=password,emailLink,google,github,facebook
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Config:**
|
|
16
|
+
```typescript
|
|
17
|
+
// src/config/app.ts
|
|
18
|
+
export const appConfig: AppConfig = {
|
|
19
|
+
auth: {
|
|
20
|
+
authRoute: '/login',
|
|
21
|
+
loginPath: '/login', // Optional: undefined = header providers
|
|
22
|
+
profilePath: '/profile',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Firebase Console:** Enable providers in Authentication > Sign-in method
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Advanced: Protected Routes
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// Basic protection
|
|
35
|
+
export const meta: PageMeta = {
|
|
36
|
+
namespace: NAMESPACE,
|
|
37
|
+
auth: { required: true },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Role-based access
|
|
41
|
+
export const meta: PageMeta = {
|
|
42
|
+
namespace: NAMESPACE,
|
|
43
|
+
auth: { required: true, role: 'admin' },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Tier-based access
|
|
47
|
+
export const meta: PageMeta = {
|
|
48
|
+
namespace: NAMESPACE,
|
|
49
|
+
auth: { required: true, tier: 'pro' },
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Advanced: Components & Hooks
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { useAuth } from '@donotdev/auth';
|
|
59
|
+
import { MultipleAuthProviders, AuthPartnerButton } from '@donotdev/auth';
|
|
60
|
+
import { AuthHeader, AuthMenu } from '@donotdev/ui';
|
|
61
|
+
import { LoginTemplate } from '@donotdev/templates';
|
|
62
|
+
|
|
63
|
+
// Hook
|
|
64
|
+
const user = useAuth('user');
|
|
65
|
+
const signIn = useAuth('signInWithEmail');
|
|
66
|
+
const signOut = useAuth('signOut');
|
|
67
|
+
|
|
68
|
+
// Components
|
|
69
|
+
<MultipleAuthProviders layout="vertical" emailMode="signin" />
|
|
70
|
+
<AuthPartnerButton partnerId="google" method="popup" />
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Pre-configured:** `AuthHeader` in layout (null if auth disabled), OAuth callbacks, session management, account linking.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
**Add env vars, get auth. Framework handles the rest.**
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Setup: Billing
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Create Stripe config files. Framework handles checkout, webhooks, subscriptions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Environment:**
|
|
10
|
+
```bash
|
|
11
|
+
# .env (frontend)
|
|
12
|
+
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
|
|
13
|
+
|
|
14
|
+
# functions/.env.local (local)
|
|
15
|
+
STRIPE_SECRET_KEY=sk_test_xxx
|
|
16
|
+
STRIPE_WEBHOOK_SECRET=whsec_xxx # From 'stripe listen'
|
|
17
|
+
|
|
18
|
+
# functions/.env (production)
|
|
19
|
+
STRIPE_SECRET_KEY=sk_live_xxx
|
|
20
|
+
STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Stripe Dashboard:** Create products, copy Price IDs (`price_...`)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Advanced: Frontend Config
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// src/config/stripeFrontConfig.ts
|
|
31
|
+
export const stripeFrontConfig: StripeFrontConfig = {
|
|
32
|
+
pro_plan: {
|
|
33
|
+
name: 'Pro Plan',
|
|
34
|
+
price: 29,
|
|
35
|
+
currency: 'USD',
|
|
36
|
+
priceId: 'price_1234567890',
|
|
37
|
+
allowPromotionCodes: true,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Advanced: Backend Config
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// functions/src/config/stripeBackConfig.ts
|
|
48
|
+
export const stripeBackConfig: StripeBackConfig = {
|
|
49
|
+
pro_plan: {
|
|
50
|
+
type: 'StripeSubscription', // or 'StripePayment'
|
|
51
|
+
price: 2900, // In cents
|
|
52
|
+
priceId: process.env.STRIPE_PRICE_PRO_PLAN!,
|
|
53
|
+
tier: 'pro',
|
|
54
|
+
onPurchaseSuccess: async (userId, metadata) => { /* Grant features */ },
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// functions/src/index.ts
|
|
59
|
+
import { createCheckoutSession } from '@donotdev/functions/firebase';
|
|
60
|
+
export const createCheckout = createCheckoutSession(stripeBackConfig);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Advanced: Components & Hooks
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { useStripeBilling } from '@donotdev/billing';
|
|
69
|
+
import { SubscriptionTemplate, PaymentTemplate } from '@donotdev/templates';
|
|
70
|
+
import { ProductCard, SubscriptionManager } from '@donotdev/billing';
|
|
71
|
+
|
|
72
|
+
const checkout = useStripeBilling('checkout');
|
|
73
|
+
await checkout({ priceId: 'price_123', mode: 'subscription' });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
**Create config files, get billing. Framework handles the rest.**
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Setup: Firebase Functions
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Functions scaffolded. Just add config and deploy.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Structure:**
|
|
10
|
+
```
|
|
11
|
+
functions/
|
|
12
|
+
├── src/
|
|
13
|
+
│ ├── billing/
|
|
14
|
+
│ └── index.ts
|
|
15
|
+
├── functions.yaml # Manually maintained
|
|
16
|
+
└── .env.local # Local secrets
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Environment:**
|
|
20
|
+
```bash
|
|
21
|
+
# .env.local (local)
|
|
22
|
+
STRIPE_SECRET_KEY=sk_test_...
|
|
23
|
+
|
|
24
|
+
# .env (production, synced via dndev sync-secrets)
|
|
25
|
+
STRIPE_SECRET_KEY=sk_live_...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Advanced: Adding Functions
|
|
31
|
+
|
|
32
|
+
1. **Create:** `src/billing/myFunction.ts`
|
|
33
|
+
2. **Export:** `export * from './billing/myFunction.js';` in `src/index.ts`
|
|
34
|
+
3. **Add to functions.yaml:**
|
|
35
|
+
```yaml
|
|
36
|
+
endpoints:
|
|
37
|
+
myFunction:
|
|
38
|
+
region: [europe-west1]
|
|
39
|
+
platform: gcfv2
|
|
40
|
+
httpsTrigger: {}
|
|
41
|
+
entryPoint: myFunction
|
|
42
|
+
labels: {}
|
|
43
|
+
```
|
|
44
|
+
4. **Deploy:** `dndev deploy`
|
|
45
|
+
|
|
46
|
+
**Critical:** Every exported function must be in `functions.yaml` or it won't deploy.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Advanced: Framework Integration
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Your function = framework + your config
|
|
54
|
+
import { createCheckoutSession as generic } from '@donotdev/functions/firebase';
|
|
55
|
+
import { stripeBackConfig } from '../config/stripeBackConfig';
|
|
56
|
+
|
|
57
|
+
export const createCheckoutSession = generic(stripeBackConfig);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
**Add functions, get backend. Framework handles the rest.**
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Setup: Internationalization
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Drop translation files. Framework auto-discovers languages.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Files:** `src/locales/<namespace>_<2-char-ISO>.json` (eager) | `src/pages/locales/<namespace>_<2-char-ISO>.json` (lazy)
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { useTranslation } from '@donotdev/core';
|
|
13
|
+
|
|
14
|
+
const { t } = useTranslation(NAMESPACE);
|
|
15
|
+
t('title');
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**LanguageSelector:** Included in layout presets. Import from `@donotdev/core` if needed elsewhere.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Advanced: Array Translations
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { translateArray, translateObjectArray, maybeTranslate } from '@donotdev/core';
|
|
26
|
+
|
|
27
|
+
translateArray(t, 'benefits', 10); // Up to 10 items (benefits.0-9), safe if only 4 exist
|
|
28
|
+
translateObjectArray(t, 'cases', 10, ['useCase', 'bestFit']); // Up to 10 objects
|
|
29
|
+
maybeTranslate(t, 'products.earlyBird.name'); // Auto-detects key vs string
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Advanced: I18N Components
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { LanguageSelector, LanguageFAB, FAQSection, TranslatedText, useLanguageSelector } from '@donotdev/core';
|
|
38
|
+
|
|
39
|
+
<LanguageSelector display="auto" /> // Already in presets
|
|
40
|
+
<LanguageFAB /> // Floating action button
|
|
41
|
+
<FAQSection items={faqItems} namespace="faq" />
|
|
42
|
+
<TranslatedText keyPath="welcome.message" namespace="home" />
|
|
43
|
+
const { languages, currentLanguage } = useLanguageSelector();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
**Drop files, get languages. Framework handles the rest.**
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Setup: Layouts
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Choose preset in `config/app.ts`. Framework handles header, sidebar, footer, auth, themes, languages.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Choose preset:**
|
|
10
|
+
```typescript
|
|
11
|
+
// config/app.ts
|
|
12
|
+
export const appConfig: AppConfig = {
|
|
13
|
+
preset: 'landing', // landing | admin | moolti | docs | blog | game | plain
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**7 presets:** `landing` (marketing), `admin` (dashboards), `moolti` (SaaS), `docs` (documentation), `blog` (content), `game` (mobile), `plain` (minimal).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Advanced: Slot Overrides
|
|
22
|
+
|
|
23
|
+
**Customize zones:**
|
|
24
|
+
```tsx
|
|
25
|
+
<ViteAppProviders
|
|
26
|
+
config={appConfig}
|
|
27
|
+
layout={{
|
|
28
|
+
header: {
|
|
29
|
+
start: () => <CustomLogo />, // Override start zone
|
|
30
|
+
center: () => <SearchBar />, // Override center zone
|
|
31
|
+
end: () => <UserMenu />, // Override end zone
|
|
32
|
+
},
|
|
33
|
+
sidebar: {
|
|
34
|
+
top: () => <Branding />, // Override top zone
|
|
35
|
+
content: () => <CustomNav />, // Override content zone
|
|
36
|
+
bottom: () => <UserProfile />, // Override bottom zone
|
|
37
|
+
},
|
|
38
|
+
footer: () => <CustomFooter />, // Replace entire footer
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Hide zones:**
|
|
44
|
+
```tsx
|
|
45
|
+
layout={{
|
|
46
|
+
header: {
|
|
47
|
+
center: () => null, // Hide center zone
|
|
48
|
+
},
|
|
49
|
+
footer: () => null, // Hide footer
|
|
50
|
+
}}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Available slots:** `header.start/center/end`, `sidebar.top/content/bottom`, `footer`, `mergedbar` (mobile nav).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Advanced: CSS Variable Overrides
|
|
58
|
+
|
|
59
|
+
**Override dimensions in `src/themes.css`:**
|
|
60
|
+
```css
|
|
61
|
+
:root {
|
|
62
|
+
--header-height: 96px;
|
|
63
|
+
--sidebar-width: 320px;
|
|
64
|
+
--main-max-width: 1480px;
|
|
65
|
+
--footer-height: 64px;
|
|
66
|
+
--section-gap: 2rem;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Framework auto-computes:** Spacing, typography, responsive breakpoints.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Advanced: Density System
|
|
75
|
+
|
|
76
|
+
**Global density:**
|
|
77
|
+
```tsx
|
|
78
|
+
layout={{
|
|
79
|
+
density: 'compact', // compact | standard | expressive
|
|
80
|
+
}}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Per-page density:**
|
|
84
|
+
```tsx
|
|
85
|
+
<PageContainer density="expressive">
|
|
86
|
+
<HeroSection title="Hero" />
|
|
87
|
+
</PageContainer>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Three densities:** `compact` (1.2×), `standard` (1.25×), `expressive` (1.333×).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Advanced: Runtime Preset Changes
|
|
95
|
+
|
|
96
|
+
**Change preset programmatically:**
|
|
97
|
+
```tsx
|
|
98
|
+
import { useLayout } from '@donotdev/core';
|
|
99
|
+
|
|
100
|
+
const setLayoutPreset = useLayout('setLayoutPreset');
|
|
101
|
+
setLayoutPreset('plain'); // Switch to plain layout
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Pre-configured:** All presets handle auth, themes, languages automatically.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
**Choose preset, get layout. Framework handles the rest.**
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Setup: OAuth (Third-Party Connections)
|
|
2
|
+
|
|
3
|
+
**Most is pre-configured.** Connect to Spotify, LinkedIn, GitHub, etc. for API access. Add env vars. Framework handles OAuth flows, token exchange, refresh.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard Use
|
|
8
|
+
|
|
9
|
+
**Environment:**
|
|
10
|
+
```bash
|
|
11
|
+
# .env
|
|
12
|
+
VITE_OAUTH_PARTNERS=github,google,spotify,discord
|
|
13
|
+
VITE_OAUTH_GITHUB_CLIENT_ID=your_github_client_id
|
|
14
|
+
VITE_OAUTH_GOOGLE_CLIENT_ID=your_google_client_id
|
|
15
|
+
VITE_OAUTH_SPOTIFY_CLIENT_ID=your_spotify_client_id
|
|
16
|
+
VITE_OAUTH_DISCORD_CLIENT_ID=your_discord_client_id
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Available:** `github`, `google`, `spotify`, `discord`, `twitch`, `reddit`, `linkedin`, `slack`, `notion`, `medium`, `twitter`, `mastodon`, `youtube`
|
|
20
|
+
|
|
21
|
+
**OAuth Provider Dashboard:** Create OAuth apps, copy Client IDs, configure redirect URIs.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Advanced: Components & Hooks
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { useOAuth } from '@donotdev/oauth';
|
|
29
|
+
import { MultipleOAuthProviders, OAuthPartnerButton } from '@donotdev/oauth';
|
|
30
|
+
import { OAuthConnectionModal } from '@donotdev/oauth';
|
|
31
|
+
|
|
32
|
+
// Hook
|
|
33
|
+
const connect = useOAuth('connect');
|
|
34
|
+
const disconnect = useOAuth('disconnect');
|
|
35
|
+
const isConnected = useOAuth('isConnected');
|
|
36
|
+
const loading = useOAuth('loading');
|
|
37
|
+
const error = useOAuth('error');
|
|
38
|
+
|
|
39
|
+
await connect('github', 'api-access'); // Purpose: 'authentication' | 'api-access'
|
|
40
|
+
await disconnect('github');
|
|
41
|
+
const connected = isConnected('github');
|
|
42
|
+
|
|
43
|
+
// Components
|
|
44
|
+
<MultipleOAuthProviders purpose="api-access" layout="vertical" />
|
|
45
|
+
<OAuthPartnerButton partnerId="github" purpose="api-access" />
|
|
46
|
+
<OAuthConnectionModal />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Pre-configured:** Auto-discovers enabled providers, handles PKCE flow, token refresh, callbacks.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
**Add env vars, get OAuth. Framework handles the rest.**
|