uniweb 0.7.7 → 0.7.9
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 +10 -9
- package/package.json +3 -3
- package/src/commands/add.js +15 -15
- package/src/utils/config.js +6 -5
package/README.md
CHANGED
|
@@ -10,8 +10,6 @@ Create well-structured Vite + React projects with file-based routing, localizati
|
|
|
10
10
|
npm create uniweb
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
> **pnpm ready** — `pnpm create uniweb` works out of the box. Projects include both `pnpm-workspace.yaml` and npm workspaces.
|
|
14
|
-
|
|
15
13
|
The interactive prompt asks for a project name and template. Pick one, then:
|
|
16
14
|
|
|
17
15
|
```bash
|
|
@@ -22,6 +20,8 @@ npm run dev
|
|
|
22
20
|
|
|
23
21
|
Edit files in `site/pages/` and `foundation/src/sections/` to see changes instantly.
|
|
24
22
|
|
|
23
|
+
> **pnpm ready** — `pnpm create uniweb` works out of the box. Projects include both `pnpm-workspace.yaml` and npm workspaces.
|
|
24
|
+
|
|
25
25
|
### Templates
|
|
26
26
|
|
|
27
27
|
| Template | Description |
|
|
@@ -38,10 +38,10 @@ Edit files in `site/pages/` and `foundation/src/sections/` to see changes instan
|
|
|
38
38
|
|
|
39
39
|
**See them live:** [View all template demos](https://uniweb.github.io/templates/)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Or skip the interactive prompt:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
|
|
44
|
+
pnpm create uniweb my-site --template docs
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Development Commands
|
|
@@ -253,13 +253,13 @@ The workspace grows organically. `add` handles placement, wires dependencies, up
|
|
|
253
253
|
**Or start blank and build up:**
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
|
-
|
|
256
|
+
pnpm create uniweb acme --template blank
|
|
257
257
|
cd acme
|
|
258
|
-
|
|
258
|
+
pnpm install
|
|
259
259
|
npx uniweb add foundation
|
|
260
260
|
npx uniweb add site
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
pnpm install
|
|
262
|
+
pnpm dev
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
## The Bigger Picture
|
|
@@ -358,8 +358,9 @@ packages:
|
|
|
358
358
|
- site
|
|
359
359
|
```
|
|
360
360
|
|
|
361
|
+
In `package.json` (for npm compatibility):
|
|
362
|
+
|
|
361
363
|
```json
|
|
362
|
-
// package.json (for npm compatibility)
|
|
363
364
|
{
|
|
364
365
|
"workspaces": ["foundation", "site"]
|
|
365
366
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"tar": "^7.0.0",
|
|
44
44
|
"@uniweb/kit": "0.6.1",
|
|
45
45
|
"@uniweb/build": "0.7.5",
|
|
46
|
-
"@uniweb/
|
|
47
|
-
"@uniweb/
|
|
46
|
+
"@uniweb/core": "0.5.1",
|
|
47
|
+
"@uniweb/runtime": "0.6.1"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/commands/add.js
CHANGED
|
@@ -178,7 +178,11 @@ async function addFoundation(rootDir, projectName, opts, pm = 'pnpm') {
|
|
|
178
178
|
process.exit(0)
|
|
179
179
|
},
|
|
180
180
|
})
|
|
181
|
-
name
|
|
181
|
+
// Only set name if user chose something other than the default —
|
|
182
|
+
// null name tells resolveFoundationTarget to use default placement (./foundation/)
|
|
183
|
+
if (!hasDefault || response.name !== 'foundation') {
|
|
184
|
+
name = response.name
|
|
185
|
+
}
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
const target = await resolveFoundationTarget(rootDir, name, opts)
|
|
@@ -242,7 +246,11 @@ async function addSite(rootDir, projectName, opts, pm = 'pnpm') {
|
|
|
242
246
|
process.exit(0)
|
|
243
247
|
},
|
|
244
248
|
})
|
|
245
|
-
name
|
|
249
|
+
// Only set name if user chose something other than the default —
|
|
250
|
+
// null name tells resolveSiteTarget to use default placement (./site/)
|
|
251
|
+
if (!hasDefault || response.name !== 'site') {
|
|
252
|
+
name = response.name
|
|
253
|
+
}
|
|
246
254
|
}
|
|
247
255
|
|
|
248
256
|
const target = await resolveSiteTarget(rootDir, name, opts)
|
|
@@ -308,6 +316,11 @@ async function addSite(rootDir, projectName, opts, pm = 'pnpm') {
|
|
|
308
316
|
}
|
|
309
317
|
log('')
|
|
310
318
|
log(`Next: ${colors.cyan}${installCmd(pm)} && ${filterCmd(pm, siteName, 'dev')}${colors.reset}`)
|
|
319
|
+
if (!opts.from) {
|
|
320
|
+
log('')
|
|
321
|
+
log(`${colors.dim}To add your first page, create ${target}/pages/home/page.yml and a .md file.${colors.reset}`)
|
|
322
|
+
log(`${colors.dim}Or use --from to start with template content: uniweb add site --from starter${colors.reset}`)
|
|
323
|
+
}
|
|
311
324
|
}
|
|
312
325
|
|
|
313
326
|
/**
|
|
@@ -467,19 +480,6 @@ async function resolveFoundation(rootDir, foundationFlag) {
|
|
|
467
480
|
}
|
|
468
481
|
|
|
469
482
|
if (foundations.length === 0) {
|
|
470
|
-
const response = await prompts({
|
|
471
|
-
type: 'select',
|
|
472
|
-
name: 'choice',
|
|
473
|
-
message: 'No foundations found. Proceed without one?',
|
|
474
|
-
choices: [
|
|
475
|
-
{ title: 'None', value: 'none', description: 'Proceed without a foundation' },
|
|
476
|
-
],
|
|
477
|
-
}, {
|
|
478
|
-
onCancel: () => {
|
|
479
|
-
log('\nCancelled.')
|
|
480
|
-
process.exit(0)
|
|
481
|
-
},
|
|
482
|
-
})
|
|
483
483
|
return null
|
|
484
484
|
}
|
|
485
485
|
|
package/src/utils/config.js
CHANGED
|
@@ -60,11 +60,12 @@ export async function addWorkspaceGlob(rootDir, glob) {
|
|
|
60
60
|
|
|
61
61
|
// Sync workspaces array in package.json (for npm compatibility)
|
|
62
62
|
const pkg = await readRootPackageJson(rootDir)
|
|
63
|
-
if (pkg.workspaces) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
if (!pkg.workspaces) {
|
|
64
|
+
pkg.workspaces = []
|
|
65
|
+
}
|
|
66
|
+
if (!pkg.workspaces.includes(glob)) {
|
|
67
|
+
pkg.workspaces.push(glob)
|
|
68
|
+
await writeRootPackageJson(rootDir, pkg)
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|