uniweb 0.2.14 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +133 -35
  2. package/package.json +4 -3
  3. package/src/index.js +87 -1022
  4. package/src/templates/processor.js +17 -3
  5. package/src/templates/resolver.js +2 -2
  6. package/templates/_shared/CLAUDE.md.hbs +146 -0
  7. package/templates/_shared/package.json.hbs +23 -0
  8. package/templates/_shared/pnpm-workspace.yaml +5 -0
  9. package/templates/multi/CLAUDE.md.hbs +100 -0
  10. package/templates/multi/README.md.hbs +96 -0
  11. package/templates/multi/foundations/default/package.json.hbs +37 -0
  12. package/templates/multi/foundations/default/src/components/Section/index.jsx +121 -0
  13. package/templates/multi/foundations/default/src/components/Section/meta.js +66 -0
  14. package/templates/multi/foundations/default/src/entry-runtime.js +3 -0
  15. package/templates/multi/foundations/default/src/index.js +32 -0
  16. package/templates/multi/foundations/default/src/meta.js.hbs +6 -0
  17. package/templates/multi/foundations/default/src/styles.css +11 -0
  18. package/templates/multi/foundations/default/vite.config.js +3 -0
  19. package/templates/multi/package.json.hbs +25 -0
  20. package/templates/multi/pnpm-workspace.yaml +5 -0
  21. package/templates/multi/sites/main/index.html.hbs +13 -0
  22. package/templates/multi/sites/main/package.json.hbs +27 -0
  23. package/templates/multi/sites/main/pages/home/1-welcome.md.hbs +14 -0
  24. package/templates/multi/sites/main/pages/home/page.yml +2 -0
  25. package/templates/multi/sites/main/site.yml.hbs +9 -0
  26. package/templates/multi/sites/main/src/main.jsx +1 -0
  27. package/templates/multi/sites/main/vite.config.js +7 -0
  28. package/templates/multi/template.json +4 -0
  29. package/templates/single/README.md.hbs +101 -0
  30. package/templates/single/foundation/package.json.hbs +37 -0
  31. package/templates/single/foundation/src/components/Section/index.jsx +121 -0
  32. package/templates/single/foundation/src/components/Section/meta.js +66 -0
  33. package/templates/single/foundation/src/entry-runtime.js +3 -0
  34. package/templates/single/foundation/src/index.js +35 -0
  35. package/templates/single/foundation/src/meta.js.hbs +6 -0
  36. package/templates/single/foundation/src/styles.css +11 -0
  37. package/templates/single/foundation/vite.config.js +3 -0
  38. package/templates/single/site/index.html.hbs +19 -0
  39. package/templates/single/site/package.json.hbs +27 -0
  40. package/templates/single/site/pages/home/1-welcome.md.hbs +14 -0
  41. package/templates/single/site/pages/home/page.yml +2 -0
  42. package/templates/single/site/site.yml.hbs +7 -0
  43. package/templates/single/site/src/main.jsx +1 -0
  44. package/templates/single/site/vite.config.js +3 -0
  45. package/templates/single/template.json +10 -0
  46. package/templates/template/README.md.hbs +65 -0
  47. package/templates/template/package.json.hbs +33 -0
  48. package/templates/template/template/CLAUDE.md.hbs +70 -0
  49. package/templates/template/template/foundation/package.json.hbs +37 -0
  50. package/templates/template/template/foundation/src/components/Features/index.jsx +75 -0
  51. package/templates/template/template/foundation/src/components/Features/meta.js +41 -0
  52. package/templates/template/template/foundation/src/components/Hero/index.jsx +89 -0
  53. package/templates/template/template/foundation/src/components/Hero/meta.js +47 -0
  54. package/templates/template/template/foundation/src/entry-runtime.js +3 -0
  55. package/templates/template/template/foundation/src/index.js +36 -0
  56. package/templates/template/template/foundation/src/meta.js.hbs +6 -0
  57. package/templates/template/template/foundation/src/styles.css +12 -0
  58. package/templates/template/template/foundation/vite.config.js +3 -0
  59. package/templates/template/template/package.json.hbs +14 -0
  60. package/templates/template/template/pnpm-workspace.yaml +3 -0
  61. package/templates/template/template/site/index.html.hbs +13 -0
  62. package/templates/template/template/site/package.json.hbs +27 -0
  63. package/templates/template/template/site/pages/home/1-hero.md.hbs +16 -0
  64. package/templates/template/template/site/pages/home/2-features.md +21 -0
  65. package/templates/template/template/site/pages/home/page.yml +2 -0
  66. package/templates/template/template/site/site.yml.hbs +8 -0
  67. package/templates/template/template/site/src/main.jsx +1 -0
  68. package/templates/template/template/site/vite.config.js +3 -0
  69. package/templates/template/template/template.json.hbs +7 -0
  70. package/templates/template/template.json +4 -0
package/README.md CHANGED
@@ -31,13 +31,19 @@ my-project/
31
31
  │ │ └── 1-hero.md # Section content
32
32
  │ ├── locales/ # i18n (mirrors pages/)
33
33
  │ │ └── es/
34
+ │ ├── src/
35
+ │ │ └── main.jsx # 1-line entry point
36
+ │ ├── vite.config.js # 3-line config
34
37
  │ └── public/ # Static assets
35
38
 
36
39
  └── foundation/ # Your components
37
- └── src/
38
- └── components/
39
- └── Hero/
40
- └── index.jsx
40
+ ├── src/
41
+ └── components/
42
+ └── Hero/
43
+ │ ├── index.jsx
44
+ │ └── meta.js
45
+ ├── vite.config.js # 3-line config
46
+ └── dist/ # Built output
41
47
  ```
42
48
 
43
49
  **Pages are folders.** Create `pages/about/` with markdown files inside → visit `/about`. That's the whole routing model.
@@ -98,7 +104,24 @@ export function Hero({ content, params }) {
98
104
 
99
105
  Standard React. Standard Tailwind. The `{ content, params }` interface is only for *exposed* components—the ones content creators select in markdown frontmatter. Internal components (the majority of your codebase) use regular React props.
100
106
 
101
- No framework to learn. Foundations are purpose-built component systems designed for a specific domain (marketing, documentation, learning, etc.). Sites are Vite apps that load content from markdown files. The CLI handles the wiring.
107
+ No framework to learn. Foundations are purpose-built component systems designed for a specific domain (marketing, documentation, learning, etc.). Sites are Vite apps that load content from markdown files. Configuration is minimal—both site and foundation use 3-line Vite configs:
108
+
109
+ ```javascript
110
+ // site/vite.config.js
111
+ import { defineSiteConfig } from '@uniweb/build/site'
112
+ export default defineSiteConfig()
113
+
114
+ // foundation/vite.config.js
115
+ import { defineFoundationConfig } from '@uniweb/build'
116
+ export default defineFoundationConfig()
117
+ ```
118
+
119
+ The site entry point is equally minimal:
120
+
121
+ ```javascript
122
+ // site/src/main.jsx
123
+ import 'virtual:uniweb-site-entry'
124
+ ```
102
125
 
103
126
  ## The Bigger Picture
104
127
 
@@ -122,6 +145,12 @@ npx uniweb@latest <command>
122
145
  npm install -g uniweb
123
146
  ```
124
147
 
148
+ **Requirements:**
149
+ - Node.js 20.19 or later
150
+ - pnpm 9+ (recommended) or npm 10+
151
+
152
+ Projects use Vite 7 and Tailwind CSS v4 by default.
153
+
125
154
  ## Commands
126
155
 
127
156
  ### `create`
@@ -214,37 +243,35 @@ A minimal workspace with a site and foundation as sibling packages. This is the
214
243
 
215
244
  ```
216
245
  my-project/
217
- ├── package.json # Workspace root (includes workspaces field for npm)
246
+ ├── package.json # Workspace root (npm + pnpm compatible)
218
247
  ├── pnpm-workspace.yaml # Pre-configured for evolution (see below)
248
+ ├── CLAUDE.md # AI assistant instructions
219
249
 
220
250
  ├── site/ # Site package (content + entry)
221
251
  │ ├── package.json
222
- │ ├── vite.config.js
252
+ │ ├── vite.config.js # 3-line config using defineSiteConfig()
223
253
  │ ├── index.html
224
- │ ├── site.yml
254
+ │ ├── site.yml # Site configuration (foundation, title, i18n)
225
255
  │ ├── src/
226
- │ │ └── main.jsx # Thin entry point
227
- │ ├── pages/ # Content structure
256
+ │ │ └── main.jsx # 1-line entry: import 'virtual:uniweb-site-entry'
257
+ │ ├── pages/ # Content pages (file-based routing)
228
258
  │ │ └── home/
229
259
  │ │ ├── page.yml
230
260
  │ │ └── 1-hero.md
231
- │ ├── locales/ # i18n (mirrors pages/)
232
- │ │ └── es/
233
- │ │ └── home/
234
261
  │ └── public/ # Static assets
235
262
 
236
263
  └── foundation/ # Foundation package (components)
237
264
  ├── package.json
238
- ├── vite.config.js
239
- ├── src/
240
- ├── index.js # Component registry
241
- ├── styles.css # Tailwind
242
- ├── meta.js # Foundation metadata
243
- │ └── components/
244
- └── Hero/
245
- │ ├── index.jsx
246
- │ └── meta.js
247
- └── ...
265
+ ├── vite.config.js # 3-line config using defineFoundationConfig()
266
+ └── src/
267
+ ├── index.js # Component exports
268
+ ├── entry-runtime.js # Runtime entry (imports styles + index)
269
+ ├── styles.css # Tailwind CSS v4
270
+ ├── meta.js # Foundation metadata
271
+ └── components/
272
+ └── Section/
273
+ ├── index.jsx
274
+ └── meta.js
248
275
  ```
249
276
 
250
277
  **Key characteristics:**
@@ -260,23 +287,24 @@ A monorepo for multi-site or multi-foundation development.
260
287
 
261
288
  ```
262
289
  my-workspace/
263
- ├── package.json # Workspace root (includes workspaces field for npm)
290
+ ├── package.json # Workspace root (npm + pnpm compatible)
264
291
  ├── pnpm-workspace.yaml # Same config as single template
292
+ ├── CLAUDE.md # AI assistant instructions
265
293
 
266
294
  ├── sites/
267
295
  │ ├── marketing/ # Main marketing site
268
296
  │ │ ├── package.json
297
+ │ │ ├── vite.config.js # 3-line config
269
298
  │ │ ├── site.yml
270
- │ │ ├── src/
271
- │ │ ├── pages/
272
- │ │ └── ...
299
+ │ │ ├── src/main.jsx # 1-line entry
300
+ │ │ └── pages/
273
301
  │ └── docs/ # Documentation site
274
302
 
275
303
  └── foundations/
276
304
  ├── marketing/ # Marketing foundation
277
305
  │ ├── package.json
278
- │ ├── src/components/
279
- │ └── ...
306
+ │ ├── vite.config.js # 3-line config
307
+ │ └── src/components/
280
308
  └── documentation/ # Documentation foundation
281
309
  ```
282
310
 
@@ -298,15 +326,39 @@ A complete marketing site with landing page components:
298
326
  uniweb create my-site --template marketing
299
327
  ```
300
328
 
301
- **Includes:**
302
- - **Hero** — Gradient/light/dark banner with CTAs
303
- - **Features** — Grid layout with icons
304
- - **Pricing** — Tiered pricing tables
305
- - **Testimonials** — Customer quotes
306
- - **CTA** — Call-to-action sections
329
+ **Includes:** Hero, Features, Pricing, Testimonials, CTA, FAQ, Stats, LogoCloud, Video, Gallery, Team
307
330
 
308
331
  Perfect for product launches, SaaS websites, and business landing pages.
309
332
 
333
+ **Tailwind v3 variant:**
334
+ ```bash
335
+ uniweb create my-site --template marketing --variant tailwind3
336
+ ```
337
+
338
+ #### Academic
339
+
340
+ A professional academic site for researchers, labs, and departments:
341
+
342
+ ```bash
343
+ uniweb create my-site --template academic
344
+ ```
345
+
346
+ **Includes:** ProfileHero, PublicationList, ResearchAreas, TeamGrid, Timeline, ContactCard, Navbar, Footer
347
+
348
+ Perfect for researcher portfolios, lab websites, and academic department sites.
349
+
350
+ #### Docs
351
+
352
+ A documentation site with navigation levels:
353
+
354
+ ```bash
355
+ uniweb create my-site --template docs
356
+ ```
357
+
358
+ **Includes:** Header, LeftPanel, DocSection, CodeBlock, Footer
359
+
360
+ Perfect for technical documentation, guides, and API references.
361
+
310
362
  ### External Templates
311
363
 
312
364
  You can use templates from npm or GitHub:
@@ -347,6 +399,52 @@ cd foundation && pnpm add embla-carousel
347
399
  # No path gymnastics needed
348
400
  ```
349
401
 
402
+ ## Configuration
403
+
404
+ ### Site Configuration
405
+
406
+ The `defineSiteConfig()` function handles all Vite configuration for sites:
407
+
408
+ ```javascript
409
+ import { defineSiteConfig } from '@uniweb/build/site'
410
+
411
+ export default defineSiteConfig({
412
+ // All options are optional
413
+ tailwind: true, // Enable Tailwind CSS v4 (default: true)
414
+ plugins: [], // Additional Vite plugins
415
+ // ...any other Vite config options
416
+ })
417
+ ```
418
+
419
+ ### Foundation Configuration
420
+
421
+ The `defineFoundationConfig()` function handles all Vite configuration for foundations:
422
+
423
+ ```javascript
424
+ import { defineFoundationConfig } from '@uniweb/build'
425
+
426
+ export default defineFoundationConfig({
427
+ // All options are optional
428
+ entry: 'src/entry-runtime.js', // Entry point path
429
+ fileName: 'foundation', // Output file name
430
+ externals: [], // Additional packages to externalize
431
+ includeDefaultExternals: true, // Include react, @uniweb/core, etc.
432
+ tailwind: true, // Enable Tailwind CSS v4 Vite plugin
433
+ sourcemap: true, // Generate sourcemaps
434
+ plugins: [], // Additional Vite plugins
435
+ build: {}, // Additional Vite build options
436
+ // ...any other Vite config options
437
+ })
438
+ ```
439
+
440
+ For Tailwind CSS v3 projects, set `tailwind: false` and use PostCSS:
441
+
442
+ ```javascript
443
+ export default defineFoundationConfig({
444
+ tailwind: false // Uses PostCSS instead of Vite plugin
445
+ })
446
+ ```
447
+
350
448
  ## Foundation Build Process
351
449
 
352
450
  When you run `uniweb build` on a foundation:
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.2.14",
3
+ "version": "0.2.17",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "uniweb": "src/index.js"
8
8
  },
9
9
  "files": [
10
- "src"
10
+ "src",
11
+ "templates"
11
12
  ],
12
13
  "keywords": [
13
14
  "uniweb",
@@ -35,6 +36,6 @@
35
36
  "js-yaml": "^4.1.0",
36
37
  "prompts": "^2.4.2",
37
38
  "tar": "^7.0.0",
38
- "@uniweb/build": "0.1.6"
39
+ "@uniweb/build": "0.1.9"
39
40
  }
40
41
  }