uniweb 0.2.30 → 0.2.32
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 +2 -4
- package/package.json +4 -4
- package/templates/_shared/CLAUDE.md.hbs +10 -8
- package/templates/multi/CLAUDE.md.hbs +2 -2
- package/templates/multi/foundations/default/package.json.hbs +2 -2
- package/templates/single/README.md.hbs +1 -1
- package/templates/single/foundation/package.json.hbs +3 -2
- package/templates/single/foundation/scripts/generate-entry.js +15 -0
- package/templates/template/template/foundation/package.json.hbs +2 -2
- package/templates/multi/foundations/default/src/entry-runtime.js +0 -3
- package/templates/single/foundation/src/entry-runtime.js +0 -3
- package/templates/single/foundation/src/index.js +0 -35
- package/templates/template/template/foundation/src/entry-runtime.js +0 -3
- package/templates/template/template/foundation/src/index.js +0 -36
package/README.md
CHANGED
|
@@ -322,10 +322,9 @@ my-project/
|
|
|
322
322
|
├── package.json
|
|
323
323
|
├── vite.config.js # 3-line config
|
|
324
324
|
└── src/
|
|
325
|
-
├── index.js # Component exports
|
|
326
|
-
├── entry-runtime.js # Runtime entry (imports styles + index)
|
|
327
325
|
├── styles.css # Tailwind CSS v4
|
|
328
326
|
├── meta.js # Foundation metadata
|
|
327
|
+
├── runtime.js # (optional) Custom Layout, props
|
|
329
328
|
└── components/
|
|
330
329
|
└── Section/
|
|
331
330
|
├── index.jsx
|
|
@@ -483,8 +482,7 @@ The `defineFoundationConfig()` function handles all Vite configuration for found
|
|
|
483
482
|
import { defineFoundationConfig } from "@uniweb/build";
|
|
484
483
|
|
|
485
484
|
export default defineFoundationConfig({
|
|
486
|
-
// All options are optional
|
|
487
|
-
entry: "src/entry-runtime.js", // Entry point path
|
|
485
|
+
// All options are optional - entry is auto-generated
|
|
488
486
|
fileName: "foundation", // Output file name
|
|
489
487
|
externals: [], // Additional packages to externalize
|
|
490
488
|
includeDefaultExternals: true, // Include react, @uniweb/core, etc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,9 +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.
|
|
40
|
-
"@uniweb/
|
|
41
|
-
"@uniweb/
|
|
39
|
+
"@uniweb/build": "0.1.15",
|
|
40
|
+
"@uniweb/runtime": "0.2.8",
|
|
41
|
+
"@uniweb/core": "0.1.7",
|
|
42
42
|
"@uniweb/kit": "0.1.4"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -40,24 +40,26 @@ cd site && pnpm build
|
|
|
40
40
|
|
|
41
41
|
**Foundation:**
|
|
42
42
|
- `foundation/vite.config.js` - 3-line config using `defineFoundationConfig()` from `@uniweb/build`
|
|
43
|
-
- `foundation/src/entry-runtime.js` - Runtime entry point (imports styles + components)
|
|
44
|
-
- `foundation/src/index.js` - Component exports
|
|
45
43
|
- `foundation/src/styles.css` - Tailwind CSS v4 theme
|
|
46
|
-
- `foundation/src/components/*/meta.js` - Component metadata
|
|
44
|
+
- `foundation/src/components/*/meta.js` - Component metadata (makes component exposed)
|
|
45
|
+
- `foundation/src/runtime.js` - (optional) Custom Layout and foundation props
|
|
46
|
+
- `foundation/src/_entry.generated.js` - Auto-generated at build/dev time
|
|
47
47
|
|
|
48
48
|
## Architecture
|
|
49
49
|
|
|
50
50
|
### Foundation Package (`/foundation`)
|
|
51
51
|
|
|
52
|
-
The **foundation** is a React component library.
|
|
52
|
+
The **foundation** is a React component library. Components with a `meta.js` file are **exposed** (available to content creators via `type:` in frontmatter). Exposed components:
|
|
53
53
|
|
|
54
|
-
1.
|
|
55
|
-
2.
|
|
56
|
-
3.
|
|
54
|
+
1. Receive structured content parsed from markdown
|
|
55
|
+
2. Have configurable parameters (theme, layout, etc.)
|
|
56
|
+
3. Render content according to their design
|
|
57
|
+
|
|
58
|
+
Internal components (no `meta.js`) are regular React components used within exposed components.
|
|
57
59
|
|
|
58
60
|
**Key directories:**
|
|
59
61
|
- `src/components/*/` - Component implementations
|
|
60
|
-
- `src/components/*/meta.js` - Component metadata
|
|
62
|
+
- `src/components/*/meta.js` - Component metadata (makes component exposed)
|
|
61
63
|
- `src/styles.css` - Global Tailwind styles
|
|
62
64
|
|
|
63
65
|
### Site Package (`/site`)
|
|
@@ -79,9 +79,9 @@ pnpm build:all
|
|
|
79
79
|
|
|
80
80
|
**Foundations:**
|
|
81
81
|
- `foundations/*/vite.config.js` - 3-line config using `defineFoundationConfig()` from `@uniweb/build`
|
|
82
|
-
- `foundations/*/src/entry-runtime.js` - Runtime entry point
|
|
83
82
|
- `foundations/*/src/styles.css` - Tailwind CSS v4 theme
|
|
84
|
-
- `foundations/*/src/components/*/meta.js` - Component metadata
|
|
83
|
+
- `foundations/*/src/components/*/meta.js` - Component metadata (makes component exposed)
|
|
84
|
+
- `foundations/*/src/runtime.js` - (optional) Custom Layout and foundation props
|
|
85
85
|
|
|
86
86
|
## Architecture
|
|
87
87
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "default",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./src/
|
|
5
|
+
"main": "./src/_entry.generated.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./src/
|
|
7
|
+
".": "./src/_entry.generated.js",
|
|
8
8
|
"./styles": "./src/styles.css",
|
|
9
9
|
"./dist": "./dist/foundation.js",
|
|
10
10
|
"./dist/styles": "./dist/assets/style.css"
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
"name": "foundation",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./src/
|
|
5
|
+
"main": "./src/_entry.generated.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./src/
|
|
7
|
+
".": "./src/_entry.generated.js",
|
|
8
8
|
"./styles": "./src/styles.css",
|
|
9
9
|
"./dist": "./dist/foundation.js",
|
|
10
10
|
"./dist/styles": "./dist/assets/style.css"
|
|
11
11
|
},
|
|
12
12
|
"files": ["dist", "src"],
|
|
13
13
|
"scripts": {
|
|
14
|
+
"postinstall": "node scripts/generate-entry.js",
|
|
14
15
|
"dev": "vite",
|
|
15
16
|
"build": "uniweb build",
|
|
16
17
|
"build:vite": "vite build",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate Foundation Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This script is called during postinstall to ensure the foundation
|
|
5
|
+
* entry point exists before the site dev server starts.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { generateEntryPoint } from '@uniweb/build'
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
await generateEntryPoint('./src', './src/_entry.generated.js')
|
|
12
|
+
} catch (err) {
|
|
13
|
+
// Silently fail during initial install if dependencies aren't ready
|
|
14
|
+
console.warn('Note: Entry generation skipped (run foundation dev/build to generate)')
|
|
15
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "foundation",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./src/
|
|
5
|
+
"main": "./src/_entry.generated.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./src/
|
|
7
|
+
".": "./src/_entry.generated.js",
|
|
8
8
|
"./styles": "./src/styles.css",
|
|
9
9
|
"./dist": "./dist/foundation.js",
|
|
10
10
|
"./dist/styles": "./dist/assets/style.css"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Foundation Entry Point
|
|
3
|
-
*
|
|
4
|
-
* Export all components from this file.
|
|
5
|
-
* Components are discovered from src/components/{Name}/meta.js during build.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import Section from './components/Section/index.jsx'
|
|
9
|
-
|
|
10
|
-
const components = {
|
|
11
|
-
Section,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function getComponent(name) {
|
|
15
|
-
return components[name]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function listComponents() {
|
|
19
|
-
return Object.keys(components)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getSchema(name) {
|
|
23
|
-
return components[name]?.schema
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function getAllSchemas() {
|
|
27
|
-
const schemas = {}
|
|
28
|
-
for (const [name, component] of Object.entries(components)) {
|
|
29
|
-
if (component.schema) schemas[name] = component.schema
|
|
30
|
-
}
|
|
31
|
-
return schemas
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { Section }
|
|
35
|
-
export default { getComponent, listComponents, getSchema, getAllSchemas, components }
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Foundation Entry Point
|
|
3
|
-
*
|
|
4
|
-
* Export all your template's components here.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import Hero from './components/Hero/index.jsx'
|
|
8
|
-
import Features from './components/Features/index.jsx'
|
|
9
|
-
|
|
10
|
-
const components = {
|
|
11
|
-
Hero,
|
|
12
|
-
Features,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function getComponent(name) {
|
|
16
|
-
return components[name]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function listComponents() {
|
|
20
|
-
return Object.keys(components)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getSchema(name) {
|
|
24
|
-
return components[name]?.schema
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getAllSchemas() {
|
|
28
|
-
const schemas = {}
|
|
29
|
-
for (const [name, component] of Object.entries(components)) {
|
|
30
|
-
if (component.schema) schemas[name] = component.schema
|
|
31
|
-
}
|
|
32
|
-
return schemas
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { Hero, Features }
|
|
36
|
-
export default { getComponent, listComponents, getSchema, getAllSchemas, components }
|