uniweb 0.7.3 → 0.7.5
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 +8 -8
- package/package.json +3 -3
- package/src/index.js +38 -7
- package/src/templates/resolver.js +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ pnpm create uniweb my-site --template dynamic
|
|
|
53
53
|
pnpm create uniweb my-site --template extensions
|
|
54
54
|
|
|
55
55
|
# Default starter (foundation + site + sample content)
|
|
56
|
-
pnpm create uniweb my-site
|
|
56
|
+
pnpm create uniweb my-site --template starter
|
|
57
57
|
|
|
58
58
|
# Blank workspace (grow with `add`)
|
|
59
59
|
pnpm create uniweb my-site --template blank
|
|
@@ -240,17 +240,17 @@ Start simple. Add what you need, when you need it:
|
|
|
240
240
|
cd my-site
|
|
241
241
|
|
|
242
242
|
# Add a second foundation
|
|
243
|
-
uniweb add foundation blog
|
|
243
|
+
npx uniweb add foundation blog
|
|
244
244
|
|
|
245
245
|
# Add a site wired to the blog foundation
|
|
246
|
-
uniweb add site blog --foundation blog
|
|
246
|
+
npx uniweb add site blog --foundation blog
|
|
247
247
|
|
|
248
248
|
# Add an extension (auto-wired to the only site)
|
|
249
|
-
uniweb add extension effects
|
|
249
|
+
npx uniweb add extension effects
|
|
250
250
|
|
|
251
251
|
# Scaffold + apply content from an official template
|
|
252
|
-
uniweb add foundation marketing --from marketing
|
|
253
|
-
uniweb add site main --from marketing --foundation marketing
|
|
252
|
+
npx uniweb add foundation marketing --from marketing
|
|
253
|
+
npx uniweb add site main --from marketing --foundation marketing
|
|
254
254
|
```
|
|
255
255
|
|
|
256
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/`).
|
|
@@ -260,8 +260,8 @@ The workspace grows organically. `add` handles placement, wires dependencies, up
|
|
|
260
260
|
```bash
|
|
261
261
|
pnpm create uniweb acme --template blank
|
|
262
262
|
cd acme
|
|
263
|
-
uniweb add foundation
|
|
264
|
-
uniweb add site
|
|
263
|
+
npx uniweb add foundation
|
|
264
|
+
npx uniweb add site
|
|
265
265
|
pnpm install && pnpm dev
|
|
266
266
|
```
|
|
267
267
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"js-yaml": "^4.1.0",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.0.0",
|
|
44
|
-
"@uniweb/build": "0.7.
|
|
45
|
-
"@uniweb/core": "0.5.0",
|
|
44
|
+
"@uniweb/build": "0.7.3",
|
|
46
45
|
"@uniweb/runtime": "0.6.0",
|
|
46
|
+
"@uniweb/core": "0.5.0",
|
|
47
47
|
"@uniweb/kit": "0.6.0"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/index.js
CHANGED
|
@@ -40,6 +40,19 @@ const colors = {
|
|
|
40
40
|
red: '\x1b[31m',
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Template choices for interactive prompt
|
|
44
|
+
const TEMPLATE_CHOICES = [
|
|
45
|
+
{ title: 'Starter', value: 'starter', description: 'Foundation + site + sample content' },
|
|
46
|
+
{ title: 'Blank', value: 'blank', description: 'Empty workspace — grow with uniweb add' },
|
|
47
|
+
{ title: 'Marketing', value: 'marketing', description: 'Landing page, features, pricing, testimonials' },
|
|
48
|
+
{ title: 'Docs', value: 'docs', description: 'Documentation with sidebar and search' },
|
|
49
|
+
{ title: 'Academic', value: 'academic', description: 'Research site with publications and team' },
|
|
50
|
+
{ title: 'Dynamic', value: 'dynamic', description: 'Live API data fetching with loading states' },
|
|
51
|
+
{ title: 'International', value: 'international', description: 'Multilingual site with i18n and blog' },
|
|
52
|
+
{ title: 'Store', value: 'store', description: 'E-commerce with product grid' },
|
|
53
|
+
{ title: 'Extensions', value: 'extensions', description: 'Multi-foundation with visual effects extension' },
|
|
54
|
+
]
|
|
55
|
+
|
|
43
56
|
function log(message) {
|
|
44
57
|
console.log(message)
|
|
45
58
|
}
|
|
@@ -383,6 +396,22 @@ async function main() {
|
|
|
383
396
|
process.exit(1)
|
|
384
397
|
}
|
|
385
398
|
|
|
399
|
+
// Prompt for template if not specified via --template
|
|
400
|
+
if (!templateType) {
|
|
401
|
+
const templateResponse = await prompts({
|
|
402
|
+
type: 'select',
|
|
403
|
+
name: 'template',
|
|
404
|
+
message: 'Template:',
|
|
405
|
+
choices: TEMPLATE_CHOICES,
|
|
406
|
+
}, {
|
|
407
|
+
onCancel: () => {
|
|
408
|
+
log('\nScaffolding cancelled.')
|
|
409
|
+
process.exit(0)
|
|
410
|
+
},
|
|
411
|
+
})
|
|
412
|
+
templateType = templateResponse.template
|
|
413
|
+
}
|
|
414
|
+
|
|
386
415
|
const effectiveName = displayName || projectName
|
|
387
416
|
|
|
388
417
|
// Create project directory
|
|
@@ -404,8 +433,8 @@ async function main() {
|
|
|
404
433
|
onProgress: progressCb,
|
|
405
434
|
onWarning: warningCb,
|
|
406
435
|
})
|
|
407
|
-
} else if (
|
|
408
|
-
//
|
|
436
|
+
} else if (templateType === 'starter') {
|
|
437
|
+
// Starter: foundation + site + sample content
|
|
409
438
|
log('\nCreating project...')
|
|
410
439
|
await createFromPackageTemplates(projectDir, effectiveName, {
|
|
411
440
|
onProgress: progressCb,
|
|
@@ -439,7 +468,7 @@ async function main() {
|
|
|
439
468
|
log(`${colors.yellow}Troubleshooting:${colors.reset}`)
|
|
440
469
|
log(` • Check your network connection`)
|
|
441
470
|
log(` • Official templates require GitHub access (may be blocked by corporate networks)`)
|
|
442
|
-
log(` • Try the
|
|
471
|
+
log(` • Try the starter template instead: ${colors.cyan}uniweb create ${projectName} --template starter${colors.reset}`)
|
|
443
472
|
process.exit(1)
|
|
444
473
|
}
|
|
445
474
|
}
|
|
@@ -468,8 +497,8 @@ async function main() {
|
|
|
468
497
|
if (templateType === 'blank') {
|
|
469
498
|
log(`Next steps:\n`)
|
|
470
499
|
log(` ${colors.cyan}cd ${projectName}${colors.reset}`)
|
|
471
|
-
log(` ${colors.cyan}uniweb add foundation${colors.reset}`)
|
|
472
|
-
log(` ${colors.cyan}uniweb add site${colors.reset}`)
|
|
500
|
+
log(` ${colors.cyan}npx uniweb add foundation${colors.reset}`)
|
|
501
|
+
log(` ${colors.cyan}npx uniweb add site${colors.reset}`)
|
|
473
502
|
log(` ${colors.cyan}pnpm install${colors.reset}`)
|
|
474
503
|
log(` ${colors.cyan}pnpm dev${colors.reset}`)
|
|
475
504
|
} else {
|
|
@@ -497,7 +526,7 @@ ${colors.bright}Commands:${colors.reset}
|
|
|
497
526
|
i18n <cmd> Internationalization (extract, sync, status)
|
|
498
527
|
|
|
499
528
|
${colors.bright}Create Options:${colors.reset}
|
|
500
|
-
--template <type> Project template (
|
|
529
|
+
--template <type> Project template (prompts if not specified)
|
|
501
530
|
--name <name> Project display name
|
|
502
531
|
--no-git Skip git repository initialization
|
|
503
532
|
|
|
@@ -533,6 +562,7 @@ ${colors.bright}i18n Commands:${colors.reset}
|
|
|
533
562
|
status Show translation coverage per locale
|
|
534
563
|
|
|
535
564
|
${colors.bright}Template Types:${colors.reset}
|
|
565
|
+
starter Foundation + site + sample content (default)
|
|
536
566
|
blank Empty workspace (grow with 'add')
|
|
537
567
|
marketing Official marketing template
|
|
538
568
|
./path/to/template Local directory
|
|
@@ -541,7 +571,8 @@ ${colors.bright}Template Types:${colors.reset}
|
|
|
541
571
|
https://github.com/user/repo GitHub URL
|
|
542
572
|
|
|
543
573
|
${colors.bright}Examples:${colors.reset}
|
|
544
|
-
npx uniweb create my-project #
|
|
574
|
+
npx uniweb create my-project # Interactive (prompts for template)
|
|
575
|
+
npx uniweb create my-project --template starter # Foundation + site + starter content
|
|
545
576
|
npx uniweb create my-project --template blank # Blank workspace
|
|
546
577
|
npx uniweb create my-project --template marketing # Official template
|
|
547
578
|
npx uniweb create my-project --template ./my-template # Local template
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// Built-in templates (programmatic, not file-based)
|
|
6
|
-
export const BUILTIN_TEMPLATES = ['blank']
|
|
6
|
+
export const BUILTIN_TEMPLATES = ['blank', 'starter']
|
|
7
7
|
|
|
8
8
|
// Official templates from @uniweb/templates package (downloaded from GitHub releases)
|
|
9
9
|
export const OFFICIAL_TEMPLATES = ['marketing', 'academic', 'docs', 'international', 'dynamic', 'store', 'extensions']
|