uniweb 0.7.1 → 0.7.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.
Files changed (59) hide show
  1. package/README.md +64 -17
  2. package/package.json +6 -5
  3. package/src/commands/add.js +571 -0
  4. package/src/commands/build.js +49 -6
  5. package/src/commands/doctor.js +181 -2
  6. package/src/index.js +281 -131
  7. package/src/templates/index.js +0 -94
  8. package/src/templates/processor.js +10 -87
  9. package/src/templates/resolver.js +3 -3
  10. package/src/templates/validator.js +59 -17
  11. package/src/utils/config.js +229 -0
  12. package/src/utils/scaffold.js +196 -0
  13. package/templates/{single/foundation → foundation}/package.json.hbs +2 -2
  14. package/templates/foundation/src/foundation.js.hbs +7 -0
  15. package/templates/foundation/src/sections/.gitkeep +0 -0
  16. package/templates/{multi/sites/main → site}/package.json.hbs +2 -2
  17. package/templates/site/site.yml.hbs +10 -0
  18. package/templates/site/theme.yml +1 -0
  19. package/templates/{_shared → workspace}/package.json.hbs +3 -9
  20. package/templates/workspace/pnpm-workspace.yaml.hbs +4 -0
  21. package/templates/_shared/pnpm-workspace.yaml +0 -5
  22. package/templates/multi/README.md.hbs +0 -85
  23. package/templates/multi/foundations/default/package.json.hbs +0 -38
  24. package/templates/multi/foundations/default/src/foundation.js +0 -41
  25. package/templates/multi/package.json.hbs +0 -26
  26. package/templates/multi/sites/main/pages/home/1-welcome.md.hbs +0 -14
  27. package/templates/multi/sites/main/site.yml.hbs +0 -12
  28. package/templates/multi/sites/main/vite.config.js +0 -7
  29. package/templates/multi/template/.vscode/settings.json +0 -6
  30. package/templates/multi/template.json +0 -5
  31. package/templates/single/foundation/src/sections/Section/index.jsx +0 -121
  32. package/templates/single/foundation/src/sections/Section/meta.js +0 -61
  33. package/templates/single/foundation/src/styles.css +0 -5
  34. package/templates/single/foundation/vite.config.js +0 -3
  35. package/templates/single/site/index.html.hbs +0 -13
  36. package/templates/single/site/main.js +0 -7
  37. package/templates/single/site/package.json.hbs +0 -27
  38. package/templates/single/site/pages/about/1-about.md.hbs +0 -13
  39. package/templates/single/site/pages/about/page.yml +0 -2
  40. package/templates/single/site/pages/home/page.yml +0 -2
  41. package/templates/single/site/public/favicon.svg +0 -7
  42. package/templates/single/site/site.yml.hbs +0 -10
  43. package/templates/single/template.json +0 -10
  44. /package/{templates/single → starter}/foundation/src/foundation.js +0 -0
  45. /package/{templates/multi/foundations/default → starter/foundation}/src/sections/Section/index.jsx +0 -0
  46. /package/{templates/multi/foundations/default → starter/foundation}/src/sections/Section/meta.js +0 -0
  47. /package/{templates/multi/sites/main → starter/site}/pages/about/1-about.md.hbs +0 -0
  48. /package/{templates/multi/sites/main → starter/site}/pages/about/page.yml +0 -0
  49. /package/{templates/single → starter}/site/pages/home/1-welcome.md.hbs +0 -0
  50. /package/{templates/multi/sites/main → starter/site}/pages/home/page.yml +0 -0
  51. /package/templates/{multi/foundations/default → foundation}/src/styles.css +0 -0
  52. /package/templates/{multi/foundations/default → foundation}/vite.config.js +0 -0
  53. /package/templates/{multi/sites/main → site}/index.html.hbs +0 -0
  54. /package/templates/{multi/sites/main → site}/main.js +0 -0
  55. /package/templates/{multi/sites/main → site}/public/favicon.svg +0 -0
  56. /package/templates/{single/site → site}/vite.config.js +0 -0
  57. /package/templates/{_shared → workspace}/AGENTS.md.hbs +0 -0
  58. /package/templates/{single → workspace}/README.md.hbs +0 -0
  59. /package/templates/{single/template/.vscode → workspace/_vscode}/settings.json +0 -0
package/README.md CHANGED
@@ -43,20 +43,32 @@ pnpm create uniweb my-site --template academic
43
43
  # Documentation site
44
44
  pnpm create uniweb my-site --template docs
45
45
 
46
- # Minimal starter (build from scratch)
46
+ # Online store
47
+ pnpm create uniweb my-site --template store
48
+
49
+ # Dynamic content (data sources, API-driven pages)
50
+ pnpm create uniweb my-site --template dynamic
51
+
52
+ # Extensions demo (primary foundation + effects extension)
53
+ pnpm create uniweb my-site --template extensions
54
+
55
+ # Default starter (foundation + site + sample content)
47
56
  pnpm create uniweb my-site
57
+
58
+ # Blank workspace (grow with `add`)
59
+ pnpm create uniweb my-site --template blank
48
60
  ```
49
61
 
50
62
  **See them live:** [View all template demos](https://uniweb.github.io/templates/)
51
63
 
52
64
  ## What You Get
53
65
 
54
- Every project is a workspace with two packages:
66
+ Every project starts as a workspace with two packages:
55
67
 
56
68
  - **`site/`** — Content, pages, entry point
57
69
  - **`foundation/`** — React components
58
70
 
59
- Content authors work in markdown. Component authors work in React. Neither can break the other's work.
71
+ Content authors work in markdown. Component authors work in React. Neither can break the other's work. As your project grows, use `uniweb add` to add more foundations, sites, and extensions.
60
72
 
61
73
  ```
62
74
  my-project/
@@ -218,7 +230,40 @@ You can delete the `foundation/` folder entirely and point your site at a publis
218
230
 
219
231
  _Site-first_ — You're building a website. The foundation is your component library, co-developed with the site. This is the common case.
220
232
 
221
- _Foundation-first_ — You're building a component system. The site is a test harness with sample content. The real sites live elsewhere—other repositories, other teams, or managed on [uniweb.app](https://uniweb.app). The `multi` template supports this workflow with multiple test sites exercising a shared foundation.
233
+ _Foundation-first_ — You're building a component system. The site is a test harness with sample content. The real sites live elsewhere—other repositories, other teams, or managed on [uniweb.app](https://uniweb.app). Use `uniweb add site` to add multiple test sites exercising a shared foundation.
234
+
235
+ ## Growing Your Project
236
+
237
+ Start simple. Add what you need, when you need it:
238
+
239
+ ```bash
240
+ cd my-site
241
+
242
+ # Add a second foundation
243
+ uniweb add foundation blog
244
+
245
+ # Add a site wired to the blog foundation
246
+ uniweb add site blog --foundation blog
247
+
248
+ # Add an extension (auto-wired to the only site)
249
+ uniweb add extension effects
250
+
251
+ # Scaffold + apply content from an official template
252
+ uniweb add foundation marketing --from marketing
253
+ uniweb add site main --from marketing --foundation marketing
254
+ ```
255
+
256
+ The workspace grows organically. `add` handles placement, wires dependencies, updates workspace globs, and generates root scripts. Use `--path` to override default placement, or `--project` for co-located layouts (e.g., `marketing/foundation/` + `marketing/site/`).
257
+
258
+ **Or start blank and build up:**
259
+
260
+ ```bash
261
+ pnpm create uniweb acme --template blank
262
+ cd acme
263
+ uniweb add foundation
264
+ uniweb add site
265
+ pnpm install && pnpm dev
266
+ ```
222
267
 
223
268
  ## The Bigger Picture
224
269
 
@@ -254,7 +299,7 @@ Full documentation is available at **[github.com/uniweb/docs](https://github.com
254
299
  | Content Structure | [How markdown becomes component props](https://github.com/uniweb/docs/blob/main/reference/content-structure.md) |
255
300
  | Component Metadata | [The meta.js schema](https://github.com/uniweb/docs/blob/main/reference/component-metadata.md) |
256
301
  | Site Configuration | [site.yml reference](https://github.com/uniweb/docs/blob/main/reference/site-configuration.md) |
257
- | CLI Commands | [create, build, docs, i18n](https://github.com/uniweb/docs/blob/main/reference/cli-commands.md) |
302
+ | CLI Commands | [create, add, build, docs, doctor, i18n](https://github.com/uniweb/docs/blob/main/reference/cli-commands.md) |
258
303
  | Templates | [Built-in, official, and external templates](https://github.com/uniweb/docs/blob/main/getting-started/templates.md) |
259
304
  | Deployment | [Vercel, Netlify, Cloudflare, and more](https://github.com/uniweb/docs/blob/main/reference/deployment.md) |
260
305
 
@@ -307,26 +352,28 @@ export default defineFoundationConfig({
307
352
 
308
353
  ### Workspace Configuration
309
354
 
310
- Both templates use the same unified workspace configuration:
355
+ A default project has two packages:
311
356
 
312
357
  ```yaml
313
358
  # pnpm-workspace.yaml
314
359
  packages:
315
- - 'site'
316
- - 'foundation'
317
- - 'sites/*'
318
- - 'foundations/*'
360
+ - foundation
361
+ - site
319
362
  ```
320
363
 
321
- Also set in `package.json` for npm compatibility.
364
+ When you `add` more packages, the CLI adds the appropriate globs automatically:
322
365
 
323
- ```json
324
- {
325
- "workspaces": ["site", "foundation", "sites/*", "foundations/*"]
326
- }
366
+ ```yaml
367
+ # After: uniweb add foundation blog → adds foundations/*
368
+ # After: uniweb add extension effects → adds extensions/*
369
+ packages:
370
+ - foundation
371
+ - site
372
+ - foundations/*
373
+ - extensions/*
327
374
  ```
328
375
 
329
- This means no config changes when evolving from single to multi-site.
376
+ The `package.json` `workspaces` field is kept in sync for npm compatibility.
330
377
 
331
378
  ## FAQ
332
379
 
@@ -362,7 +409,7 @@ Yes — documentation is a natural fit. Content stays in markdown (easy to versi
362
409
 
363
410
  - [`@uniweb/build`](https://github.com/uniweb/build) — Foundation build tooling
364
411
  - [`@uniweb/runtime`](https://github.com/uniweb/runtime) — Foundation loader and orchestrator for sites
365
- - [`@uniweb/templates`](https://github.com/uniweb/templates) — Official templates and template processing
412
+ - [`@uniweb/templates`](https://github.com/uniweb/templates) — Official project templates (content only, CLI provides structure)
366
413
 
367
414
  ## License
368
415
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,8 @@
12
12
  "files": [
13
13
  "src",
14
14
  "templates",
15
- "partials"
15
+ "partials",
16
+ "starter"
16
17
  ],
17
18
  "keywords": [
18
19
  "uniweb",
@@ -40,9 +41,9 @@
40
41
  "js-yaml": "^4.1.0",
41
42
  "prompts": "^2.4.2",
42
43
  "tar": "^7.0.0",
43
- "@uniweb/build": "0.7.1",
44
+ "@uniweb/build": "0.7.2",
44
45
  "@uniweb/core": "0.5.0",
45
- "@uniweb/kit": "0.6.0",
46
- "@uniweb/runtime": "0.6.0"
46
+ "@uniweb/runtime": "0.6.0",
47
+ "@uniweb/kit": "0.6.0"
47
48
  }
48
49
  }