uniweb 0.7.1 → 0.7.2

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 +4 -3
  3. package/src/commands/add.js +563 -0
  4. package/src/commands/build.js +49 -6
  5. package/src/commands/doctor.js +181 -2
  6. package/src/index.js +273 -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 +175 -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
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "main",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "private": true,
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@uniweb/runtime": "{{version "@uniweb/runtime"}}",
14
- "default": "file:../../foundations/default"
14
+ "{{foundationName}}": "{{foundationPath}}"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@tailwindcss/vite": "^4.0.0",
@@ -0,0 +1,10 @@
1
+ name: {{projectName}}
2
+
3
+ {{#if foundationRef}}
4
+ foundation: {{foundationRef}}
5
+
6
+ {{/if}}
7
+ index: home
8
+
9
+ build:
10
+ prerender: true
@@ -0,0 +1 @@
1
+ primary: '#3b82f6'
@@ -4,20 +4,14 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "pnpm --filter site dev",
8
- "build": "pnpm --filter foundation build && pnpm --filter site build",
9
- "preview": "pnpm --filter site preview"
7
+ {{#each scripts}}
8
+ "{{@key}}": "{{this}}"{{#unless @last}},{{/unless}}
9
+ {{/each}}
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^22.0.0",
13
13
  "uniweb": "{{version "uniweb"}}"
14
14
  },
15
- "workspaces": [
16
- "site",
17
- "foundation",
18
- "sites/*",
19
- "foundations/*"
20
- ],
21
15
  "pnpm": {
22
16
  "onlyBuiltDependencies": ["esbuild", "sharp"]
23
17
  }
@@ -0,0 +1,4 @@
1
+ packages:
2
+ {{#each workspaceGlobs}}
3
+ - "{{this}}"
4
+ {{/each}}
@@ -1,5 +0,0 @@
1
- packages:
2
- - foundation
3
- - site
4
- - foundations/*
5
- - sites/*
@@ -1,85 +0,0 @@
1
- # {{projectName}}
2
-
3
- A multi-site workspace built with [Uniweb](https://github.com/uniweb/cli) — a component web platform that separates content from code.
4
-
5
- {{> quick-start}}
6
-
7
- ## Project Structure
8
-
9
- ```
10
- {{projectName}}/
11
- ├── foundations/ # Shared component libraries
12
- │ └── default/ # Default foundation
13
- │ ├── src/
14
- │ │ ├── components/
15
- │ │ └── styles.css
16
- │ └── vite.config.js
17
-
18
- ├── sites/ # Content sites
19
- │ └── main/ # Main site
20
- │ ├── pages/
21
- │ ├── site.yml
22
- │ ├── main.js
23
- │ └── vite.config.js
24
-
25
- ├── AGENTS.md # AI assistant instructions
26
- └── README.md # This file
27
- ```
28
-
29
- {{> components-docs}}
30
-
31
- ## Commands
32
-
33
- ```bash
34
- pnpm dev # Start main site
35
- pnpm dev:all # Start all sites in parallel
36
- pnpm build # Build main site
37
- pnpm build:all # Build all sites
38
- ```
39
-
40
- ## Adding a New Site
41
-
42
- 1. Copy an existing site:
43
- ```bash
44
- cp -r sites/main sites/newsite
45
- ```
46
-
47
- 2. Update `sites/newsite/package.json` with a unique name
48
-
49
- 3. Update `sites/newsite/site.yml` with site configuration
50
-
51
- 4. Run `pnpm install` to link the new site
52
-
53
- ## Adding a New Foundation
54
-
55
- 1. Copy an existing foundation:
56
- ```bash
57
- cp -r foundations/default foundations/newfoundation
58
- ```
59
-
60
- 2. Update the package.json with a unique name
61
-
62
- 3. In your site's `site.yml`, reference the foundation:
63
- ```yaml
64
- foundation: newfoundation
65
- ```
66
-
67
- 4. In your site's `package.json`, add the dependency:
68
- ```json
69
- "dependencies": {
70
- "newfoundation": "file:../../foundations/newfoundation"
71
- }
72
- ```
73
-
74
- ## Sharing Foundations
75
-
76
- Multiple sites can use the same foundation. Each site references the foundation in its `site.yml` and `package.json`.
77
-
78
- This allows:
79
- - Consistent components across sites
80
- - Single source of truth for design
81
- - Foundation updates propagate to all sites
82
-
83
- {{> ai-assistance}}
84
-
85
- {{> learn-more}}
@@ -1,38 +0,0 @@
1
- {
2
- "name": "default",
3
- "version": "0.1.0",
4
- "description": "{{projectName}} default foundation - Uniweb component library",
5
- "type": "module",
6
- "main": "./src/_entry.generated.js",
7
- "exports": {
8
- ".": "./src/_entry.generated.js",
9
- "./styles": "./src/styles.css",
10
- "./dist": "./dist/foundation.js",
11
- "./dist/styles": "./dist/assets/style.css"
12
- },
13
- "files": ["dist", "src"],
14
- "scripts": {
15
- "dev": "vite",
16
- "build": "uniweb build",
17
- "build:vite": "vite build",
18
- "preview": "vite preview"
19
- },
20
- "peerDependencies": {
21
- "react": "^18.0.0 || ^19.0.0",
22
- "react-dom": "^18.0.0 || ^19.0.0"
23
- },
24
- "dependencies": {
25
- "@uniweb/core": "{{version "@uniweb/core"}}",
26
- "@uniweb/kit": "{{version "@uniweb/kit"}}"
27
- },
28
- "devDependencies": {
29
- "@tailwindcss/vite": "^4.0.0",
30
- "@uniweb/build": "{{version "@uniweb/build"}}",
31
- "@vitejs/plugin-react": "^5.0.0",
32
- "react": "^18.2.0",
33
- "react-dom": "^18.2.0",
34
- "tailwindcss": "^4.0.0",
35
- "vite": "^7.0.0",
36
- "vite-plugin-svgr": "^4.2.0"
37
- }
38
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Default Foundation Configuration
3
- *
4
- * This file defines foundation-level configuration:
5
- * - vars: CSS custom properties that sites can override in theme.yml
6
- * - Layout: Custom page layout component (optional)
7
- * - props: Foundation-wide props accessible via website.foundationProps
8
- *
9
- * Identity (name, version, description) comes from package.json.
10
- */
11
-
12
- // Create a layout at src/layouts/MyLayout/index.jsx
13
-
14
- /**
15
- * CSS custom properties that sites can override in theme.yml
16
- */
17
- export const vars = {
18
- 'header-height': {
19
- default: '4rem',
20
- description: 'Fixed header height',
21
- },
22
- 'max-content-width': {
23
- default: '80rem',
24
- description: 'Maximum content width (1280px)',
25
- },
26
- 'section-padding-y': {
27
- default: '5rem',
28
- description: 'Vertical padding for sections',
29
- },
30
- }
31
-
32
- /**
33
- * Runtime exports (Layout and props)
34
- */
35
- export default {
36
- // Optional: Create custom layouts in src/layouts/
37
- // Then set defaultLayout: 'MyLayout' below
38
-
39
- // Foundation-wide props (accessible via website.foundationProps):
40
- props: {},
41
- }
@@ -1,26 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "pnpm --filter main dev",
8
- "dev:all": "pnpm -r dev",
9
- "build": "pnpm --filter default build && pnpm --filter main build",
10
- "build:all": "pnpm -r build",
11
- "preview": "pnpm --filter main preview"
12
- },
13
- "devDependencies": {
14
- "@types/node": "^22.0.0",
15
- "uniweb": "{{version "uniweb"}}"
16
- },
17
- "workspaces": [
18
- "site",
19
- "foundation",
20
- "sites/*",
21
- "foundations/*"
22
- ],
23
- "pnpm": {
24
- "onlyBuiltDependencies": ["esbuild", "sharp"]
25
- }
26
- }
@@ -1,14 +0,0 @@
1
- ---
2
- type: Section
3
- theme: light
4
- align: center
5
- ---
6
-
7
- # Welcome to {{projectName}}
8
-
9
- ## Your multi-site workspace is ready
10
-
11
- This workspace supports multiple sites sharing foundations. Add more sites in `sites/` and more foundations in `foundations/`.
12
-
13
- [About](/about)
14
- [Documentation](https://github.com/uniweb)
@@ -1,12 +0,0 @@
1
- name: {{projectName}}
2
- description: Main site for {{projectName}}
3
- foundation: default
4
-
5
- # Homepage - specifies which page folder becomes the root route (/)
6
- index: home
7
-
8
- theme:
9
- primary: '#3b82f6'
10
-
11
- build:
12
- prerender: true
@@ -1,7 +0,0 @@
1
- import { defineSiteConfig } from '@uniweb/build/site'
2
-
3
- export default defineSiteConfig({
4
- server: {
5
- fs: { allow: ['../..'] }
6
- }
7
- })
@@ -1,6 +0,0 @@
1
- {
2
- "yaml.schemas": {
3
- "https://raw.githubusercontent.com/uniweb/cli/main/schemas/site.schema.json": "**/site.yml",
4
- "https://raw.githubusercontent.com/uniweb/cli/main/schemas/page.schema.json": "**/page.yml"
5
- }
6
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "Multi-Site Workspace",
3
- "description": "A Uniweb workspace supporting multiple sites and foundations. Use this when you need to manage several related sites or share foundations across projects.",
4
- "base": "_shared"
5
- }
@@ -1,121 +0,0 @@
1
- import React from 'react'
2
- import { H1, H2, P, Link, cn } from '@uniweb/kit'
3
-
4
- /**
5
- * Section Component
6
- *
7
- * A versatile content section that handles headings, text, and links.
8
- * This is the default component for rendering markdown content.
9
- */
10
- function Section({ content, params }) {
11
- // Content fields: title, pretitle, subtitle, paragraphs, links, imgs, items
12
- const { title, pretitle, subtitle, paragraphs = [], links = [], imgs = [] } = content || {}
13
-
14
- const {
15
- theme = 'light',
16
- align = 'center',
17
- width = 'default',
18
- } = params || {}
19
-
20
- // Theme styles
21
- const themes = {
22
- light: 'bg-white text-gray-900',
23
- dark: 'bg-gray-900 text-white',
24
- primary: 'bg-primary text-white',
25
- }
26
-
27
- // Alignment styles
28
- const alignments = {
29
- left: 'text-left',
30
- center: 'text-center',
31
- right: 'text-right',
32
- }
33
-
34
- // Width styles
35
- const widths = {
36
- narrow: 'max-w-2xl',
37
- default: 'max-w-4xl',
38
- wide: 'max-w-6xl',
39
- full: 'max-w-none',
40
- }
41
-
42
- return (
43
- <section className={cn('py-16 px-6', themes[theme])}>
44
- <div className={cn('mx-auto', widths[width], alignments[align])}>
45
- {/* Pretitle / Eyebrow */}
46
- {pretitle && (
47
- <p className="text-sm font-medium text-primary mb-4 uppercase tracking-wide">
48
- {pretitle}
49
- </p>
50
- )}
51
-
52
- {/* Title */}
53
- {title && (
54
- <H1
55
- text={title}
56
- className="text-3xl sm:text-4xl font-bold mb-4"
57
- />
58
- )}
59
-
60
- {/* Subtitle */}
61
- {subtitle && (
62
- <H2
63
- text={subtitle}
64
- className={cn(
65
- 'text-xl mb-6',
66
- theme === 'light' ? 'text-gray-600' : 'text-gray-300'
67
- )}
68
- />
69
- )}
70
-
71
- {/* Paragraphs */}
72
- {paragraphs.map((para, index) => (
73
- <P
74
- key={index}
75
- text={para}
76
- className={cn(
77
- 'text-lg mb-4 leading-relaxed',
78
- theme === 'light' ? 'text-gray-700' : 'text-gray-300'
79
- )}
80
- />
81
- ))}
82
-
83
- {/* Links */}
84
- {links.length > 0 && (
85
- <div className={cn('mt-8 flex gap-4 flex-wrap', alignments[align] === 'text-center' && 'justify-center')}>
86
- {links.map((link, index) => (
87
- <Link
88
- key={index}
89
- href={link.href}
90
- className={cn(
91
- 'inline-flex items-center px-6 py-3 font-medium rounded-lg transition-colors',
92
- index === 0
93
- ? 'bg-primary-600 text-white hover:bg-primary-700'
94
- : 'border border-current hover:bg-gray-100'
95
- )}
96
- >
97
- {link.label}
98
- </Link>
99
- ))}
100
- </div>
101
- )}
102
-
103
- {/* Images */}
104
- {imgs.length > 0 && (
105
- <div className="mt-8">
106
- {imgs.map((img, index) => (
107
- <img
108
- key={index}
109
- src={img.url || img.src}
110
- alt={img.alt || ''}
111
- className="rounded-lg shadow-lg mx-auto"
112
- />
113
- ))}
114
- </div>
115
- )}
116
- </div>
117
- </section>
118
- )
119
- }
120
-
121
- export default Section
@@ -1,61 +0,0 @@
1
- /**
2
- * Section Component Metadata (v2)
3
- *
4
- * A versatile content section for headings, text, and links.
5
- */
6
- export default {
7
- title: 'Section',
8
- description: 'A versatile content section for headings, text, and links',
9
- category: 'content',
10
- purpose: 'Inform',
11
-
12
- content: {
13
- pretitle: 'Eyebrow text',
14
- title: 'Main heading',
15
- subtitle: 'Secondary heading',
16
- paragraphs: 'Body text',
17
- links: 'Call-to-action buttons',
18
- imgs: 'Section images',
19
- },
20
-
21
- params: {
22
- theme: {
23
- type: 'select',
24
- label: 'Theme',
25
- options: ['light', 'dark', 'primary'],
26
- default: 'light',
27
- },
28
- align: {
29
- type: 'select',
30
- label: 'Alignment',
31
- options: ['left', 'center', 'right'],
32
- default: 'center',
33
- },
34
- width: {
35
- type: 'select',
36
- label: 'Width',
37
- options: [
38
- 'narrow',
39
- 'default',
40
- 'wide',
41
- { value: 'full', label: 'Full Width' },
42
- ],
43
- default: 'default',
44
- },
45
- },
46
-
47
- presets: {
48
- default: {
49
- label: 'Centered',
50
- params: { theme: 'light', align: 'center' },
51
- },
52
- dark: {
53
- label: 'Dark Theme',
54
- params: { theme: 'dark', align: 'center' },
55
- },
56
- left: {
57
- label: 'Left Aligned',
58
- params: { theme: 'light', align: 'left' },
59
- },
60
- },
61
- }
@@ -1,5 +0,0 @@
1
- @import "tailwindcss";
2
- @import "@uniweb/kit/theme-tokens.css";
3
-
4
- @source "./sections/**/*.{js,jsx}";
5
- @source "../node_modules/@uniweb/kit/src/**/*.{js,jsx}";
@@ -1,3 +0,0 @@
1
- import { defineFoundationConfig } from '@uniweb/build'
2
-
3
- export default defineFoundationConfig()
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>{{projectName}}</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/main.js"></script>
12
- </body>
13
- </html>
@@ -1,7 +0,0 @@
1
- import '#foundation/styles'
2
- import { start } from '@uniweb/runtime'
3
-
4
- start({
5
- config: __FOUNDATION_CONFIG__,
6
- foundation: import('#foundation')
7
- })
@@ -1,27 +0,0 @@
1
- {
2
- "name": "site",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "private": true,
6
- "scripts": {
7
- "dev": "vite",
8
- "dev:runtime": "VITE_FOUNDATION_MODE=runtime vite",
9
- "build": "uniweb build",
10
- "preview": "vite preview"
11
- },
12
- "dependencies": {
13
- "@uniweb/runtime": "{{version "@uniweb/runtime"}}",
14
- "foundation": "file:../foundation"
15
- },
16
- "devDependencies": {
17
- "@tailwindcss/vite": "^4.0.0",
18
- "@uniweb/build": "{{version "@uniweb/build"}}",
19
- "@vitejs/plugin-react": "^5.0.0",
20
- "react": "^18.2.0",
21
- "react-dom": "^18.2.0",
22
- "react-router-dom": "^7.0.0",
23
- "tailwindcss": "^4.0.0",
24
- "vite": "^7.0.0",
25
- "vite-plugin-svgr": "^4.2.0"
26
- }
27
- }
@@ -1,13 +0,0 @@
1
- ---
2
- type: Section
3
- theme: dark
4
- align: center
5
- ---
6
-
7
- # About {{projectName}}
8
-
9
- ## A second page to demonstrate routing
10
-
11
- This page uses a dark theme. Click the link below to navigate back to the home page and see the theme change.
12
-
13
- [Back to Home](/)
@@ -1,2 +0,0 @@
1
- title: About
2
- description: About this project
@@ -1,2 +0,0 @@
1
- title: Home
2
- description: Welcome to the site
@@ -1,7 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
- <rect width="32" height="32" rx="6" fill="#1e293b"/>
3
- <!-- < symbol -->
4
- <path d="M12 10 L6 16 L12 22" stroke="#FA8400" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
5
- <!-- > symbol -->
6
- <path d="M20 10 L26 16 L20 22" stroke="#00ADFE" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
7
- </svg>
@@ -1,10 +0,0 @@
1
- name: {{projectName}}
2
-
3
- # Homepage - specifies which page folder becomes the root route (/)
4
- index: home
5
-
6
- theme:
7
- primary: '#3b82f6'
8
-
9
- build:
10
- prerender: true
@@ -1,10 +0,0 @@
1
- {
2
- "name": "Single Project",
3
- "description": "A minimal Uniweb project with one foundation and one site. The canonical starting point for any Uniweb project.",
4
- "base": "_shared",
5
- "structure": {
6
- "root": ["package.json.hbs", "pnpm-workspace.yaml", ".gitignore", "AGENTS.md.hbs"],
7
- "foundation": ["package.json.hbs", "vite.config.js", ".gitignore", "src/"],
8
- "site": ["package.json.hbs", "vite.config.js", "index.html.hbs", "site.yml.hbs", "src/", "pages/"]
9
- }
10
- }
File without changes
File without changes
File without changes
File without changes