create-abcart-theme 0.10.0 → 1.0.0
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/CHANGELOG.md +133 -127
- package/LICENSE +202 -202
- package/NOTICE +2 -2
- package/README.md +65 -65
- package/bin/create-abcart-theme.mjs +4 -4
- package/package.json +49 -49
- package/src/args.mjs +113 -113
- package/src/banner.mjs +21 -21
- package/src/cli.mjs +119 -119
- package/src/create.mjs +85 -82
- package/src/package-manager.mjs +32 -32
- package/src/style.mjs +17 -17
- package/templates/default/.agents/skills/{wocart-docs → abcart-docs}/SKILL.md +146 -146
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/SKILL.md +58 -58
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/inputs-and-rights.md +47 -47
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/layout-rtl-and-phone.md +36 -36
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/measure-the-design.md +60 -60
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/tokens-sections-content.md +103 -103
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/references/verify-and-report.md +102 -102
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/compare-design.cjs +230 -230
- package/templates/default/.agents/skills/{wocart-theme-from-design → abcart-theme-from-design}/scripts/qa-pages.cjs +219 -219
- package/templates/default/.agents/skills/shopify-theme-asset-collector/SKILL.md +125 -125
- package/templates/default/.agents/skills/shopify-theme-asset-collector/scripts/collect_public_assets.py +370 -370
- package/templates/default/.dev.vars.example +12 -12
- package/templates/default/AGENTS.md +240 -240
- package/templates/default/README.md +184 -184
- package/templates/default/_gitignore +11 -11
- package/templates/default/astro.config.mjs +85 -85
- package/templates/default/package.json +36 -36
- package/templates/default/public/fonts/OFL.txt +96 -96
- package/templates/default/src/actions/index.ts +22 -22
- package/templates/default/src/components/cart/AddToCartButton.astro +45 -45
- package/templates/default/src/components/cart/CartDrawer.astro +47 -47
- package/templates/default/src/components/cart/CartSummary.astro +11 -11
- package/templates/default/src/components/cart/FreeShipping.astro +7 -7
- package/templates/default/src/components/checkout/CheckoutMain.astro +29 -29
- package/templates/default/src/components/checkout/OrderForm.astro +280 -280
- package/templates/default/src/components/checkout/ThankYouMain.astro +68 -68
- package/templates/default/src/components/landing/LandingImages.astro +51 -51
- package/templates/default/src/components/landing/LandingOrder.astro +46 -46
- package/templates/default/src/components/landing/LandingProduct.astro +41 -41
- package/templates/default/src/components/listing/ListingMain.astro +93 -93
- package/templates/default/src/components/listing/PageMain.astro +52 -52
- package/templates/default/src/components/listing/Pagination.astro +31 -31
- package/templates/default/src/components/listing/SortControl.astro +35 -35
- package/templates/default/src/components/product/BuyBox.astro +96 -96
- package/templates/default/src/components/product/Description.astro +24 -24
- package/templates/default/src/components/product/Gallery.astro +66 -66
- package/templates/default/src/components/product/MobileBuyBar.astro +29 -29
- package/templates/default/src/components/product/OfferChoice.astro +66 -66
- package/templates/default/src/components/product/ProductMain.astro +40 -40
- package/templates/default/src/components/product/ProductReviews.astro +72 -72
- package/templates/default/src/components/product/RelatedProducts.astro +30 -30
- package/templates/default/src/components/product/blocks/BenefitsBlock.astro +13 -13
- package/templates/default/src/components/product/blocks/CollapsibleBlock.astro +20 -20
- package/templates/default/src/components/product/blocks/DescriptionBlock.astro +19 -19
- package/templates/default/src/components/product/blocks/DetailsBlock.astro +33 -33
- package/templates/default/src/components/product/blocks/GalleryBlock.astro +12 -12
- package/templates/default/src/components/product/blocks/OrderBlock.astro +30 -30
- package/templates/default/src/components/product/blocks/PriceBlock.astro +23 -23
- package/templates/default/src/components/product/blocks/RatingBlock.astro +16 -16
- package/templates/default/src/components/product/blocks/StockBlock.astro +22 -22
- package/templates/default/src/components/product/blocks/TextBlock.astro +11 -11
- package/templates/default/src/components/product/blocks/TitleBlock.astro +20 -20
- package/templates/default/src/components/reviews/ReviewCard.astro +46 -46
- package/templates/default/src/components/reviews/ReviewForm.astro +113 -113
- package/templates/default/src/components/reviews/VoiceNote.astro +60 -60
- package/templates/default/src/components/sections/CollectionCards.astro +65 -65
- package/templates/default/src/components/sections/Countdown.astro +57 -57
- package/templates/default/src/components/sections/Faq.astro +44 -44
- package/templates/default/src/components/sections/FeaturedProduct.astro +71 -71
- package/templates/default/src/components/sections/Hero.astro +99 -99
- package/templates/default/src/components/sections/ImageBanner.astro +46 -46
- package/templates/default/src/components/sections/ProductGrid.astro +47 -47
- package/templates/default/src/components/sections/RichText.astro +35 -35
- package/templates/default/src/components/sections/Steps.astro +46 -46
- package/templates/default/src/components/sections/Testimonials.astro +57 -57
- package/templates/default/src/components/shell/Footer.astro +80 -80
- package/templates/default/src/components/shell/Header.astro +89 -89
- package/templates/default/src/components/shell/LanguageMenu.astro +33 -33
- package/templates/default/src/components/shell/MobileMenu.astro +65 -65
- package/templates/default/src/components/shell/SearchDialog.astro +19 -19
- package/templates/default/src/components/shell/TopBar.astro +54 -54
- package/templates/default/src/components/shell/WhatsAppWidget.astro +111 -111
- package/templates/default/src/components/store/ContactMain.astro +79 -79
- package/templates/default/src/components/store/SearchMain.astro +56 -56
- package/templates/default/src/components/store/TrackOrderMain.astro +161 -161
- package/templates/default/src/components/surface/Area.astro +20 -20
- package/templates/default/src/components/surface/PreviewBridge.astro +24 -24
- package/templates/default/src/components/surface/Sections.astro +35 -35
- package/templates/default/src/components/ui/Breadcrumbs.astro +36 -36
- package/templates/default/src/components/ui/Button.astro +45 -45
- package/templates/default/src/components/ui/EditorPlaceholder.astro +24 -24
- package/templates/default/src/components/ui/Icon.astro +93 -93
- package/templates/default/src/components/ui/Logo.astro +36 -36
- package/templates/default/src/components/ui/Photo.astro +46 -46
- package/templates/default/src/components/ui/Price.astro +24 -24
- package/templates/default/src/components/ui/ProductCard.astro +41 -41
- package/templates/default/src/components/ui/Rating.astro +22 -22
- package/templates/default/src/components/ui/Section.astro +34 -34
- package/templates/default/src/components/ui/SectionHeading.astro +19 -19
- package/templates/default/src/env.d.ts +23 -23
- package/templates/default/src/layouts/StoreLayout.astro +145 -145
- package/templates/default/src/lib/browser-copy.ts +37 -37
- package/templates/default/src/lib/context.ts +89 -89
- package/templates/default/src/lib/coupon-notice.ts +47 -47
- package/templates/default/src/lib/i18n.ts +32 -32
- package/templates/default/src/lib/images.ts +38 -38
- package/templates/default/src/lib/listing-query.ts +41 -41
- package/templates/default/src/lib/money.ts +16 -16
- package/templates/default/src/lib/motion.ts +16 -16
- package/templates/default/src/lib/nav.ts +26 -26
- package/templates/default/src/lib/offer-tiles.ts +105 -105
- package/templates/default/src/lib/order-outcome.ts +66 -66
- package/templates/default/src/lib/otp-message.ts +21 -21
- package/templates/default/src/lib/products.ts +38 -38
- package/templates/default/src/lib/review-refusals.ts +31 -31
- package/templates/default/src/lib/store.ts +31 -31
- package/templates/default/src/lib/whatsapp.ts +29 -29
- package/templates/default/src/middleware.ts +23 -23
- package/templates/default/src/pages/404.astro +22 -22
- package/templates/default/src/pages/{wocart-preview.astro → abcart-preview.astro} +43 -43
- package/templates/default/src/pages/{wocart-revalidate.ts → abcart-revalidate.ts} +10 -10
- package/templates/default/src/pages/{wocart-styles.css.ts → abcart-styles.css.ts} +5 -5
- package/templates/default/src/pages/{wocart-theme.json.ts → abcart-theme.json.ts} +5 -5
- package/templates/default/src/pages/api/abandoned/convert.ts +4 -4
- package/templates/default/src/pages/api/abandoned/upsert.ts +4 -4
- package/templates/default/src/pages/api/cart/validate.ts +4 -4
- package/templates/default/src/pages/api/communes/[wilayaId].ts +4 -4
- package/templates/default/src/pages/api/otp/send.ts +4 -4
- package/templates/default/src/pages/api/otp/verify.ts +4 -4
- package/templates/default/src/pages/api/reviews/[productId].ts +3 -3
- package/templates/default/src/pages/api/reviews/eligibility.ts +3 -3
- package/templates/default/src/pages/api/reviews/submit.ts +3 -3
- package/templates/default/src/pages/api/reviews/upload.ts +3 -3
- package/templates/default/src/pages/category/[slug].astro +20 -20
- package/templates/default/src/pages/checkout.astro +25 -25
- package/templates/default/src/pages/collections/[handle].astro +20 -20
- package/templates/default/src/pages/contact.astro +17 -17
- package/templates/default/src/pages/index.astro +9 -9
- package/templates/default/src/pages/lp/[slug].astro +47 -47
- package/templates/default/src/pages/pages/[slug].astro +16 -16
- package/templates/default/src/pages/products/[handle].astro +37 -37
- package/templates/default/src/pages/products/index.astro +15 -15
- package/templates/default/src/pages/robots.txt.ts +9 -9
- package/templates/default/src/pages/search.astro +19 -19
- package/templates/default/src/pages/sitemap.xml.ts +12 -12
- package/templates/default/src/pages/thank-you.astro +33 -33
- package/templates/default/src/pages/track-order.astro +17 -17
- package/templates/default/src/scripts/cart.ts +371 -371
- package/templates/default/src/scripts/checkout/coupon.ts +96 -96
- package/templates/default/src/scripts/checkout/delivery.ts +86 -86
- package/templates/default/src/scripts/checkout/form.ts +54 -54
- package/templates/default/src/scripts/checkout/otp.ts +106 -106
- package/templates/default/src/scripts/checkout/picker.ts +169 -169
- package/templates/default/src/scripts/checkout/quote.ts +169 -169
- package/templates/default/src/scripts/checkout/submit.ts +113 -113
- package/templates/default/src/scripts/checkout/tracking.ts +74 -74
- package/templates/default/src/scripts/countdown.ts +29 -29
- package/templates/default/src/scripts/events.ts +4 -4
- package/templates/default/src/scripts/hero.ts +49 -49
- package/templates/default/src/scripts/listing.ts +13 -13
- package/templates/default/src/scripts/order-form.ts +100 -100
- package/templates/default/src/scripts/product.ts +306 -306
- package/templates/default/src/scripts/public-config.ts +79 -79
- package/templates/default/src/scripts/reviews.ts +358 -358
- package/templates/default/src/scripts/site.ts +131 -131
- package/templates/default/src/scripts/thank-you.ts +11 -11
- package/templates/default/src/scripts/voice-note.ts +94 -94
- package/templates/default/src/styles/base.css +1030 -1030
- package/templates/default/src/styles/checkout.css +1111 -1111
- package/templates/default/src/styles/global.css +12 -12
- package/templates/default/src/styles/product.css +871 -871
- package/templates/default/src/styles/reviews.css +533 -533
- package/templates/default/src/styles/sections.css +931 -931
- package/templates/default/src/styles/shell.css +970 -970
- package/templates/default/src/styles/tokens.css +583 -583
- package/templates/default/src/theme/api-routes.ts +10 -10
- package/templates/default/src/theme/content/catalog.ts +117 -117
- package/templates/default/src/theme/content/checkout.ts +168 -168
- package/templates/default/src/theme/content/editor.ts +21 -21
- package/templates/default/src/theme/content/index.ts +45 -45
- package/templates/default/src/theme/content/reviews.ts +76 -76
- package/templates/default/src/theme/content/shell.ts +59 -59
- package/templates/default/src/theme/content/types.ts +12 -12
- package/templates/default/src/theme/documents/catalog.json +11 -11
- package/templates/default/src/theme/documents/category.json +11 -11
- package/templates/default/src/theme/documents/checkout.json +11 -11
- package/templates/default/src/theme/documents/collection.json +11 -11
- package/templates/default/src/theme/documents/contact.json +11 -11
- package/templates/default/src/theme/documents/footer.area.json +11 -11
- package/templates/default/src/theme/documents/header.area.json +16 -16
- package/templates/default/src/theme/documents/home.json +313 -313
- package/templates/default/src/theme/documents/landing.json +8 -8
- package/templates/default/src/theme/documents/page.json +11 -11
- package/templates/default/src/theme/documents/product.json +125 -125
- package/templates/default/src/theme/documents/search.json +11 -11
- package/templates/default/src/theme/documents/thank-you.json +11 -11
- package/templates/default/src/theme/documents/track-order.json +11 -11
- package/templates/default/src/theme/fields.ts +61 -61
- package/templates/default/src/theme/key.ts +11 -11
- package/templates/default/src/theme/labels.ts +231 -231
- package/templates/default/src/theme/locales.ts +11 -11
- package/templates/default/src/theme/palette.ts +14 -14
- package/templates/default/src/theme/sections/collection-cards.ts +65 -65
- package/templates/default/src/theme/sections/faq.ts +74 -74
- package/templates/default/src/theme/sections/featured-product.ts +42 -42
- package/templates/default/src/theme/sections/hero.ts +47 -47
- package/templates/default/src/theme/sections/image-banner.ts +25 -25
- package/templates/default/src/theme/sections/index.ts +40 -40
- package/templates/default/src/theme/sections/landing.ts +150 -150
- package/templates/default/src/theme/sections/listing.ts +84 -84
- package/templates/default/src/theme/sections/product-grid.ts +42 -42
- package/templates/default/src/theme/sections/product.ts +297 -297
- package/templates/default/src/theme/sections/rich-text.ts +39 -39
- package/templates/default/src/theme/sections/shared.ts +54 -54
- package/templates/default/src/theme/sections/shell.ts +85 -85
- package/templates/default/src/theme/sections/store-pages.ts +101 -101
- package/templates/default/src/theme/sections/testimonials.ts +61 -61
- package/templates/default/src/theme/sections/thank-you.ts +35 -35
- package/templates/default/src/theme/settings.ts +124 -124
- package/templates/default/src/theme/theme.ts +65 -65
- package/templates/default/tests/fixtures/canvas-tote.json +62 -62
- package/templates/default/tests/fixtures/linen-shirt.json +128 -128
- package/templates/default/tests/unit/checkout.test.ts +241 -241
- package/templates/default/tests/unit/contract.test.ts +170 -169
- package/templates/default/tests/unit/contrast.test.ts +68 -68
- package/templates/default/tests/unit/copy.test.ts +101 -101
- package/templates/default/tests/unit/design-values.test.ts +95 -95
- package/templates/default/tests/unit/editability.test.ts +180 -180
- package/templates/default/tests/unit/fixtures.ts +91 -91
- package/templates/default/tests/unit/footer.test.ts +54 -54
- package/templates/default/tests/unit/guards.test.ts +340 -340
- package/templates/default/tests/unit/images.test.ts +26 -26
- package/templates/default/tests/unit/landing.test.ts +151 -151
- package/templates/default/tests/unit/languages.test.ts +42 -42
- package/templates/default/tests/unit/middleware.test.ts +53 -53
- package/templates/default/tests/unit/offer-tiles.test.ts +75 -75
- package/templates/default/tests/unit/render.ts +38 -38
- package/templates/default/tests/unit/reviews.test.ts +25 -25
- package/templates/default/tests/unit/rules.test.ts +59 -59
- package/templates/default/tests/unit/source.ts +75 -75
- package/templates/default/tests/unit/store-pages.test.ts +147 -147
- package/templates/default/tests/unit/studio.test.ts +202 -202
- package/templates/default/tests/unit/testimonials.test.ts +52 -52
- package/templates/default/tests/unit/thank-you.test.ts +52 -52
- package/templates/default/tests/unit/tracking.test.ts +29 -29
- package/templates/default/tests/unit/voice-note.test.ts +42 -42
- package/templates/default/tsconfig.json +13 -13
- package/templates/default/vitest.config.ts +15 -15
- package/templates/default/wrangler.jsonc +16 -16
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
# My Theme
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
delivery. It reads the store through
|
|
5
|
-
[`@abcart/storefront`](https://docs.
|
|
6
|
-
itself to
|
|
7
|
-
It is plain on purpose: its look is tokens, fonts and colour schemes, so it
|
|
8
|
-
takes any brand. It speaks Arabic (right to left, the default), French and English.
|
|
9
|
-
|
|
10
|
-
**Built on** `@abcart/storefront`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Requirements
|
|
14
|
-
|
|
15
|
-
- Node.js 22.12 or newer.
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
store, every page renders as the SDK's unavailable store
|
|
19
|
-
(`unavailableStoreConfig`): the layout and the words, with nothing to buy.
|
|
20
|
-
|
|
21
|
-
## First run
|
|
22
|
-
|
|
23
|
-
```sh
|
|
24
|
-
npm install
|
|
25
|
-
cp .dev.vars.example .dev.vars # set COD_SERVER_URL and STORE_API_KEY
|
|
26
|
-
npm run dev # http://localhost:4321
|
|
27
|
-
npm test
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Environment variables
|
|
31
|
-
|
|
32
|
-
| Name | Required | Local value | In production |
|
|
33
|
-
| --- | --- | --- | --- |
|
|
34
|
-
| `COD_SERVER_URL` | yes | `http://localhost:8787` for a store on this machine | The store's API address |
|
|
35
|
-
| `STORE_API_KEY` | yes | Your store's key | A secret on your host |
|
|
36
|
-
| `
|
|
37
|
-
|
|
38
|
-
Locally they go in `.dev.vars`, which is never committed. In production they
|
|
39
|
-
are the host's secrets. The API key stays on the server.
|
|
40
|
-
|
|
41
|
-
## Project map
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
src/
|
|
45
|
-
theme/ what Studio reads
|
|
46
|
-
theme.ts the theme: pages, header and footer, settings, sections
|
|
47
|
-
key.ts the permanent theme key and the version
|
|
48
|
-
sections/ one definition per section: fields, data (load), presets
|
|
49
|
-
documents/ the layout each page starts with
|
|
50
|
-
content/ every word a shopper reads, in ar, fr and en
|
|
51
|
-
labels.ts what Studio calls each page, section, field and option
|
|
52
|
-
palette.ts the starter's colours, written once
|
|
53
|
-
settings.ts store-wide settings and the default colour schemes
|
|
54
|
-
components/ presentation; surface/ renders a page's sections
|
|
55
|
-
pages/ thin routes, plus the manifest, preview and revalidate routes
|
|
56
|
-
layouts/ StoreLayout.astro: the document head, header, footer, cart
|
|
57
|
-
lib/ server-side glue; store.ts is the only SDK client
|
|
58
|
-
scripts/ everything the browser runs
|
|
59
|
-
styles/ tokens.css is the design system; one file per area
|
|
60
|
-
middleware.ts the store, the language, redirects and preview
|
|
61
|
-
actions/ placing an order and looking one up, through the SDK
|
|
62
|
-
tests/unit/ contract, guards, design values, Studio, checkout, copy
|
|
63
|
-
.agents/skills/ three skills for coding agents (see below)
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
A new section is a definition in `src/theme/sections/`, a component in
|
|
67
|
-
`src/components/sections/`, its words in `src/theme/content/` and its editor
|
|
68
|
-
labels in `src/theme/labels.ts`. A new word is a copy key, never text in markup.
|
|
69
|
-
|
|
70
|
-
## The theme contract in five rules
|
|
71
|
-
|
|
72
|
-
1. **The theme key is permanent.** `THEME_KEY` names every merchant's saved
|
|
73
|
-
edits. Renaming it after a store edits the theme loses them.
|
|
74
|
-
2. **Definitions are code; documents are data.** Sections and their fields are
|
|
75
|
-
TypeScript; a page's starting layout is a JSON document.
|
|
76
|
-
3. **Sections read data only in `load`**, through `reads.get`, so a page reads
|
|
77
|
-
each thing once.
|
|
78
|
-
4. **Every string is in `src/theme/content/`**, in every language, with each
|
|
79
|
-
language's plural forms.
|
|
80
|
-
5. **Every cached page carries the `pages` tag** (the SDK's `PAGES_CACHE_TAG`),
|
|
81
|
-
so a publish in Studio shows at once.
|
|
82
|
-
|
|
83
|
-
`AGENTS.md` has the full rules, and `npm test` enforces them.
|
|
84
|
-
|
|
85
|
-
## Skills
|
|
86
|
-
|
|
87
|
-
Three skills for coding agents live in `.agents/skills/`. `AGENTS.md` says when
|
|
88
|
-
to use each:
|
|
89
|
-
|
|
90
|
-
- **`
|
|
91
|
-
image, a live URL, or a Shopify theme measured with the collector. It builds
|
|
92
|
-
the design as tokens and sections, runs the theme to a store, and measures how
|
|
93
|
-
closely it matches.
|
|
94
|
-
- **`shopify-theme-asset-collector`**: collects a Shopify theme's public pages,
|
|
95
|
-
styles, scripts, images and fonts, with a manifest of the homepage sections.
|
|
96
|
-
The output is for measuring a design, not for shipping.
|
|
97
|
-
- **`
|
|
98
|
-
and the test that checks each rule.
|
|
99
|
-
|
|
100
|
-
## Make it your brand
|
|
101
|
-
|
|
102
|
-
Three places restyle the whole store:
|
|
103
|
-
|
|
104
|
-
1. **`src/styles/tokens.css`** holds every design value. Change a value there,
|
|
105
|
-
and every stylesheet that uses it follows. `npm test` rejects a literal
|
|
106
|
-
value anywhere else.
|
|
107
|
-
2. **The fonts** in `public/fonts/`: one Arabic and one Latin family, each
|
|
108
|
-
limited to its script. A new file needs its `@font-face` rule at the top of
|
|
109
|
-
`tokens.css`, its preload in `src/layouts/StoreLayout.astro`, and its licence
|
|
110
|
-
line in `public/fonts/OFL.txt`. A test checks all three.
|
|
111
|
-
3. **The starter's colours** in `src/theme/palette.ts`, which the default colour
|
|
112
|
-
schemes in `src/theme/settings.ts` use: what a store starts with before the
|
|
113
|
-
merchant picks colours in Studio.
|
|
114
|
-
|
|
115
|
-
Keep four things while restyling: colours through tokens (merchants recolour
|
|
116
|
-
sections with schemes), text readable on its band (`contrast.test.ts` checks
|
|
117
|
-
every scheme at WCAG AA), logical properties (`margin-inline-start`, never
|
|
118
|
-
`left`) for right to left, and every `name` and `data-*` attribute that the
|
|
119
|
-
order form and the scripts use.
|
|
120
|
-
|
|
121
|
-
## Commands
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
npm run dev # the dev server, against the store in .dev.vars
|
|
125
|
-
npm run check # astro check: 0 errors, 0 warnings
|
|
126
|
-
npm test # the contract, guard, design-value, contrast, rules, Studio, checkout and copy tests; no network
|
|
127
|
-
npm run build # the Cloudflare Workers build (dist/)
|
|
128
|
-
npm run preview # the Cloudflare build, served locally by Wrangler
|
|
129
|
-
npm run build:vercel # the Vercel build (.vercel/output/)
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Deploying
|
|
133
|
-
|
|
134
|
-
**Cloudflare Workers.** `npm run build`, then `npx wrangler deploy`.
|
|
135
|
-
`wrangler.jsonc` holds the Worker's mechanics only: add your own routes or a
|
|
136
|
-
custom domain, and set each variable with `npx wrangler secret put <NAME>`.
|
|
137
|
-
|
|
138
|
-
**Vercel.** `npm run build:vercel` writes `.vercel/output/`. Deploy it with the
|
|
139
|
-
Vercel CLI (`vercel deploy --prebuilt`, from a project linked to Vercel). The
|
|
140
|
-
CLI is not one of this project's dependencies. Set the variables in the
|
|
141
|
-
project's environment variables.
|
|
142
|
-
|
|
143
|
-
Each page route that can be cached has a rule and tags in `astro.config.mjs`
|
|
144
|
-
(`routeRules`), served by the host's cache provider. Every one carries the
|
|
145
|
-
`pages` tag. With `
|
|
146
|
-
to `/
|
|
147
|
-
Without it, a page refreshes when its cache rule lets it.
|
|
148
|
-
|
|
149
|
-
## Studio
|
|
150
|
-
|
|
151
|
-
"Studio-ready" means
|
|
152
|
-
built with the site), frame a draft at `/
|
|
153
|
-
after a publish through `/
|
|
154
|
-
way Studio uses them, with real Ed25519 keys (`tests/unit/studio.test.ts`).
|
|
155
|
-
|
|
156
|
-
The editability tests (`tests/unit/editability.test.ts`) check the rest of what
|
|
157
|
-
Studio shows: each field reaches its component, every section starts from a
|
|
158
|
-
preset, and every preset renders for a shopper and in the editor's preview.
|
|
159
|
-
|
|
160
|
-
Every page renders the document and settings the store has saved for this
|
|
161
|
-
theme's key. When it has none, it renders the theme's defaults in
|
|
162
|
-
`src/theme/documents/` and `src/theme/settings.ts`.
|
|
163
|
-
|
|
164
|
-
## Upgrading
|
|
165
|
-
|
|
166
|
-
Update `@abcart/storefront` and `@abcart/theme` together, to the versions a
|
|
167
|
-
release pairs, as exact versions. Each package's `CHANGELOG.md`
|
|
168
|
-
(`node_modules/@
|
|
169
|
-
theme changes in its "Theme migration" section. Then run `npm run check`,
|
|
170
|
-
`npm test` and `npm run build`.
|
|
171
|
-
|
|
172
|
-
A theme release that removes a section, a field or a copy key merchants may have
|
|
173
|
-
edited is a new major version (`THEME_VERSION` and `package.json`).
|
|
174
|
-
|
|
175
|
-
## Links
|
|
176
|
-
|
|
177
|
-
The documentation is written from the SDKs and around this starter. The
|
|
178
|
-
installed declarations (`node_modules/@
|
|
179
|
-
on every name and type.
|
|
180
|
-
|
|
181
|
-
- This starter, file by file: https://docs.
|
|
182
|
-
- Make it your own: https://docs.
|
|
183
|
-
- Theme SDK: https://docs.
|
|
184
|
-
- Storefront SDK: https://docs.
|
|
1
|
+
# My Theme
|
|
2
|
+
|
|
3
|
+
An AbCart storefront theme: an Astro project for a store that sells cash on
|
|
4
|
+
delivery. It reads the store through
|
|
5
|
+
[`@abcart/storefront`](https://docs.abcart.store/sdk/storefront) and describes
|
|
6
|
+
itself to AbCart Studio through [`@abcart/theme`](https://docs.abcart.store/sdk/theme).
|
|
7
|
+
It is plain on purpose: its look is tokens, fonts and colour schemes, so it
|
|
8
|
+
takes any brand. It speaks Arabic (right to left, the default), French and English.
|
|
9
|
+
|
|
10
|
+
**Built on** `@abcart/storefront` 5.0.0 and `@abcart/theme` 5.0.0. **Needs** an
|
|
11
|
+
AbCart store on platform v9.0.0 or newer.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Node.js 22.12 or newer.
|
|
16
|
+
- An AbCart store to read: its API address and a store API key. A self-hosted
|
|
17
|
+
AbCart gives you both, and so does an AbCart Cloud store. Without a reachable
|
|
18
|
+
store, every page renders as the SDK's unavailable store
|
|
19
|
+
(`unavailableStoreConfig`): the layout and the words, with nothing to buy.
|
|
20
|
+
|
|
21
|
+
## First run
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install
|
|
25
|
+
cp .dev.vars.example .dev.vars # set COD_SERVER_URL and STORE_API_KEY
|
|
26
|
+
npm run dev # http://localhost:4321
|
|
27
|
+
npm test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Environment variables
|
|
31
|
+
|
|
32
|
+
| Name | Required | Local value | In production |
|
|
33
|
+
| --- | --- | --- | --- |
|
|
34
|
+
| `COD_SERVER_URL` | yes | `http://localhost:8787` for a store on this machine | The store's API address |
|
|
35
|
+
| `STORE_API_KEY` | yes | Your store's key | A secret on your host |
|
|
36
|
+
| `ABCART_PREVIEW_KEY` | no | Unset | Studio's Ed25519 public key (a JWK on one line). Unset, `/abcart-preview` and `/abcart-revalidate` answer 404 |
|
|
37
|
+
|
|
38
|
+
Locally they go in `.dev.vars`, which is never committed. In production they
|
|
39
|
+
are the host's secrets. The API key stays on the server.
|
|
40
|
+
|
|
41
|
+
## Project map
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
src/
|
|
45
|
+
theme/ what Studio reads
|
|
46
|
+
theme.ts the theme: pages, header and footer, settings, sections
|
|
47
|
+
key.ts the permanent theme key and the version
|
|
48
|
+
sections/ one definition per section: fields, data (load), presets
|
|
49
|
+
documents/ the layout each page starts with
|
|
50
|
+
content/ every word a shopper reads, in ar, fr and en
|
|
51
|
+
labels.ts what Studio calls each page, section, field and option
|
|
52
|
+
palette.ts the starter's colours, written once
|
|
53
|
+
settings.ts store-wide settings and the default colour schemes
|
|
54
|
+
components/ presentation; surface/ renders a page's sections
|
|
55
|
+
pages/ thin routes, plus the manifest, preview and revalidate routes
|
|
56
|
+
layouts/ StoreLayout.astro: the document head, header, footer, cart
|
|
57
|
+
lib/ server-side glue; store.ts is the only SDK client
|
|
58
|
+
scripts/ everything the browser runs
|
|
59
|
+
styles/ tokens.css is the design system; one file per area
|
|
60
|
+
middleware.ts the store, the language, redirects and preview
|
|
61
|
+
actions/ placing an order and looking one up, through the SDK
|
|
62
|
+
tests/unit/ contract, guards, design values, Studio, checkout, copy
|
|
63
|
+
.agents/skills/ three skills for coding agents (see below)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A new section is a definition in `src/theme/sections/`, a component in
|
|
67
|
+
`src/components/sections/`, its words in `src/theme/content/` and its editor
|
|
68
|
+
labels in `src/theme/labels.ts`. A new word is a copy key, never text in markup.
|
|
69
|
+
|
|
70
|
+
## The theme contract in five rules
|
|
71
|
+
|
|
72
|
+
1. **The theme key is permanent.** `THEME_KEY` names every merchant's saved
|
|
73
|
+
edits. Renaming it after a store edits the theme loses them.
|
|
74
|
+
2. **Definitions are code; documents are data.** Sections and their fields are
|
|
75
|
+
TypeScript; a page's starting layout is a JSON document.
|
|
76
|
+
3. **Sections read data only in `load`**, through `reads.get`, so a page reads
|
|
77
|
+
each thing once.
|
|
78
|
+
4. **Every string is in `src/theme/content/`**, in every language, with each
|
|
79
|
+
language's plural forms.
|
|
80
|
+
5. **Every cached page carries the `pages` tag** (the SDK's `PAGES_CACHE_TAG`),
|
|
81
|
+
so a publish in Studio shows at once.
|
|
82
|
+
|
|
83
|
+
`AGENTS.md` has the full rules, and `npm test` enforces them.
|
|
84
|
+
|
|
85
|
+
## Skills
|
|
86
|
+
|
|
87
|
+
Three skills for coding agents live in `.agents/skills/`. `AGENTS.md` says when
|
|
88
|
+
to use each:
|
|
89
|
+
|
|
90
|
+
- **`abcart-theme-from-design`**: a whole theme from a design: a screenshot, an
|
|
91
|
+
image, a live URL, or a Shopify theme measured with the collector. It builds
|
|
92
|
+
the design as tokens and sections, runs the theme to a store, and measures how
|
|
93
|
+
closely it matches.
|
|
94
|
+
- **`shopify-theme-asset-collector`**: collects a Shopify theme's public pages,
|
|
95
|
+
styles, scripts, images and fonts, with a manifest of the homepage sections.
|
|
96
|
+
The output is for measuring a design, not for shipping.
|
|
97
|
+
- **`abcart-docs`**: where each SDK name, field and platform rule is defined,
|
|
98
|
+
and the test that checks each rule.
|
|
99
|
+
|
|
100
|
+
## Make it your brand
|
|
101
|
+
|
|
102
|
+
Three places restyle the whole store:
|
|
103
|
+
|
|
104
|
+
1. **`src/styles/tokens.css`** holds every design value. Change a value there,
|
|
105
|
+
and every stylesheet that uses it follows. `npm test` rejects a literal
|
|
106
|
+
value anywhere else.
|
|
107
|
+
2. **The fonts** in `public/fonts/`: one Arabic and one Latin family, each
|
|
108
|
+
limited to its script. A new file needs its `@font-face` rule at the top of
|
|
109
|
+
`tokens.css`, its preload in `src/layouts/StoreLayout.astro`, and its licence
|
|
110
|
+
line in `public/fonts/OFL.txt`. A test checks all three.
|
|
111
|
+
3. **The starter's colours** in `src/theme/palette.ts`, which the default colour
|
|
112
|
+
schemes in `src/theme/settings.ts` use: what a store starts with before the
|
|
113
|
+
merchant picks colours in Studio.
|
|
114
|
+
|
|
115
|
+
Keep four things while restyling: colours through tokens (merchants recolour
|
|
116
|
+
sections with schemes), text readable on its band (`contrast.test.ts` checks
|
|
117
|
+
every scheme at WCAG AA), logical properties (`margin-inline-start`, never
|
|
118
|
+
`left`) for right to left, and every `name` and `data-*` attribute that the
|
|
119
|
+
order form and the scripts use.
|
|
120
|
+
|
|
121
|
+
## Commands
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
npm run dev # the dev server, against the store in .dev.vars
|
|
125
|
+
npm run check # astro check: 0 errors, 0 warnings
|
|
126
|
+
npm test # the contract, guard, design-value, contrast, rules, Studio, checkout and copy tests; no network
|
|
127
|
+
npm run build # the Cloudflare Workers build (dist/)
|
|
128
|
+
npm run preview # the Cloudflare build, served locally by Wrangler
|
|
129
|
+
npm run build:vercel # the Vercel build (.vercel/output/)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Deploying
|
|
133
|
+
|
|
134
|
+
**Cloudflare Workers.** `npm run build`, then `npx wrangler deploy`.
|
|
135
|
+
`wrangler.jsonc` holds the Worker's mechanics only: add your own routes or a
|
|
136
|
+
custom domain, and set each variable with `npx wrangler secret put <NAME>`.
|
|
137
|
+
|
|
138
|
+
**Vercel.** `npm run build:vercel` writes `.vercel/output/`. Deploy it with the
|
|
139
|
+
Vercel CLI (`vercel deploy --prebuilt`, from a project linked to Vercel). The
|
|
140
|
+
CLI is not one of this project's dependencies. Set the variables in the
|
|
141
|
+
project's environment variables.
|
|
142
|
+
|
|
143
|
+
Each page route that can be cached has a rule and tags in `astro.config.mjs`
|
|
144
|
+
(`routeRules`), served by the host's cache provider. Every one carries the
|
|
145
|
+
`pages` tag. With `ABCART_PREVIEW_KEY` set, a signed request from the platform
|
|
146
|
+
to `/abcart-revalidate` drops that tag, so a publish in Studio shows at once.
|
|
147
|
+
Without it, a page refreshes when its cache rule lets it.
|
|
148
|
+
|
|
149
|
+
## Studio
|
|
150
|
+
|
|
151
|
+
"Studio-ready" means AbCart Studio can read the manifest (`/abcart-theme.json`,
|
|
152
|
+
built with the site), frame a draft at `/abcart-preview`, and refresh the store
|
|
153
|
+
after a publish through `/abcart-revalidate`. `npm test` checks those three the
|
|
154
|
+
way Studio uses them, with real Ed25519 keys (`tests/unit/studio.test.ts`).
|
|
155
|
+
|
|
156
|
+
The editability tests (`tests/unit/editability.test.ts`) check the rest of what
|
|
157
|
+
Studio shows: each field reaches its component, every section starts from a
|
|
158
|
+
preset, and every preset renders for a shopper and in the editor's preview.
|
|
159
|
+
|
|
160
|
+
Every page renders the document and settings the store has saved for this
|
|
161
|
+
theme's key. When it has none, it renders the theme's defaults in
|
|
162
|
+
`src/theme/documents/` and `src/theme/settings.ts`.
|
|
163
|
+
|
|
164
|
+
## Upgrading
|
|
165
|
+
|
|
166
|
+
Update `@abcart/storefront` and `@abcart/theme` together, to the versions a
|
|
167
|
+
release pairs, as exact versions. Each package's `CHANGELOG.md`
|
|
168
|
+
(`node_modules/@abcart/*/CHANGELOG.md`) says which platform it needs and what a
|
|
169
|
+
theme changes in its "Theme migration" section. Then run `npm run check`,
|
|
170
|
+
`npm test` and `npm run build`.
|
|
171
|
+
|
|
172
|
+
A theme release that removes a section, a field or a copy key merchants may have
|
|
173
|
+
edited is a new major version (`THEME_VERSION` and `package.json`).
|
|
174
|
+
|
|
175
|
+
## Links
|
|
176
|
+
|
|
177
|
+
The documentation is written from the SDKs and around this starter. The
|
|
178
|
+
installed declarations (`node_modules/@abcart/*/dist/*.d.ts`) are the final word
|
|
179
|
+
on every name and type.
|
|
180
|
+
|
|
181
|
+
- This starter, file by file: https://docs.abcart.store/sdk/theme/project
|
|
182
|
+
- Make it your own: https://docs.abcart.store/sdk/theme/customize
|
|
183
|
+
- Theme SDK: https://docs.abcart.store/sdk/theme
|
|
184
|
+
- Storefront SDK: https://docs.abcart.store/sdk/storefront
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
dist/
|
|
2
|
-
node_modules/
|
|
3
|
-
.astro/
|
|
4
|
-
.wrangler/
|
|
5
|
-
.wrangler-output/
|
|
6
|
-
.dev.vars
|
|
7
|
-
.vercel/
|
|
8
|
-
.env*
|
|
9
|
-
.DS_Store
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
dist/
|
|
2
|
+
node_modules/
|
|
3
|
+
.astro/
|
|
4
|
+
.wrangler/
|
|
5
|
+
.wrangler-output/
|
|
6
|
+
.dev.vars
|
|
7
|
+
.vercel/
|
|
8
|
+
.env*
|
|
9
|
+
.DS_Store
|
|
10
|
+
|
|
11
|
+
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { defineConfig, envField, passthroughImageService } from "astro/config";
|
|
2
|
-
import { PAGES_CACHE_TAG } from "@abcart/storefront/server";
|
|
3
|
-
|
|
4
|
-
// Where the store runs: DEPLOY_TARGET names the host (Cloudflare Workers when
|
|
5
|
-
// unset), and the platform sets it when it builds. Images are plain <img> on
|
|
6
|
-
// the SDK's media-domain URLs (resized by Cloudflare on the media domain
|
|
7
|
-
// whatever the host), so every build passes images through and none ships an
|
|
8
|
-
// image library.
|
|
9
|
-
const TARGETS = {
|
|
10
|
-
cloudflare: async () => ({
|
|
11
|
-
adapter: (await import("@astrojs/cloudflare")).default({ imageService: "passthrough" }),
|
|
12
|
-
cache: (await import("@astrojs/cloudflare/cache")).cacheCloudflare(),
|
|
13
|
-
}),
|
|
14
|
-
vercel: async () => ({
|
|
15
|
-
adapter: (await import("@astrojs/vercel")).default(),
|
|
16
|
-
cache: (await import("@astrojs/vercel/cache")).cacheVercel(),
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
const deployTarget = process.env.DEPLOY_TARGET || "cloudflare";
|
|
20
|
-
if (!Object.hasOwn(TARGETS, deployTarget)) throw new Error(`DEPLOY_TARGET "${deployTarget}" is not one of: ${Object.keys(TARGETS).join(", ")}`);
|
|
21
|
-
const { adapter, cache: cacheProvider } = await TARGETS[deployTarget]();
|
|
22
|
-
|
|
23
|
-
// `astro dev` keeps its own dependency cache: `astro check` and `astro build`
|
|
24
|
-
// scan the same project and would rewrite a shared one under a running dev
|
|
25
|
-
// server, leaving open pages importing deleted files.
|
|
26
|
-
const devServer = process.argv.includes("dev");
|
|
27
|
-
|
|
28
|
-
export default defineConfig({
|
|
29
|
-
output: "server",
|
|
30
|
-
compressHTML: true,
|
|
31
|
-
session: false,
|
|
32
|
-
adapter,
|
|
33
|
-
image: {
|
|
34
|
-
service: passthroughImageService(),
|
|
35
|
-
},
|
|
36
|
-
cache: {
|
|
37
|
-
provider: cacheProvider,
|
|
38
|
-
},
|
|
39
|
-
// Every cached page carries PAGES_CACHE_TAG: a publish (pages, settings or
|
|
40
|
-
// text) changes them all, and src/pages/
|
|
41
|
-
routeRules: {
|
|
42
|
-
"/": { maxAge: 60, swr: 3600, tags: ["home", PAGES_CACHE_TAG] },
|
|
43
|
-
"/products": { maxAge: 60, swr: 3600, tags: ["products", PAGES_CACHE_TAG] },
|
|
44
|
-
"/products/[handle]": { maxAge: 60, swr: 86400, tags: ["products", PAGES_CACHE_TAG] },
|
|
45
|
-
"/collections/[handle]": { maxAge: 60, swr: 86400, tags: ["collections", PAGES_CACHE_TAG] },
|
|
46
|
-
"/category/[slug]": { maxAge: 60, swr: 86400, tags: ["categories", PAGES_CACHE_TAG] },
|
|
47
|
-
"/lp/[slug]": { maxAge: 60, swr: 86400, tags: ["landing-pages", PAGES_CACHE_TAG] },
|
|
48
|
-
"/pages/[slug]": { maxAge: 3600, swr: 604800, tags: ["legal-pages", PAGES_CACHE_TAG] },
|
|
49
|
-
"/api/communes/[wilayaId]": { maxAge: 31536000, swr: 31536000, tags: ["communes"] },
|
|
50
|
-
},
|
|
51
|
-
security: {
|
|
52
|
-
// A theme is deployed on merchant-controlled domains that are not known at
|
|
53
|
-
// build time. Actions and proxy routes still compare Origin with the request.
|
|
54
|
-
allowedDomains: [{}],
|
|
55
|
-
},
|
|
56
|
-
env: {
|
|
57
|
-
schema: {
|
|
58
|
-
COD_SERVER_URL: envField.string({ context: "server", access: "secret", optional: true }),
|
|
59
|
-
STORE_API_KEY: envField.string({ context: "server", access: "secret", optional: true }),
|
|
60
|
-
// An Ed25519 public key (JWK). Unset: the editor's preview and the
|
|
61
|
-
// revalidation route answer 404; a storefront verifies tokens, never makes them.
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
// Links prefetch only when they opt in with data-astro-prefetch.
|
|
66
|
-
prefetch: { prefetchAll: false },
|
|
67
|
-
build: {
|
|
68
|
-
inlineStylesheets: "auto",
|
|
69
|
-
},
|
|
70
|
-
devToolbar: { enabled: false },
|
|
71
|
-
vite: {
|
|
72
|
-
cacheDir: devServer ? "node_modules/.vite-dev" : undefined,
|
|
73
|
-
server: { allowedHosts: true },
|
|
74
|
-
environments: {
|
|
75
|
-
ssr: {
|
|
76
|
-
optimizeDeps: {
|
|
77
|
-
// A dependency found after boot re-bundles and races the workerd
|
|
78
|
-
// reload (withastro/astro#16933): load late finds unbundled instead.
|
|
79
|
-
noDiscovery: true,
|
|
80
|
-
exclude: ["astro/assets/services/noop", "@astrojs/cloudflare/entrypoints/server"],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
});
|
|
1
|
+
import { defineConfig, envField, passthroughImageService } from "astro/config";
|
|
2
|
+
import { PAGES_CACHE_TAG } from "@abcart/storefront/server";
|
|
3
|
+
|
|
4
|
+
// Where the store runs: DEPLOY_TARGET names the host (Cloudflare Workers when
|
|
5
|
+
// unset), and the platform sets it when it builds. Images are plain <img> on
|
|
6
|
+
// the SDK's media-domain URLs (resized by Cloudflare on the media domain
|
|
7
|
+
// whatever the host), so every build passes images through and none ships an
|
|
8
|
+
// image library.
|
|
9
|
+
const TARGETS = {
|
|
10
|
+
cloudflare: async () => ({
|
|
11
|
+
adapter: (await import("@astrojs/cloudflare")).default({ imageService: "passthrough" }),
|
|
12
|
+
cache: (await import("@astrojs/cloudflare/cache")).cacheCloudflare(),
|
|
13
|
+
}),
|
|
14
|
+
vercel: async () => ({
|
|
15
|
+
adapter: (await import("@astrojs/vercel")).default(),
|
|
16
|
+
cache: (await import("@astrojs/vercel/cache")).cacheVercel(),
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
const deployTarget = process.env.DEPLOY_TARGET || "cloudflare";
|
|
20
|
+
if (!Object.hasOwn(TARGETS, deployTarget)) throw new Error(`DEPLOY_TARGET "${deployTarget}" is not one of: ${Object.keys(TARGETS).join(", ")}`);
|
|
21
|
+
const { adapter, cache: cacheProvider } = await TARGETS[deployTarget]();
|
|
22
|
+
|
|
23
|
+
// `astro dev` keeps its own dependency cache: `astro check` and `astro build`
|
|
24
|
+
// scan the same project and would rewrite a shared one under a running dev
|
|
25
|
+
// server, leaving open pages importing deleted files.
|
|
26
|
+
const devServer = process.argv.includes("dev");
|
|
27
|
+
|
|
28
|
+
export default defineConfig({
|
|
29
|
+
output: "server",
|
|
30
|
+
compressHTML: true,
|
|
31
|
+
session: false,
|
|
32
|
+
adapter,
|
|
33
|
+
image: {
|
|
34
|
+
service: passthroughImageService(),
|
|
35
|
+
},
|
|
36
|
+
cache: {
|
|
37
|
+
provider: cacheProvider,
|
|
38
|
+
},
|
|
39
|
+
// Every cached page carries PAGES_CACHE_TAG: a publish (pages, settings or
|
|
40
|
+
// text) changes them all, and src/pages/abcart-revalidate.ts drops that tag.
|
|
41
|
+
routeRules: {
|
|
42
|
+
"/": { maxAge: 60, swr: 3600, tags: ["home", PAGES_CACHE_TAG] },
|
|
43
|
+
"/products": { maxAge: 60, swr: 3600, tags: ["products", PAGES_CACHE_TAG] },
|
|
44
|
+
"/products/[handle]": { maxAge: 60, swr: 86400, tags: ["products", PAGES_CACHE_TAG] },
|
|
45
|
+
"/collections/[handle]": { maxAge: 60, swr: 86400, tags: ["collections", PAGES_CACHE_TAG] },
|
|
46
|
+
"/category/[slug]": { maxAge: 60, swr: 86400, tags: ["categories", PAGES_CACHE_TAG] },
|
|
47
|
+
"/lp/[slug]": { maxAge: 60, swr: 86400, tags: ["landing-pages", PAGES_CACHE_TAG] },
|
|
48
|
+
"/pages/[slug]": { maxAge: 3600, swr: 604800, tags: ["legal-pages", PAGES_CACHE_TAG] },
|
|
49
|
+
"/api/communes/[wilayaId]": { maxAge: 31536000, swr: 31536000, tags: ["communes"] },
|
|
50
|
+
},
|
|
51
|
+
security: {
|
|
52
|
+
// A theme is deployed on merchant-controlled domains that are not known at
|
|
53
|
+
// build time. Actions and proxy routes still compare Origin with the request.
|
|
54
|
+
allowedDomains: [{}],
|
|
55
|
+
},
|
|
56
|
+
env: {
|
|
57
|
+
schema: {
|
|
58
|
+
COD_SERVER_URL: envField.string({ context: "server", access: "secret", optional: true }),
|
|
59
|
+
STORE_API_KEY: envField.string({ context: "server", access: "secret", optional: true }),
|
|
60
|
+
// An Ed25519 public key (JWK). Unset: the editor's preview and the
|
|
61
|
+
// revalidation route answer 404; a storefront verifies tokens, never makes them.
|
|
62
|
+
ABCART_PREVIEW_KEY: envField.string({ context: "server", access: "secret", optional: true }),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
// Links prefetch only when they opt in with data-astro-prefetch.
|
|
66
|
+
prefetch: { prefetchAll: false },
|
|
67
|
+
build: {
|
|
68
|
+
inlineStylesheets: "auto",
|
|
69
|
+
},
|
|
70
|
+
devToolbar: { enabled: false },
|
|
71
|
+
vite: {
|
|
72
|
+
cacheDir: devServer ? "node_modules/.vite-dev" : undefined,
|
|
73
|
+
server: { allowedHosts: true },
|
|
74
|
+
environments: {
|
|
75
|
+
ssr: {
|
|
76
|
+
optimizeDeps: {
|
|
77
|
+
// A dependency found after boot re-bundles and races the workerd
|
|
78
|
+
// reload (withastro/astro#16933): load late finds unbundled instead.
|
|
79
|
+
noDiscovery: true,
|
|
80
|
+
exclude: ["astro/assets/services/noop", "@astrojs/cloudflare/entrypoints/server"],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "my-
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=22.12.0"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"dev": "astro dev",
|
|
11
|
-
"build": "astro build",
|
|
12
|
-
"build:vercel": "DEPLOY_TARGET=vercel astro build",
|
|
13
|
-
"preview": "astro build && wrangler dev",
|
|
14
|
-
"check": "astro check",
|
|
15
|
-
"test": "vitest run"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@astrojs/cloudflare": "^14.3.1",
|
|
19
|
-
"@astrojs/vercel": "^11.0.16",
|
|
20
|
-
"@abcart/storefront": "^
|
|
21
|
-
"@abcart/theme": "^
|
|
22
|
-
"astro": "^7.4.2",
|
|
23
|
-
"zod": "^4.6.7"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@astrojs/check": "^0.9.4",
|
|
27
|
-
"@types/node": "^22.20.5",
|
|
28
|
-
"typescript": "^6.0.3",
|
|
29
|
-
"vitest": "^5.0.5",
|
|
30
|
-
"wrangler": "^4.125.0"
|
|
31
|
-
},
|
|
32
|
-
"overrides": {
|
|
33
|
-
"vite": "^8.2.2",
|
|
34
|
-
"@cloudflare/vite-plugin": "1.53.1"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "my-abcart-theme",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.12.0"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "astro dev",
|
|
11
|
+
"build": "astro build",
|
|
12
|
+
"build:vercel": "DEPLOY_TARGET=vercel astro build",
|
|
13
|
+
"preview": "astro build && wrangler dev",
|
|
14
|
+
"check": "astro check",
|
|
15
|
+
"test": "vitest run"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@astrojs/cloudflare": "^14.3.1",
|
|
19
|
+
"@astrojs/vercel": "^11.0.16",
|
|
20
|
+
"@abcart/storefront": "^5.0.0",
|
|
21
|
+
"@abcart/theme": "^5.0.0",
|
|
22
|
+
"astro": "^7.4.2",
|
|
23
|
+
"zod": "^4.6.7"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@astrojs/check": "^0.9.4",
|
|
27
|
+
"@types/node": "^22.20.5",
|
|
28
|
+
"typescript": "^6.0.3",
|
|
29
|
+
"vitest": "^5.0.5",
|
|
30
|
+
"wrangler": "^4.125.0"
|
|
31
|
+
},
|
|
32
|
+
"overrides": {
|
|
33
|
+
"vite": "^8.2.2",
|
|
34
|
+
"@cloudflare/vite-plugin": "1.53.1"
|
|
35
|
+
}
|
|
36
|
+
}
|