bsmnt 0.1.2 → 0.1.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/package.json +7 -2
- package/.changeset/README.md +0 -10
- package/.changeset/config.json +0 -16
- package/.cursor/rules/README.md +0 -184
- package/.cursor/rules/architecture.mdc +0 -437
- package/.cursor/rules/components.mdc +0 -436
- package/.cursor/rules/integrations.mdc +0 -447
- package/.cursor/rules/main.mdc +0 -278
- package/.cursor/rules/styling.mdc +0 -433
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/workflows/.gitkeep +0 -0
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/release.yml +0 -56
- package/.tldr/cache/call_graph.json +0 -7
- package/.tldr/languages.json +0 -6
- package/.tldr/status +0 -1
- package/.tldrignore +0 -84
- package/.vscode/extensions.json +0 -20
- package/.vscode/settings.json +0 -98
- package/CHANGELOG.md +0 -68
- package/CLAUDE.md +0 -156
- package/biome.json +0 -45
- package/bun.lock +0 -496
- package/changelog/04-02-26.md +0 -86
- package/changelog/05-02-26.md +0 -101
- package/changelog/09-02-26.md +0 -83
- package/docs/architecture.drawio +0 -250
- package/docs/architecture.mermaid +0 -85
- package/docs/fix-studio-hydration.md +0 -46
- package/docs/plans/2026-01-29-sanity-smart-merge-design.md +0 -196
- package/docs/plans/2026-01-29-sanity-smart-merge-implementation.md +0 -695
- package/docs/sanity-setup-steps.md +0 -199
- package/packages/cli/package.json +0 -16
- package/tasks/.last-branch +0 -1
- package/tasks/CLAUDE.md +0 -104
- package/tasks/archive/2026-02-09-next-starter-dynamic-layers/prd.json +0 -153
- package/tasks/archive/2026-02-09-next-starter-dynamic-layers/progress.txt +0 -115
- package/tasks/prd-next-starter-dynamic-layers.md +0 -184
- package/tasks/prd-project-restructure.md +0 -375
- package/tasks/prd.json +0 -289
- package/tasks/progress.txt +0 -309
- package/tasks/ralph.sh +0 -113
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Fix: Studio Hydration Errors
|
|
2
|
-
|
|
3
|
-
## Problem
|
|
4
|
-
|
|
5
|
-
`/studio` route produces two critical React hydration mismatch errors:
|
|
6
|
-
|
|
7
|
-
1. **`<body>` style attribute mismatch** — Server renders inline `style={{margin: 0}}` on a nested `<body>` tag that conflicts with the root layout's `<body>`.
|
|
8
|
-
2. **`<html>` tag attribute mismatch** — `dir`, `className` attributes differ between server and client because a second `<html>` tag is rendered inside the root layout's `<html>`.
|
|
9
|
-
|
|
10
|
-
### Root Cause
|
|
11
|
-
|
|
12
|
-
`app/studio/layout.tsx` renders its own `<html>` and `<body>` tags. In Next.js App Router, nested layouts do **not** replace the root layout — they render **inside** it. This creates duplicate `<html>` and `<body>` elements, causing hydration mismatches.
|
|
13
|
-
|
|
14
|
-
## Fix
|
|
15
|
-
|
|
16
|
-
### File: `app/studio/layout.tsx`
|
|
17
|
-
|
|
18
|
-
**Before:**
|
|
19
|
-
```tsx
|
|
20
|
-
export default function StudioLayout({
|
|
21
|
-
children,
|
|
22
|
-
}: {
|
|
23
|
-
children: React.ReactNode;
|
|
24
|
-
}) {
|
|
25
|
-
return (
|
|
26
|
-
<html lang="en">
|
|
27
|
-
<body style={{ margin: 0 }}>{children}</body>
|
|
28
|
-
</html>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**After:**
|
|
34
|
-
```tsx
|
|
35
|
-
export default function StudioLayout({
|
|
36
|
-
children,
|
|
37
|
-
}: {
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
}) {
|
|
40
|
-
return children;
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Notes
|
|
45
|
-
|
|
46
|
-
- There is also a `motion() is deprecated. Use motion.create() instead.` warning — this is upstream in the `sanity` package's internal use of framer-motion. No action needed on our end.
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
# Sanity Smart Merge Integration Design
|
|
2
|
-
|
|
3
|
-
> Date: 2026-01-29
|
|
4
|
-
> Status: Approved for implementation
|
|
5
|
-
|
|
6
|
-
## Problem
|
|
7
|
-
|
|
8
|
-
The current Sanity integration uses `tiged` to overlay files directly onto the selected template. This causes template-specific code to be completely overwritten, losing:
|
|
9
|
-
- Template-specific providers and imports in `app/layout.tsx`
|
|
10
|
-
- Template-specific sitemap entries in `app/sitemap.ts`
|
|
11
|
-
- Other integration checks in `lib/integrations/check-integration.ts`
|
|
12
|
-
|
|
13
|
-
## Solution
|
|
14
|
-
|
|
15
|
-
Replace the blind file overlay with a **smart merge system** that:
|
|
16
|
-
1. Copies additive files directly (new directories/files)
|
|
17
|
-
2. Intelligently merges files that exist in both template and integration
|
|
18
|
-
|
|
19
|
-
## Architecture
|
|
20
|
-
|
|
21
|
-
### Current Flow (Broken)
|
|
22
|
-
```
|
|
23
|
-
1. Clone template via tiged
|
|
24
|
-
2. Overlay integration via tiged (OVERWRITES files)
|
|
25
|
-
3. Hydrate package.json
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### New Flow (Smart Merge)
|
|
29
|
-
```
|
|
30
|
-
1. Clone template via tiged → targetDir
|
|
31
|
-
2. Clone integration to TEMP directory (not targetDir)
|
|
32
|
-
3. Process integration files:
|
|
33
|
-
a. ADDITIVE files → copy directly to targetDir
|
|
34
|
-
b. MERGE files → read both versions, merge, write result
|
|
35
|
-
4. Clean up temp directory
|
|
36
|
-
5. Hydrate package.json
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## File Classification
|
|
40
|
-
|
|
41
|
-
### Files Requiring Smart Merge
|
|
42
|
-
| File | Merge Strategy |
|
|
43
|
-
|------|----------------|
|
|
44
|
-
| `app/layout.tsx` | Add imports, variables, and Sanity components after `{children}` |
|
|
45
|
-
| `app/sitemap.ts` | Add imports and Sanity page/article fetching to return array |
|
|
46
|
-
| `lib/integrations/check-integration.ts` | Append `isSanityConfigured()` function |
|
|
47
|
-
|
|
48
|
-
### Additive Files (Direct Copy)
|
|
49
|
-
- `lib/integrations/sanity/` — entire directory
|
|
50
|
-
- `components/ui/sanity-image/` — new component
|
|
51
|
-
- `app/api/draft-mode/` — new API routes
|
|
52
|
-
- `lib/utils/metadata.ts` — new utility
|
|
53
|
-
- `lib/scripts/generate-page.ts` — new script
|
|
54
|
-
|
|
55
|
-
## New File Structure
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
src/
|
|
59
|
-
├── commands/create.js # Updated to use new merge logic
|
|
60
|
-
├── mergers/ # NEW: Smart merge functions
|
|
61
|
-
│ ├── index.js # Orchestrates merging
|
|
62
|
-
│ ├── config.js # File classification config
|
|
63
|
-
│ ├── layout-merger.js # Merges app/layout.tsx
|
|
64
|
-
│ ├── sitemap-merger.js # Merges app/sitemap.ts
|
|
65
|
-
│ └── check-integration-merger.js # Merges check-integration.ts
|
|
66
|
-
└── utils/
|
|
67
|
-
└── file-utils.js # Helper for reading/writing files
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Merge Strategies
|
|
71
|
-
|
|
72
|
-
### Layout Merger (`app/layout.tsx`)
|
|
73
|
-
|
|
74
|
-
**Injected imports:**
|
|
75
|
-
```tsx
|
|
76
|
-
import { draftMode } from 'next/headers'
|
|
77
|
-
import { Suspense } from 'react'
|
|
78
|
-
import { VisualEditing } from 'next-sanity'
|
|
79
|
-
import { SanityLive } from '@/lib/integrations/sanity/live'
|
|
80
|
-
import { isSanityConfigured } from '@/lib/integrations/check-integration'
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**Injected variables (before return):**
|
|
84
|
-
```tsx
|
|
85
|
-
const isDraftMode = (await draftMode()).isEnabled
|
|
86
|
-
const sanityConfigured = isSanityConfigured()
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Injected components (after {children}):**
|
|
90
|
-
```tsx
|
|
91
|
-
{sanityConfigured && isDraftMode && (
|
|
92
|
-
<Suspense fallback={null}>
|
|
93
|
-
<VisualEditing />
|
|
94
|
-
<SanityLive />
|
|
95
|
-
</Suspense>
|
|
96
|
-
)}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Sitemap Merger (`app/sitemap.ts`)
|
|
100
|
-
|
|
101
|
-
**Injected imports:**
|
|
102
|
-
```ts
|
|
103
|
-
import { isSanityConfigured } from '@/lib/integrations/check-integration'
|
|
104
|
-
import { client } from '@/lib/integrations/sanity/client'
|
|
105
|
-
import { ALL_PAGES_SLUGS_QUERY, ALL_ARTICLES_SLUGS_QUERY } from '@/lib/integrations/sanity/queries'
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Injected fetch logic (before return):**
|
|
109
|
-
```ts
|
|
110
|
-
let sanityPages: MetadataRoute.Sitemap = []
|
|
111
|
-
|
|
112
|
-
if (isSanityConfigured() && client) {
|
|
113
|
-
const [pages, articles] = await Promise.all([
|
|
114
|
-
client.fetch(ALL_PAGES_SLUGS_QUERY),
|
|
115
|
-
client.fetch(ALL_ARTICLES_SLUGS_QUERY),
|
|
116
|
-
])
|
|
117
|
-
|
|
118
|
-
sanityPages = [
|
|
119
|
-
...pages.map((page) => ({
|
|
120
|
-
url: `${baseUrl}/${page.slug}`,
|
|
121
|
-
lastModified: new Date(page._updatedAt),
|
|
122
|
-
})),
|
|
123
|
-
...articles.map((article) => ({
|
|
124
|
-
url: `${baseUrl}/blog/${article.slug}`,
|
|
125
|
-
lastModified: new Date(article._updatedAt),
|
|
126
|
-
})),
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Modified return:**
|
|
132
|
-
```ts
|
|
133
|
-
return [
|
|
134
|
-
...existingEntries,
|
|
135
|
-
...sanityPages,
|
|
136
|
-
]
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Check-Integration Merger
|
|
140
|
-
|
|
141
|
-
**Appended function:**
|
|
142
|
-
```ts
|
|
143
|
-
export function isSanityConfigured(): boolean {
|
|
144
|
-
return Boolean(
|
|
145
|
-
process.env.NEXT_PUBLIC_SANITY_PROJECT_ID &&
|
|
146
|
-
process.env.NEXT_PUBLIC_SANITY_DATASET
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Error Handling
|
|
152
|
-
|
|
153
|
-
| Scenario | Handling |
|
|
154
|
-
|----------|----------|
|
|
155
|
-
| Template file doesn't exist | Copy from integration instead |
|
|
156
|
-
| Integration file doesn't exist | Skip merge, continue |
|
|
157
|
-
| `{children}` not found in layout | Fallback: append to end of body |
|
|
158
|
-
| No `return` in sitemap | Create new sitemap structure |
|
|
159
|
-
| `isSanityConfigured` already exists | Skip adding function |
|
|
160
|
-
| Template uses different layout function name | Search for default export function |
|
|
161
|
-
|
|
162
|
-
## Dependencies
|
|
163
|
-
|
|
164
|
-
Add to CLI's `package.json`:
|
|
165
|
-
```json
|
|
166
|
-
{
|
|
167
|
-
"dependencies": {
|
|
168
|
-
"ts-morph": "^24.0.0"
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## User Feedback
|
|
174
|
-
|
|
175
|
-
After merging, display:
|
|
176
|
-
```
|
|
177
|
-
✓ Sanity integration added:
|
|
178
|
-
✓ Merged: app/layout.tsx
|
|
179
|
-
✓ Merged: app/sitemap.ts
|
|
180
|
-
✓ Merged: lib/integrations/check-integration.ts
|
|
181
|
-
✓ Added: lib/integrations/sanity/ (14 files)
|
|
182
|
-
✓ Added: components/ui/sanity-image/
|
|
183
|
-
✓ Added: app/api/draft-mode/
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Implementation Tasks
|
|
187
|
-
|
|
188
|
-
1. Create `src/mergers/` directory structure
|
|
189
|
-
2. Implement `config.js` with file classifications
|
|
190
|
-
3. Implement `layout-merger.js`
|
|
191
|
-
4. Implement `sitemap-merger.js`
|
|
192
|
-
5. Implement `check-integration-merger.js`
|
|
193
|
-
6. Implement `index.js` orchestrator with error handling
|
|
194
|
-
7. Update `src/commands/create.js` to use new merge system
|
|
195
|
-
8. Add `ts-morph` dependency
|
|
196
|
-
9. Test with all 4 templates (default, webgl, webgpu, experiment)
|