@thorprovider/storefront 0.13.0 → 0.13.1
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/assets/templates/views/home/content.ts +62 -4
- package/bin/storefront.js +2 -0
- package/package.json +1 -1
- package/scripts/candidate.mjs +59 -13
- package/scripts/scaffold-env.mjs +18 -8
|
@@ -127,6 +127,14 @@ const giftsMobile = bannerScene(
|
|
|
127
127
|
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#f3e7e2'/><rect x='0' y='780' width='640' height='180' fill='#e0cdc6'/><rect x='170' y='700' width='300' height='80' rx='12' fill='#d8c2ba'/><rect x='200' y='400' width='240' height='300' rx='26' fill='#a4465c'/><path d='M270 400 Q270 320 320 320 Q370 320 370 400' fill='none' stroke='#7d3346' stroke-width='20'/><rect x='200' y='510' width='240' height='22' fill='#7d3346' opacity='0.5'/><rect x='292' y='484' width='52' height='66' rx='9' fill='#e8c8a0'/></svg>`,
|
|
128
128
|
)
|
|
129
129
|
|
|
130
|
+
// Dining-table scene for the decor tile: oak table, linen runner, plate stack.
|
|
131
|
+
const decorDesktop = bannerScene(
|
|
132
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><rect width='1600' height='900' fill='#eef1ec'/><rect x='0' y='640' width='1600' height='260' fill='#d5dccf'/><rect x='180' y='470' width='1240' height='190' rx='18' fill='#c9a879'/><rect x='120' y='660' width='60' height='150' rx='10' fill='#a98d63'/><rect x='1420' y='660' width='60' height='150' rx='10' fill='#a98d63'/><rect x='560' y='440' width='480' height='60' rx='8' fill='#f6f2ea'/><g fill='#ffffff' stroke='#cdd6c6' stroke-width='6'><circle cx='430' cy='440' r='110'/><circle cx='760' cy='430' r='86'/><circle cx='1050' cy='445' r='110'/></g><circle cx='430' cy='440' r='60' fill='#e8e3d6'/><circle cx='1050' cy='445' r='60' fill='#e8e3d6'/><g><rect x='1240' y='330' width='90' height='150' rx='16' fill='#b7a184'/><path d='M1265 330 q20 -70 40 0' fill='none' stroke='#8a9b6e' stroke-width='10'/><circle cx='1285' cy='248' r='34' fill='#9daf80'/></g><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#7c8778' opacity='0.6'>MESA</text></svg>`,
|
|
133
|
+
)
|
|
134
|
+
const decorMobile = bannerScene(
|
|
135
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#eef1ec'/><rect x='0' y='700' width='640' height='260' fill='#d5dccf'/><rect x='40' y='560' width='560' height='170' rx='16' fill='#c9a879'/><rect x='180' y='530' width='280' height='50' rx='8' fill='#f6f2ea'/><g fill='#ffffff' stroke='#cdd6c6' stroke-width='6'><circle cx='230' cy='520' r='80'/><circle cx='430' cy='525' r='80'/></g><g><rect x='470' y='380' width='70' height='120' rx='14' fill='#b7a184'/><path d='M490 380 q16 -54 32 0' fill='none' stroke='#8a9b6e' stroke-width='9'/><circle cx='506' cy='318' r='28' fill='#9daf80'/></g></svg>`,
|
|
136
|
+
)
|
|
137
|
+
|
|
130
138
|
export const heroBannerData = {
|
|
131
139
|
campaign: {
|
|
132
140
|
schemaVersion: 1,
|
|
@@ -199,6 +207,9 @@ export const heroBannerData = {
|
|
|
199
207
|
padding: 'md',
|
|
200
208
|
textScale: 'sm',
|
|
201
209
|
},
|
|
210
|
+
// Desktop: wide tiles with a 224px floor. Each tile owns one cell of the
|
|
211
|
+
// wall, so the floor sets the row height and copy can still grow it.
|
|
212
|
+
responsive: { '2xl': { aspect: 'wide', height: 'adaptive', heightToken: 'md' } },
|
|
202
213
|
visible: true,
|
|
203
214
|
},
|
|
204
215
|
{
|
|
@@ -232,6 +243,9 @@ export const heroBannerData = {
|
|
|
232
243
|
padding: 'md',
|
|
233
244
|
textScale: 'sm',
|
|
234
245
|
},
|
|
246
|
+
// Desktop: wide tiles with a 224px floor. Each tile owns one cell of the
|
|
247
|
+
// wall, so the floor sets the row height and copy can still grow it.
|
|
248
|
+
responsive: { '2xl': { aspect: 'wide', height: 'adaptive', heightToken: 'md' } },
|
|
235
249
|
visible: true,
|
|
236
250
|
},
|
|
237
251
|
{
|
|
@@ -265,6 +279,45 @@ export const heroBannerData = {
|
|
|
265
279
|
padding: 'md',
|
|
266
280
|
textScale: 'sm',
|
|
267
281
|
},
|
|
282
|
+
// Desktop: wide tiles with a 224px floor. Each tile owns one cell of the
|
|
283
|
+
// wall, so the floor sets the row height and copy can still grow it.
|
|
284
|
+
responsive: { '2xl': { aspect: 'wide', height: 'adaptive', heightToken: 'md' } },
|
|
285
|
+
visible: true,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: 'banner-mesa-decor',
|
|
289
|
+
campaignId: 'campaign-thor-salon',
|
|
290
|
+
content: {
|
|
291
|
+
name: 'Mesa y textil',
|
|
292
|
+
alt: 'Mesa de roble con mantel de lino, vajilla clara y un jarrón de cerámica',
|
|
293
|
+
title: 'La mesa, a punto',
|
|
294
|
+
description: 'Mantelería de lino, vajilla y cerámica para completar el salón.',
|
|
295
|
+
badge: 'Decoración',
|
|
296
|
+
target: { kind: 'category', id: 'home' },
|
|
297
|
+
ctas: [
|
|
298
|
+
{ id: 'cta-mesa', label: 'Ver decoración', target: { kind: 'category', id: 'home' }, tone: 'secondary' },
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
media: { desktop: decorDesktop, mobile: decorMobile },
|
|
302
|
+
presentation: {
|
|
303
|
+
mode: 'overlay',
|
|
304
|
+
width: 'full',
|
|
305
|
+
height: 'auto',
|
|
306
|
+
heightToken: 'sm',
|
|
307
|
+
aspect: 'photo',
|
|
308
|
+
fit: 'cover',
|
|
309
|
+
focal: 'center',
|
|
310
|
+
align: 'start',
|
|
311
|
+
radius: '2xl',
|
|
312
|
+
surface: 'card',
|
|
313
|
+
overlay: 'scrim',
|
|
314
|
+
overlayOpacity: 'light',
|
|
315
|
+
padding: 'md',
|
|
316
|
+
textScale: 'sm',
|
|
317
|
+
},
|
|
318
|
+
// Desktop: wide tiles with a 224px floor. Each tile owns one cell of the
|
|
319
|
+
// wall, so the floor sets the row height and copy can still grow it.
|
|
320
|
+
responsive: { '2xl': { aspect: 'wide', height: 'adaptive', heightToken: 'md' } },
|
|
268
321
|
visible: true,
|
|
269
322
|
},
|
|
270
323
|
],
|
|
@@ -277,20 +330,25 @@ export const heroBannerData = {
|
|
|
277
330
|
scheduleAware: true,
|
|
278
331
|
responsiveEnabled: true,
|
|
279
332
|
presentation: 'grid',
|
|
280
|
-
preset: '
|
|
333
|
+
preset: 'custom',
|
|
281
334
|
refs: [
|
|
282
335
|
{ bannerId: 'banner-salon-oferta' },
|
|
283
336
|
{ bannerId: 'banner-aurora-deal' },
|
|
284
337
|
{ bannerId: 'banner-nuevas-llegadas' },
|
|
285
338
|
{ bannerId: 'banner-guia-regalo' },
|
|
339
|
+
{ bannerId: 'banner-mesa-decor' },
|
|
286
340
|
],
|
|
287
341
|
layout: {
|
|
342
|
+
// Hero at two thirds with a tile beside it, then a row of three. Spans only
|
|
343
|
+
// apply at 2xl; narrower containers drop to one cell per column.
|
|
344
|
+
columns: { base: 1, md: 2, '2xl': 3 },
|
|
345
|
+
spans: [2, 1, 1, 1, 1],
|
|
288
346
|
gapX: 'md',
|
|
289
347
|
gapY: 'md',
|
|
290
348
|
maxWidth: 'full',
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
maxHeight: '
|
|
349
|
+
// Caps every cell at 384px, which is the hero's height in its two-column
|
|
350
|
+
// cell. The tiles keep their 224px floor, so the wall stays near 630px.
|
|
351
|
+
maxHeight: 'xl',
|
|
294
352
|
align: 'center',
|
|
295
353
|
radius: '2xl',
|
|
296
354
|
},
|
package/bin/storefront.js
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
DEFAULT_REGISTRY,
|
|
65
65
|
findPack,
|
|
66
66
|
parseRuntimeCommerceImports,
|
|
67
|
+
REGISTRY_RETRY,
|
|
67
68
|
verifyPackExports,
|
|
68
69
|
verifyRegistryToolset,
|
|
69
70
|
} from '../scripts/candidate.mjs'
|
|
@@ -1048,6 +1049,7 @@ async function create(args) {
|
|
|
1048
1049
|
cliVersion,
|
|
1049
1050
|
templatesDir: join(PKG_ROOT, 'assets', 'templates'),
|
|
1050
1051
|
registry: process.env.STOREFRONT_REGISTRY_URL || DEFAULT_REGISTRY,
|
|
1052
|
+
retry: REGISTRY_RETRY,
|
|
1051
1053
|
})
|
|
1052
1054
|
if (!registry.ok) {
|
|
1053
1055
|
console.error('Refusing to create: the pinned candidate is not installable from the registry.')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thorprovider/storefront",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Deterministic storefront scaffolder and installable OpenCode skill suite for Thor Commerce (Next.js, @thorprovider/blocks, @thorprovider/adapters, Medusa)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "bin/storefront.js",
|
package/scripts/candidate.mjs
CHANGED
|
@@ -48,9 +48,9 @@ export const CANDIDATE_TOOLSET = Object.freeze({
|
|
|
48
48
|
}),
|
|
49
49
|
local: Object.freeze({
|
|
50
50
|
'@thorprovider/blocks': '4.5.0',
|
|
51
|
-
'@thorprovider/adapters': '5.
|
|
52
|
-
'@thorprovider/runtime': '0.
|
|
53
|
-
'@thorprovider/types': '7.
|
|
51
|
+
'@thorprovider/adapters': '5.7.0',
|
|
52
|
+
'@thorprovider/runtime': '0.9.0',
|
|
53
|
+
'@thorprovider/types': '7.8.0',
|
|
54
54
|
}),
|
|
55
55
|
})
|
|
56
56
|
|
|
@@ -431,6 +431,37 @@ export function verifyRegistryArtifact({
|
|
|
431
431
|
return { ok: true }
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
+
/**
|
|
435
|
+
* `npm publish` returns before every registry edge serves the artifacts. A
|
|
436
|
+
* mirror that is still replicating answers 404 for a version that exists, so the
|
|
437
|
+
* acceptance gate polls instead of failing a release that published correctly.
|
|
438
|
+
*/
|
|
439
|
+
export const REGISTRY_RETRY = Object.freeze({ attempts: 6, delayMs: 5000 })
|
|
440
|
+
|
|
441
|
+
const defaultSleep = (ms) => new Promise((done) => setTimeout(done, ms))
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Fetch once, then keep asking while the only answer is "not there yet" (404) or
|
|
445
|
+
* the network itself failed. Any other status is a real answer and ends the poll.
|
|
446
|
+
*/
|
|
447
|
+
async function fetchUntilAvailable(fetchImpl, url, init, { attempts = 1, delayMs = 0, sleep = defaultSleep } = {}) {
|
|
448
|
+
let response
|
|
449
|
+
let error
|
|
450
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
451
|
+
error = undefined
|
|
452
|
+
try {
|
|
453
|
+
response = await fetchImpl(url, init)
|
|
454
|
+
} catch (cause) {
|
|
455
|
+
response = undefined
|
|
456
|
+
error = cause
|
|
457
|
+
}
|
|
458
|
+
const unavailable = error !== undefined || response.status === 404
|
|
459
|
+
if (!unavailable || attempt === attempts) break
|
|
460
|
+
await sleep(delayMs * attempt)
|
|
461
|
+
}
|
|
462
|
+
return { response, error }
|
|
463
|
+
}
|
|
464
|
+
|
|
434
465
|
/**
|
|
435
466
|
* Resolve one exact pin against the registry. Metadata is always checked; the
|
|
436
467
|
* tarball is downloaded only when the caller needs to inspect its surface.
|
|
@@ -441,13 +472,21 @@ export async function resolveRegistryCandidate({
|
|
|
441
472
|
registry = DEFAULT_REGISTRY,
|
|
442
473
|
fetchImpl = globalThis.fetch,
|
|
443
474
|
downloadTarball = false,
|
|
475
|
+
retry = { attempts: 1, delayMs: 0 },
|
|
476
|
+
sleep,
|
|
444
477
|
}) {
|
|
445
478
|
const url = registryMetadataUrl(name, version, registry)
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
479
|
+
const { response, error: metadataError } = await fetchUntilAvailable(
|
|
480
|
+
fetchImpl,
|
|
481
|
+
url,
|
|
482
|
+
{ headers: { accept: 'application/json' } },
|
|
483
|
+
{ ...retry, sleep },
|
|
484
|
+
)
|
|
485
|
+
if (!response) {
|
|
486
|
+
return registryFailure(
|
|
487
|
+
'E_REGISTRY_UNREACHABLE',
|
|
488
|
+
`${name}@${version}: cannot reach ${url} (${metadataError?.message ?? 'no response'})`,
|
|
489
|
+
)
|
|
451
490
|
}
|
|
452
491
|
if (response.status === 404) {
|
|
453
492
|
return registryFailure('E_PIN_UNPUBLISHED', `${name}@${version} is not published on ${registry}`)
|
|
@@ -487,13 +526,16 @@ export async function resolveRegistryCandidate({
|
|
|
487
526
|
}
|
|
488
527
|
if (!downloadTarball) return { ok: true, name, version, metadata, tarballUrl }
|
|
489
528
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
529
|
+
const { response: tarballResponse, error: tarballError } = await fetchUntilAvailable(
|
|
530
|
+
fetchImpl,
|
|
531
|
+
tarballUrl,
|
|
532
|
+
undefined,
|
|
533
|
+
{ ...retry, sleep },
|
|
534
|
+
)
|
|
535
|
+
if (!tarballResponse) {
|
|
494
536
|
return registryFailure(
|
|
495
537
|
'E_REGISTRY_UNREACHABLE',
|
|
496
|
-
`${name}@${version}: cannot download ${tarballUrl} (${
|
|
538
|
+
`${name}@${version}: cannot download ${tarballUrl} (${tarballError?.message ?? 'no response'})`,
|
|
497
539
|
)
|
|
498
540
|
}
|
|
499
541
|
if (!tarballResponse.ok) {
|
|
@@ -532,6 +574,8 @@ export async function verifyRegistryToolset({
|
|
|
532
574
|
templatesDir,
|
|
533
575
|
registry = DEFAULT_REGISTRY,
|
|
534
576
|
fetchImpl = globalThis.fetch,
|
|
577
|
+
retry = { attempts: 1, delayMs: 0 },
|
|
578
|
+
sleep,
|
|
535
579
|
}) {
|
|
536
580
|
const { blockImports, runtimeImports } = collectTemplateSurface(templatesDir)
|
|
537
581
|
const pins = { ...toolset.local, ...(cliVersion ? { '@thorprovider/storefront': cliVersion } : {}) }
|
|
@@ -548,6 +592,8 @@ export async function verifyRegistryToolset({
|
|
|
548
592
|
registry,
|
|
549
593
|
fetchImpl,
|
|
550
594
|
downloadTarball: inspect,
|
|
595
|
+
retry,
|
|
596
|
+
sleep,
|
|
551
597
|
})
|
|
552
598
|
if (!result.ok) {
|
|
553
599
|
errors.push({ code: result.code, message: result.message })
|
package/scripts/scaffold-env.mjs
CHANGED
|
@@ -6,34 +6,44 @@
|
|
|
6
6
|
// hardlink, which turns a cheap scaffold into a burst of disk writes. Pointing
|
|
7
7
|
// `TMPDIR` at a directory beside the target keeps staging and cache on one
|
|
8
8
|
// device, so `hardlinks-global` holds for every install the scaffold runs.
|
|
9
|
+
//
|
|
10
|
+
// The generated project owns its lockfile: `create` declares the curated
|
|
11
|
+
// dependencies, lets `shadcn init` install, then tightens the CLI pin, so the
|
|
12
|
+
// reconcile pass must be allowed to rewrite the lockfile. Yarn treats `CI=true`
|
|
13
|
+
// as immutable, which turns that reconcile into YN0028 and fails the scaffold
|
|
14
|
+
// inside CI, so the child processes opt out of immutability explicitly.
|
|
9
15
|
|
|
10
16
|
import { mkdtempSync, rmSync, statSync } from 'node:fs'
|
|
11
17
|
import { tmpdir } from 'node:os'
|
|
12
18
|
import { dirname, join } from 'node:path'
|
|
13
19
|
|
|
20
|
+
/** The scaffold writes the lockfile of the project it creates, never this repo's. */
|
|
21
|
+
const OWNED_LOCKFILE_ENV = { YARN_ENABLE_IMMUTABLE_INSTALLS: 'false' }
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* Env overrides that keep Yarn staging on the target's device.
|
|
16
|
-
*
|
|
17
|
-
* when the target cannot be
|
|
25
|
+
* Always includes the owned-lockfile opt-out; `TMPDIR` is added only when the
|
|
26
|
+
* default temp directory lives on another device, or when the target cannot be
|
|
27
|
+
* inspected.
|
|
18
28
|
*/
|
|
19
29
|
export function scaffoldTempEnv(target) {
|
|
20
|
-
if (process.platform === 'win32') return {}
|
|
30
|
+
if (process.platform === 'win32') return { ...OWNED_LOCKFILE_ENV }
|
|
21
31
|
let targetDevice
|
|
22
32
|
try {
|
|
23
33
|
targetDevice = statSync(target).dev
|
|
24
34
|
} catch {
|
|
25
|
-
return {}
|
|
35
|
+
return { ...OWNED_LOCKFILE_ENV }
|
|
26
36
|
}
|
|
27
37
|
try {
|
|
28
|
-
if (statSync(tmpdir()).dev === targetDevice) return {}
|
|
38
|
+
if (statSync(tmpdir()).dev === targetDevice) return { ...OWNED_LOCKFILE_ENV }
|
|
29
39
|
} catch {
|
|
30
|
-
return {}
|
|
40
|
+
return { ...OWNED_LOCKFILE_ENV }
|
|
31
41
|
}
|
|
32
42
|
try {
|
|
33
|
-
return { TMPDIR: mkdtempSync(join(dirname(target), '.storefront-tmp-')) }
|
|
43
|
+
return { ...OWNED_LOCKFILE_ENV, TMPDIR: mkdtempSync(join(dirname(target), '.storefront-tmp-')) }
|
|
34
44
|
} catch {
|
|
35
45
|
// A read-only parent is not a reason to fail the scaffold.
|
|
36
|
-
return {}
|
|
46
|
+
return { ...OWNED_LOCKFILE_ENV }
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
|