uniweb 0.8.13 → 0.8.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,11 +41,11 @@
41
41
  "js-yaml": "^4.1.0",
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "^7.0.0",
44
- "@uniweb/build": "0.8.12",
44
+ "@uniweb/build": "0.8.13",
45
45
  "@uniweb/content-reader": "1.1.4",
46
- "@uniweb/core": "0.5.9",
47
- "@uniweb/kit": "0.7.9",
48
- "@uniweb/runtime": "0.6.9",
46
+ "@uniweb/kit": "0.7.10",
47
+ "@uniweb/runtime": "0.6.10",
48
+ "@uniweb/core": "0.5.10",
49
49
  "@uniweb/semantic-parser": "1.1.6"
50
50
  }
51
51
  }
@@ -225,7 +225,7 @@ async function loadI18nConfig(projectDir, siteConfig = null) {
225
225
 
226
226
  // Resolve locales (undefined/'*' → all available, array → specific)
227
227
  const { resolveLocales } = await import('@uniweb/build/i18n')
228
- const locales = await resolveLocales(config.i18n?.locales, localesPath)
228
+ const locales = await resolveLocales(config.languages, localesPath)
229
229
 
230
230
  if (locales.length === 0) return null
231
231
 
@@ -80,7 +80,7 @@ ${colors.bright}Page Ordering:${colors.reset}
80
80
  Rest are auto-discovered
81
81
 
82
82
  ${colors.bright}Internationalization:${colors.reset}
83
- ${colors.cyan}i18n.locales${colors.reset} Locales to build (array or "*" for all)
83
+ ${colors.cyan}languages${colors.reset} Languages to build (array or "*" for all)
84
84
  Example: [es, fr, de]
85
85
  ${colors.cyan}i18n.localesDir${colors.reset} Translation files directory (default: "locales")
86
86
 
@@ -213,7 +213,7 @@ async function loadSiteConfig(siteRoot) {
213
213
 
214
214
  // Resolve locales (undefined/'*' → all available, array → specific)
215
215
  const { resolveLocales } = await import('@uniweb/build/i18n')
216
- const locales = await resolveLocales(config.i18n?.locales, localesPath)
216
+ const locales = await resolveLocales(config.languages, localesPath)
217
217
 
218
218
  return {
219
219
  defaultLocale: config.defaultLanguage || 'en',
@@ -376,7 +376,7 @@ async function runInit(siteRoot, config, args) {
376
376
  if (!targetLocales || targetLocales.length === 0) {
377
377
  error('No target locales specified.')
378
378
  log(`${colors.dim}Specify locales as arguments (e.g., "uniweb i18n generate es fr")`)
379
- log(`or configure them in site.yml under i18n.locales.${colors.reset}`)
379
+ log(`or configure them in site.yml under languages.${colors.reset}`)
380
380
  process.exit(1)
381
381
  }
382
382
 
@@ -1454,10 +1454,10 @@ ${colors.bright}Options:${colors.reset}
1454
1454
  ${colors.bright}Configuration:${colors.reset}
1455
1455
  Optional site.yml settings:
1456
1456
 
1457
+ languages: [es, fr] # Languages to build (default: all available)
1458
+
1457
1459
  i18n:
1458
- locales: [es, fr] # Specific locales only (default: all available)
1459
- locales: '*' # Explicitly all available locales
1460
- localesDir: locales # Directory for translation files (default: locales)
1460
+ localesDir: locales # Directory for translation files (default: locales)
1461
1461
 
1462
1462
  By default, all *.json files in locales/ are treated as translation targets.
1463
1463
 
package/src/index.js CHANGED
@@ -411,7 +411,7 @@ async function main() {
411
411
  type: projectName ? null : 'text',
412
412
  name: 'projectName',
413
413
  message: 'Project name:',
414
- initial: 'my-uniweb-project',
414
+ initial: 'website',
415
415
  validate: (value) => {
416
416
  if (!value) return 'Project name is required'
417
417
  if (!/^[a-z0-9-]+$/.test(value)) {
@@ -177,7 +177,7 @@ async function processFile(sourcePath, targetPath, data, options = {}) {
177
177
  * @param {Function} options.onProgress - Progress callback
178
178
  */
179
179
  export async function copyTemplateDirectory(sourcePath, targetPath, data, options = {}) {
180
- const { onWarning, onProgress } = options
180
+ const { onWarning, onProgress, skip } = options
181
181
 
182
182
  await fs.mkdir(targetPath, { recursive: true })
183
183
  const entries = await fs.readdir(sourcePath, { withFileTypes: true })
@@ -194,13 +194,19 @@ export async function copyTemplateDirectory(sourcePath, targetPath, data, option
194
194
  : sourceName
195
195
  const targetFullPath = path.join(targetPath, targetName)
196
196
 
197
- await copyTemplateDirectory(sourceFullPath, targetFullPath, data, { onWarning, onProgress })
197
+ await copyTemplateDirectory(sourceFullPath, targetFullPath, data, { onWarning, onProgress, skip })
198
198
  } else {
199
199
  // Skip template.json as it's metadata for the template, not for the output
200
200
  if (sourceName === 'template.json') {
201
201
  continue
202
202
  }
203
203
 
204
+ // Determine the output filename (strip .hbs extension) for skip check
205
+ const outputName = sourceName.endsWith('.hbs') ? sourceName.slice(0, -4) : sourceName
206
+ if (skip?.includes(outputName)) {
207
+ continue
208
+ }
209
+
204
210
  // Remove .hbs extension for target filename
205
211
  const targetName = sourceName.endsWith('.hbs')
206
212
  ? sourceName.slice(0, -4)
@@ -30,10 +30,17 @@ const STARTER_DIR = join(__dirname, '..', '..', 'starter')
30
30
  export async function scaffoldWorkspace(targetDir, context, options = {}) {
31
31
  registerVersions(getVersionsForTemplates())
32
32
 
33
+ // Skip pnpm-workspace.yaml for blank workspaces (no packages yet).
34
+ // The `add` command creates it on demand via addWorkspaceGlob().
35
+ // Without this, pnpm fails with ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND
36
+ // because an empty packages: [] makes pnpm search parent directories.
37
+ const skip = context.workspaceGlobs?.length ? [] : ['pnpm-workspace.yaml']
38
+
33
39
  const templatePath = join(TEMPLATES_DIR, 'workspace')
34
40
  await copyTemplateDirectory(templatePath, targetDir, context, {
35
41
  onProgress: options.onProgress,
36
42
  onWarning: options.onWarning,
43
+ skip,
37
44
  })
38
45
  }
39
46