uniweb 0.2.21 → 0.2.23
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/README.md +54 -67
- package/package.json +5 -2
- package/src/versions.js +8 -10
- package/templates/_shared/CLAUDE.md.hbs +1 -1
- package/templates/multi/CLAUDE.md.hbs +1 -1
- package/templates/multi/README.md.hbs +1 -1
- package/templates/multi/sites/main/index.html.hbs +1 -1
- package/templates/single/site/index.html.hbs +1 -1
- package/templates/template/template/site/index.html.hbs +1 -1
- /package/templates/multi/sites/main/{src/main.jsx → main.js} +0 -0
- /package/templates/single/site/{src/main.jsx → main.js} +0 -0
- /package/templates/template/template/site/{src/main.jsx → main.js} +0 -0
package/README.md
CHANGED
|
@@ -29,10 +29,10 @@ my-project/
|
|
|
29
29
|
│ │ └── home/
|
|
30
30
|
│ │ ├── page.yml # Page metadata
|
|
31
31
|
│ │ └── 1-hero.md # Section content
|
|
32
|
-
│ ├── locales/ # i18n (
|
|
33
|
-
│ │
|
|
34
|
-
│
|
|
35
|
-
│
|
|
32
|
+
│ ├── locales/ # i18n (hash-based translations)
|
|
33
|
+
│ │ ├── manifest.json # Auto-extracted strings
|
|
34
|
+
│ │ └── es.json # Spanish translations
|
|
35
|
+
│ ├── main.js # 1-line entry point
|
|
36
36
|
│ ├── vite.config.js # 3-line config
|
|
37
37
|
│ └── public/ # Static assets
|
|
38
38
|
│
|
|
@@ -86,14 +86,19 @@ Components receive validated, localized data. Natural content stays in markdown;
|
|
|
86
86
|
export function Hero({ content, params }) {
|
|
87
87
|
const { title } = content.main.header;
|
|
88
88
|
const { paragraphs, links } = content.main.body;
|
|
89
|
-
const { theme =
|
|
89
|
+
const { theme = "light" } = params;
|
|
90
90
|
|
|
91
91
|
return (
|
|
92
|
-
<section
|
|
92
|
+
<section
|
|
93
|
+
className={`py-20 text-center ${theme === "dark" ? "bg-gray-900 text-white" : ""}`}
|
|
94
|
+
>
|
|
93
95
|
<h1 className="text-4xl font-bold">{title}</h1>
|
|
94
96
|
<p className="text-xl text-gray-600">{paragraphs[0]}</p>
|
|
95
97
|
{links[0] && (
|
|
96
|
-
<a
|
|
98
|
+
<a
|
|
99
|
+
href={links[0].url}
|
|
100
|
+
className="mt-8 px-6 py-3 bg-blue-600 text-white rounded inline-block"
|
|
101
|
+
>
|
|
97
102
|
{links[0].text}
|
|
98
103
|
</a>
|
|
99
104
|
)}
|
|
@@ -102,26 +107,9 @@ export function Hero({ content, params }) {
|
|
|
102
107
|
}
|
|
103
108
|
```
|
|
104
109
|
|
|
105
|
-
Standard React. Standard Tailwind. The `{ content, params }` interface is only for
|
|
110
|
+
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.
|
|
106
111
|
|
|
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.
|
|
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
|
-
```
|
|
112
|
+
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.
|
|
125
113
|
|
|
126
114
|
## The Bigger Picture
|
|
127
115
|
|
|
@@ -146,6 +134,7 @@ npm install -g uniweb
|
|
|
146
134
|
```
|
|
147
135
|
|
|
148
136
|
**Requirements:**
|
|
137
|
+
|
|
149
138
|
- Node.js 20.19 or later
|
|
150
139
|
- pnpm 9+ (recommended) or npm 10+
|
|
151
140
|
|
|
@@ -163,19 +152,19 @@ uniweb create [project-name] [options]
|
|
|
163
152
|
|
|
164
153
|
**Options:**
|
|
165
154
|
|
|
166
|
-
| Option | Description
|
|
167
|
-
| ------------------- |
|
|
168
|
-
| `--template <type>` | Project template (see below)
|
|
155
|
+
| Option | Description |
|
|
156
|
+
| ------------------- | ---------------------------- |
|
|
157
|
+
| `--template <type>` | Project template (see below) |
|
|
169
158
|
|
|
170
159
|
**Template Sources:**
|
|
171
160
|
|
|
172
|
-
| Source
|
|
173
|
-
|
|
|
174
|
-
| Built-in
|
|
175
|
-
| Official
|
|
176
|
-
| npm
|
|
177
|
-
| GitHub
|
|
178
|
-
| GitHub URL | `https://github.com/user/repo` | Full GitHub URLs
|
|
161
|
+
| Source | Example | Description |
|
|
162
|
+
| ---------- | ------------------------------ | ------------------------------- |
|
|
163
|
+
| Built-in | `single`, `multi` | Minimal starter templates |
|
|
164
|
+
| Official | `marketing` | Feature-rich showcase templates |
|
|
165
|
+
| npm | `@org/my-template` | Published npm packages |
|
|
166
|
+
| GitHub | `github:user/repo` | GitHub repositories |
|
|
167
|
+
| GitHub URL | `https://github.com/user/repo` | Full GitHub URLs |
|
|
179
168
|
|
|
180
169
|
**Examples:**
|
|
181
170
|
|
|
@@ -233,11 +222,9 @@ uniweb build --target site
|
|
|
233
222
|
uniweb build --platform vercel
|
|
234
223
|
```
|
|
235
224
|
|
|
236
|
-
##
|
|
237
|
-
|
|
238
|
-
### Built-in Templates
|
|
225
|
+
## Built-in Templates
|
|
239
226
|
|
|
240
|
-
|
|
227
|
+
### Single (Default)
|
|
241
228
|
|
|
242
229
|
A minimal workspace with a site and foundation as sibling packages. This is the recommended starting point.
|
|
243
230
|
|
|
@@ -249,11 +236,10 @@ my-project/
|
|
|
249
236
|
│
|
|
250
237
|
├── site/ # Site package (content + entry)
|
|
251
238
|
│ ├── package.json
|
|
252
|
-
│ ├── vite.config.js # 3-line config
|
|
239
|
+
│ ├── vite.config.js # 3-line config
|
|
253
240
|
│ ├── index.html
|
|
254
241
|
│ ├── site.yml # Site configuration (foundation, title, i18n)
|
|
255
|
-
│ ├──
|
|
256
|
-
│ │ └── main.jsx # 1-line entry: import 'virtual:uniweb-site-entry'
|
|
242
|
+
│ ├── main.js # 1-line entry point
|
|
257
243
|
│ ├── pages/ # Content pages (file-based routing)
|
|
258
244
|
│ │ └── home/
|
|
259
245
|
│ │ ├── page.yml
|
|
@@ -262,7 +248,7 @@ my-project/
|
|
|
262
248
|
│
|
|
263
249
|
└── foundation/ # Foundation package (components)
|
|
264
250
|
├── package.json
|
|
265
|
-
├── vite.config.js # 3-line config
|
|
251
|
+
├── vite.config.js # 3-line config
|
|
266
252
|
└── src/
|
|
267
253
|
├── index.js # Component exports
|
|
268
254
|
├── entry-runtime.js # Runtime entry (imports styles + index)
|
|
@@ -281,7 +267,7 @@ my-project/
|
|
|
281
267
|
- **Zero extraction** — `foundation/` is already a complete, publishable package
|
|
282
268
|
- **Scales naturally** — Rename to `sites/marketing/` and `foundations/marketing/` when needed
|
|
283
269
|
|
|
284
|
-
|
|
270
|
+
### Multi
|
|
285
271
|
|
|
286
272
|
A monorepo for multi-site or multi-foundation development.
|
|
287
273
|
|
|
@@ -296,7 +282,7 @@ my-workspace/
|
|
|
296
282
|
│ │ ├── package.json
|
|
297
283
|
│ │ ├── vite.config.js # 3-line config
|
|
298
284
|
│ │ ├── site.yml
|
|
299
|
-
│ │ ├──
|
|
285
|
+
│ │ ├── main.js # 1-line entry point
|
|
300
286
|
│ │ └── pages/
|
|
301
287
|
│ └── docs/ # Documentation site
|
|
302
288
|
│
|
|
@@ -314,11 +300,11 @@ Use this when you need:
|
|
|
314
300
|
- Multiple foundations for different purposes
|
|
315
301
|
- A testing site for foundation development
|
|
316
302
|
|
|
317
|
-
|
|
303
|
+
## Official Templates
|
|
318
304
|
|
|
319
305
|
Feature-rich templates that demonstrate what's possible with Uniweb. These include real components, sample content, and production-ready structure.
|
|
320
306
|
|
|
321
|
-
|
|
307
|
+
### Marketing
|
|
322
308
|
|
|
323
309
|
A complete marketing site with landing page components:
|
|
324
310
|
|
|
@@ -331,11 +317,12 @@ uniweb create my-site --template marketing
|
|
|
331
317
|
Perfect for product launches, SaaS websites, and business landing pages.
|
|
332
318
|
|
|
333
319
|
**Tailwind v3 variant:**
|
|
320
|
+
|
|
334
321
|
```bash
|
|
335
322
|
uniweb create my-site --template marketing --variant tailwind3
|
|
336
323
|
```
|
|
337
324
|
|
|
338
|
-
|
|
325
|
+
### Academic
|
|
339
326
|
|
|
340
327
|
A professional academic site for researchers, labs, and departments:
|
|
341
328
|
|
|
@@ -347,7 +334,7 @@ uniweb create my-site --template academic
|
|
|
347
334
|
|
|
348
335
|
Perfect for researcher portfolios, lab websites, and academic department sites.
|
|
349
336
|
|
|
350
|
-
|
|
337
|
+
### Docs
|
|
351
338
|
|
|
352
339
|
A documentation site with navigation levels:
|
|
353
340
|
|
|
@@ -359,7 +346,7 @@ uniweb create my-site --template docs
|
|
|
359
346
|
|
|
360
347
|
Perfect for technical documentation, guides, and API references.
|
|
361
348
|
|
|
362
|
-
|
|
349
|
+
## External Templates
|
|
363
350
|
|
|
364
351
|
You can use templates from npm or GitHub:
|
|
365
352
|
|
|
@@ -406,14 +393,14 @@ cd foundation && pnpm add embla-carousel
|
|
|
406
393
|
The `defineSiteConfig()` function handles all Vite configuration for sites:
|
|
407
394
|
|
|
408
395
|
```javascript
|
|
409
|
-
import { defineSiteConfig } from
|
|
396
|
+
import { defineSiteConfig } from "@uniweb/build/site";
|
|
410
397
|
|
|
411
398
|
export default defineSiteConfig({
|
|
412
399
|
// All options are optional
|
|
413
|
-
tailwind: true,
|
|
414
|
-
plugins: [],
|
|
400
|
+
tailwind: true, // Enable Tailwind CSS v4 (default: true)
|
|
401
|
+
plugins: [], // Additional Vite plugins
|
|
415
402
|
// ...any other Vite config options
|
|
416
|
-
})
|
|
403
|
+
});
|
|
417
404
|
```
|
|
418
405
|
|
|
419
406
|
### Foundation Configuration
|
|
@@ -421,28 +408,28 @@ export default defineSiteConfig({
|
|
|
421
408
|
The `defineFoundationConfig()` function handles all Vite configuration for foundations:
|
|
422
409
|
|
|
423
410
|
```javascript
|
|
424
|
-
import { defineFoundationConfig } from
|
|
411
|
+
import { defineFoundationConfig } from "@uniweb/build";
|
|
425
412
|
|
|
426
413
|
export default defineFoundationConfig({
|
|
427
414
|
// All options are optional
|
|
428
|
-
entry:
|
|
429
|
-
fileName:
|
|
430
|
-
externals: [],
|
|
431
|
-
includeDefaultExternals: true,
|
|
432
|
-
tailwind: true,
|
|
433
|
-
sourcemap: true,
|
|
434
|
-
plugins: [],
|
|
435
|
-
build: {},
|
|
415
|
+
entry: "src/entry-runtime.js", // Entry point path
|
|
416
|
+
fileName: "foundation", // Output file name
|
|
417
|
+
externals: [], // Additional packages to externalize
|
|
418
|
+
includeDefaultExternals: true, // Include react, @uniweb/core, etc.
|
|
419
|
+
tailwind: true, // Enable Tailwind CSS v4 Vite plugin
|
|
420
|
+
sourcemap: true, // Generate sourcemaps
|
|
421
|
+
plugins: [], // Additional Vite plugins
|
|
422
|
+
build: {}, // Additional Vite build options
|
|
436
423
|
// ...any other Vite config options
|
|
437
|
-
})
|
|
424
|
+
});
|
|
438
425
|
```
|
|
439
426
|
|
|
440
427
|
For Tailwind CSS v3 projects, set `tailwind: false` and use PostCSS:
|
|
441
428
|
|
|
442
429
|
```javascript
|
|
443
430
|
export default defineFoundationConfig({
|
|
444
|
-
tailwind: false
|
|
445
|
-
})
|
|
431
|
+
tailwind: false, // Uses PostCSS instead of Vite plugin
|
|
432
|
+
});
|
|
446
433
|
```
|
|
447
434
|
|
|
448
435
|
## Foundation Build Process
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"js-yaml": "^4.1.0",
|
|
37
37
|
"prompts": "^2.4.2",
|
|
38
38
|
"tar": "^7.0.0",
|
|
39
|
-
"@uniweb/build": "0.1.9"
|
|
39
|
+
"@uniweb/build": "0.1.9",
|
|
40
|
+
"@uniweb/kit": "0.1.4",
|
|
41
|
+
"@uniweb/core": "0.1.6",
|
|
42
|
+
"@uniweb/runtime": "0.2.3"
|
|
40
43
|
}
|
|
41
44
|
}
|
package/src/versions.js
CHANGED
|
@@ -63,17 +63,15 @@ export function getResolvedVersions() {
|
|
|
63
63
|
const pkg = getCliPackageJson()
|
|
64
64
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies }
|
|
65
65
|
|
|
66
|
+
// All @uniweb/* packages are now direct dependencies of the CLI.
|
|
67
|
+
// When publishing with pnpm, workspace:* gets resolved to actual versions.
|
|
68
|
+
// Fallbacks are only used during local development.
|
|
66
69
|
resolvedVersions = {
|
|
67
|
-
|
|
68
|
-
'@uniweb/
|
|
69
|
-
'@uniweb/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'@uniweb/runtime': '^0.1.0',
|
|
73
|
-
'@uniweb/core': '^0.1.0',
|
|
74
|
-
|
|
75
|
-
// Foundation utility library (used by official templates)
|
|
76
|
-
'@uniweb/kit': '^0.1.0',
|
|
70
|
+
'@uniweb/build': resolveVersionSpec(deps['@uniweb/build'], '^0.1.0'),
|
|
71
|
+
'@uniweb/core': resolveVersionSpec(deps['@uniweb/core'], '^0.1.0'),
|
|
72
|
+
'@uniweb/kit': resolveVersionSpec(deps['@uniweb/kit'], '^0.1.0'),
|
|
73
|
+
'@uniweb/runtime': resolveVersionSpec(deps['@uniweb/runtime'], '^0.1.0'),
|
|
74
|
+
'@uniweb/templates': resolveVersionSpec(deps['@uniweb/templates'], '^0.1.0'),
|
|
77
75
|
|
|
78
76
|
// CLI itself (use current version)
|
|
79
77
|
'uniweb': `^${pkg.version}`,
|
|
@@ -34,7 +34,7 @@ cd site && pnpm build
|
|
|
34
34
|
|
|
35
35
|
**Site:**
|
|
36
36
|
- `site/vite.config.js` - 3-line config using `defineSiteConfig()` from `@uniweb/build/site`
|
|
37
|
-
- `site/
|
|
37
|
+
- `site/main.js` - 1-line entry: `import 'virtual:uniweb-site-entry'`
|
|
38
38
|
- `site/site.yml` - Site configuration (foundation path, title, i18n)
|
|
39
39
|
- `site/pages/` - Content pages (file-based routing)
|
|
40
40
|
|
|
@@ -73,7 +73,7 @@ pnpm build:all
|
|
|
73
73
|
|
|
74
74
|
**Sites:**
|
|
75
75
|
- `sites/*/vite.config.js` - 3-line config using `defineSiteConfig()` from `@uniweb/build/site`
|
|
76
|
-
- `sites/*/
|
|
76
|
+
- `sites/*/main.js` - 1-line entry: `import 'virtual:uniweb-site-entry'`
|
|
77
77
|
- `sites/*/site.yml` - Site configuration (foundation reference, title, i18n)
|
|
78
78
|
- `sites/*/pages/` - Content pages (file-based routing)
|
|
79
79
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|