basklee-nuxt 0.8.1 → 0.9.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/README.md +34 -53
- package/package.json +2 -2
- package/src/install.mjs +2 -5
- package/src/project-readme.mjs +26 -25
- package/src/update.mjs +1 -19
- package/templates/app/components/basklee/account/AccountActivity.README.md +2 -2
- package/templates/app/components/basklee/account/AccountPromocodes.README.md +2 -2
- package/templates/app/components/basklee/account/AccountSection.README.md +2 -2
- package/templates/app/components/basklee/account/SignInHistory.README.md +2 -2
- package/templates/app/components/basklee/account/StorefrontLogout.README.md +2 -2
- package/templates/app/components/basklee/account/StorefrontProfile.README.md +10 -10
- package/templates/app/components/basklee/address/AddressForm.README.md +2 -2
- package/templates/app/components/basklee/address/StorefrontAddresses.README.md +2 -2
- package/templates/app/components/basklee/blog/BlogArticle.README.md +2 -2
- package/templates/app/components/basklee/blog/BlogCommentForm.README.md +2 -2
- package/templates/app/components/basklee/blog/BlogComments.README.md +2 -2
- package/templates/app/components/basklee/blog/StorefrontJournal.README.md +2 -2
- package/templates/app/components/basklee/cart/CartCheckoutDetails.README.md +2 -2
- package/templates/app/components/basklee/cart/CartDeliverySelector.README.md +3 -3
- package/templates/app/components/basklee/cart/CartItemOptions.README.md +3 -3
- package/templates/app/components/basklee/cart/CartLineItem.README.md +3 -3
- package/templates/app/components/basklee/cart/CartPreview.README.md +2 -2
- package/templates/app/components/basklee/cart/DeliveryMap.README.md +2 -2
- package/templates/app/components/basklee/cart/StorefrontCart.README.md +2 -2
- package/templates/app/components/basklee/catalog/StorefrontCatalog.README.md +2 -2
- package/templates/app/components/basklee/categories/StorefrontCategory.README.md +2 -2
- package/templates/app/components/basklee/contact/AboutPage.README.md +2 -2
- package/templates/app/components/basklee/contact/ContactForm.README.md +2 -2
- package/templates/app/components/basklee/contact/EmailUnsubscribe.README.md +2 -2
- package/templates/app/components/basklee/contact/StorefrontContact.README.md +2 -2
- package/templates/app/components/basklee/events/EventEnrollmentDialog.README.md +2 -2
- package/templates/app/components/basklee/legal/CookieNotice.README.md +2 -2
- package/templates/app/components/basklee/legal/StorefrontPrivacy.README.md +2 -2
- package/templates/app/components/basklee/manufacturers/ManufacturerIndex.README.md +2 -2
- package/templates/app/components/basklee/manufacturers/StorefrontManufacturers.README.md +2 -2
- package/templates/app/components/basklee/orders/OrderDetails.README.md +2 -2
- package/templates/app/components/basklee/orders/OrderPaymentForm.README.md +3 -3
- package/templates/app/components/basklee/orders/StorefrontOrders.README.md +2 -2
- package/templates/app/components/basklee/payments/PaymentPanel.README.md +3 -3
- package/templates/app/components/basklee/products/ProductCard.README.md +2 -2
- package/templates/app/components/basklee/products/ProductCardActions.README.md +2 -2
- package/templates/app/components/basklee/products/ProductPreorderDialog.README.md +2 -2
- package/templates/app/components/basklee/products/ProductReviewForm.README.md +2 -2
- package/templates/app/components/basklee/products/ProductReviewGallery.README.md +2 -2
- package/templates/app/components/basklee/products/ProductReviewImageViewer.README.md +2 -2
- package/templates/app/components/basklee/products/ProductReviews.README.md +2 -2
- package/templates/app/components/basklee/products/ProductSpecificationsDialog.README.md +2 -2
- package/templates/app/components/basklee/products/StorefrontProduct.README.md +2 -2
- package/templates/app/components/basklee/products/StorefrontWishlist.README.md +2 -2
- package/templates/app/components/basklee/promo/PromoProducts.README.md +2 -2
- package/templates/app/components/basklee/search/ProductSearchResults.README.md +2 -2
- package/templates/app/components/basklee/search/SearchFilters.vue +9 -0
- package/templates/app/components/basklee/sellers/SellerFilters.README.md +2 -2
- package/templates/app/components/basklee/sellers/SellerPhotoGallery.README.md +2 -2
- package/templates/app/components/basklee/sellers/SellerSummary.README.md +2 -2
- package/templates/app/components/basklee/sellers/StorefrontSellers.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeAvatar.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeBreadcrumbs.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeEmptyState.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeInfoHint.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleePasswordInput.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeSearchSelect.README.md +2 -2
- package/templates/app/components/basklee/shared/BaskleeSelect.README.md +2 -2
- package/templates/app/components/basklee/shared/StorefrontErrorPage.README.md +2 -2
- package/templates/app/components/basklee/shared/StorefrontPagination.README.md +2 -2
- package/templates/app/components/basklee/storefront/StorefrontAccount.README.md +1 -1
- package/templates/app/components/basklee/storefront/StorefrontFooter.README.md +4 -4
- package/templates/app/components/basklee/storefront/StorefrontHome.README.md +5 -5
- package/templates/app/components/basklee/stores/StorefrontStores.README.md +2 -2
- package/templates/app/components/basklee/subscriptions/StorefrontSubscriptions.README.md +3 -3
- package/templates/app/components/basklee/subscriptions/StorefrontTariff.README.md +2 -2
- package/templates/app/components/basklee/subscriptions/StorefrontTariffs.README.md +2 -2
- package/templates/app/components/basklee/subscriptions/SubscriptionCancelDialog.README.md +4 -4
- package/templates/app/components/basklee/subscriptions/SubscriptionChangeDialog.README.md +5 -5
- package/templates/app/components/basklee/subscriptions/SubscriptionExtendDialog.README.md +4 -4
- package/templates/app/components/basklee/subscriptions/SubscriptionPlanSummary.README.md +5 -5
- package/templates/app/components/basklee/subscriptions/SubscriptionRemoteDetails.README.md +5 -5
- package/templates/app/components/basklee/subscriptions/SubscriptionRenewalDialog.README.md +5 -5
- package/templates/app/components/basklee/support/StorefrontSupport.README.md +2 -2
- package/templates/app/components/basklee/support/TicketConversation.README.md +2 -2
- package/templates/app/components/basklee/support/TicketImage.README.md +2 -2
- package/templates/app/components/basklee/support/TicketItemCard.README.md +2 -2
- package/templates/app/components/basklee/support/TicketMessageForm.README.md +2 -2
- package/templates/app/components/basklee/support/TicketSubscriptionCard.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCard.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCardDescription.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCardFeatures.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCardImage.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCardPrices.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCardTitle.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffCards.README.md +2 -2
- package/templates/app/components/basklee/tariffs/TariffSubscriptionModal.README.md +2 -2
- package/templates/app/components/basklee/wallet/StorefrontWallet.README.md +3 -3
- package/templates/app/components/basklee/wallet/WalletTopUpForm.README.md +2 -2
- package/templates/app/interfaces/basklee/products/IProductSearchApi.ts +2 -0
- package/templates/app/interfaces/basklee/products/IProductSearchFacets.ts +2 -0
- package/templates/app/pages/product/[id].vue +6 -0
- package/templates/app/utils/basklee/browseLabels.ts +3 -0
- package/templates/app/utils/basklee/productStructuredData.ts +18 -4
- package/templates/basklee/COMPONENTS.md +58 -58
- package/src/migrate.mjs +0 -124
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The product page's schema.org data for search engines: Google merchant
|
|
2
2
|
// listings and Yandex product snippets read the same block. Every value
|
|
3
3
|
// repeats what the page shows: the price and the crossed-out old price,
|
|
4
|
-
// stock, return terms, photos, brand, seller and rating. The
|
|
5
|
-
// left out: it depends on the buyer's address.
|
|
4
|
+
// stock (or a preorder), return terms, photos, brand, seller and rating. The
|
|
5
|
+
// delivery cost is left out: it depends on the buyer's address.
|
|
6
6
|
// The same file is in the three packages; it has no imports so that it stays
|
|
7
7
|
// identical.
|
|
8
8
|
|
|
@@ -49,6 +49,12 @@ export interface StorefrontProductDataOptions {
|
|
|
49
49
|
shippingCountries: string[];
|
|
50
50
|
/** False when the page hides the seller (single-seller storefront). */
|
|
51
51
|
showSeller: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* True when the page offers a preorder instead of «Add to cart»
|
|
54
|
+
* (productAvailability().canPreorder): the offer is PreOrder, not OutOfStock.
|
|
55
|
+
* Yandex hides the price of an out-of-stock offer.
|
|
56
|
+
*/
|
|
57
|
+
preorder?: boolean;
|
|
52
58
|
/** Makes an image address complete (storefrontAbsoluteUrl). */
|
|
53
59
|
absoluteUrl: (value: string | undefined) => string | undefined;
|
|
54
60
|
}
|
|
@@ -158,8 +164,16 @@ export function storefrontProductStructuredData(
|
|
|
158
164
|
ON_SALE_STATUSES.includes(product.status?.status) &&
|
|
159
165
|
product.c_real_left > 0;
|
|
160
166
|
const returns = productReturnPolicy(product, options.shippingCountries);
|
|
161
|
-
|
|
167
|
+
// Yandex requires a brand: without a manufacturer the seller (in a
|
|
168
|
+
// single-seller storefront, the shop itself) made the product.
|
|
169
|
+
const brand =
|
|
170
|
+
product.manufacture?.name?.trim() || product.seller?.name?.trim();
|
|
162
171
|
const seller = options.showSeller ? product.seller?.name?.trim() : '';
|
|
172
|
+
const availability = inStock
|
|
173
|
+
? 'InStock'
|
|
174
|
+
: options.preorder
|
|
175
|
+
? 'PreOrder'
|
|
176
|
+
: 'OutOfStock';
|
|
163
177
|
const reviews = Number(product.feedback_stat?.c_feedbacks ?? 0);
|
|
164
178
|
const rating = Number(product.feedback_stat?.avg_raiting ?? 0);
|
|
165
179
|
const offer =
|
|
@@ -180,7 +194,7 @@ export function storefrontProductStructuredData(
|
|
|
180
194
|
},
|
|
181
195
|
}
|
|
182
196
|
: {}),
|
|
183
|
-
'availability': `${SCHEMA_ORG}${
|
|
197
|
+
'availability': `${SCHEMA_ORG}${availability}`,
|
|
184
198
|
'itemCondition': `${SCHEMA_ORG}NewCondition`,
|
|
185
199
|
...(returns ? { hasMerchantReturnPolicy: returns } : {}),
|
|
186
200
|
...(seller
|
|
@@ -61,10 +61,10 @@ for payment-method logos.
|
|
|
61
61
|
| `init.sm` | `store.init?.sm` | [SocialLinks](../app/components/basklee/social/SocialLinks.vue), also shown by [StorefrontContact](../app/components/basklee/contact/StorefrontContact.vue) |
|
|
62
62
|
| `init.is_authenticated` | `store.isAuthenticated` | [StorefrontAccount](../app/components/basklee/storefront/StorefrontAccount.vue) |
|
|
63
63
|
| `init.wallet` | `store.init?.wallet` | [WalletBalance](../app/components/basklee/wallet/WalletBalance.vue) |
|
|
64
|
-
| `init.variables` | `store.init?.variables` | [Initial counters and feature defaults](https://basklee.com/en/sandbox/appload/nuxt/init/variables); `ProductCardActions` reads preorder permission through the store |
|
|
65
|
-
| `init.default_map` | `store.init?.default_map` | [Yandex Maps shop-map integration: fallback center](https://basklee.com/en/sandbox/appload/nuxt/init/default_map) |
|
|
66
|
-
| `init.geo_location_enabled` | `store.init?.geo_location_enabled` | [Address creation: lookup from coordinates](https://basklee.com/en/sandbox/appload/nuxt/init/geo_location_enabled) |
|
|
67
|
-
| `init.public_keys` | `store.init?.public_keys` | [Yandex Maps loader: public API key](https://basklee.com/en/sandbox/appload/nuxt/init/public_keys) |
|
|
64
|
+
| `init.variables` | `store.init?.variables` | [Initial counters and feature defaults](https://docs.basklee.com/en/sandbox/appload/nuxt/init/variables); `ProductCardActions` reads preorder permission through the store |
|
|
65
|
+
| `init.default_map` | `store.init?.default_map` | [Yandex Maps shop-map integration: fallback center](https://docs.basklee.com/en/sandbox/appload/nuxt/init/default_map) |
|
|
66
|
+
| `init.geo_location_enabled` | `store.init?.geo_location_enabled` | [Address creation: lookup from coordinates](https://docs.basklee.com/en/sandbox/appload/nuxt/init/geo_location_enabled) |
|
|
67
|
+
| `init.public_keys` | `store.init?.public_keys` | [Yandex Maps loader: public API key](https://docs.basklee.com/en/sandbox/appload/nuxt/init/public_keys) |
|
|
68
68
|
|
|
69
69
|
## Components documentation
|
|
70
70
|
|
|
@@ -175,8 +175,8 @@ changes counters. Application Load supplies initial values; confirmed product
|
|
|
175
175
|
actions can override them through `store.setProductCounters`. Refresh clears
|
|
176
176
|
these overrides and uses the new response. Store reset clears all counts.
|
|
177
177
|
|
|
178
|
-
The [wishlist guide](https://basklee.com/en/sandbox/components/nuxt/wishlist-button)
|
|
179
|
-
and [cart guide](https://basklee.com/en/sandbox/components/nuxt/cart-button)
|
|
178
|
+
The [wishlist guide](https://docs.basklee.com/en/sandbox/components/nuxt/wishlist-button)
|
|
179
|
+
and [cart guide](https://docs.basklee.com/en/sandbox/components/nuxt/cart-button)
|
|
180
180
|
provide controls, events and the physical component plus its counter interface.
|
|
181
181
|
|
|
182
182
|
## Cart preview
|
|
@@ -199,7 +199,7 @@ product's `cart_counts`. The dropdown stays open after a removal and keeps its
|
|
|
199
199
|
height.
|
|
200
200
|
|
|
201
201
|
See the [component contract](../app/components/basklee/cart/CartPreview.README.md)
|
|
202
|
-
and [interactive reference](https://basklee.com/en/sandbox/components/nuxt/cart-preview).
|
|
202
|
+
and [interactive reference](https://docs.basklee.com/en/sandbox/components/nuxt/cart-preview).
|
|
203
203
|
|
|
204
204
|
## Manufacturer index
|
|
205
205
|
|
|
@@ -217,7 +217,7 @@ selection loads that manufacturer with `filters.id`. Both use
|
|
|
217
217
|
Counts use `c_manufactures`, not the number of records in each preview. The complete
|
|
218
218
|
list for a letter has its own `manufactures_manufactures_get` endpoint. See the
|
|
219
219
|
[component contract](../app/components/basklee/manufacturers/ManufacturerIndex.README.md)
|
|
220
|
-
and [interactive reference](https://basklee.com/en/sandbox/components/nuxt/manufacturer-index).
|
|
220
|
+
and [interactive reference](https://docs.basklee.com/en/sandbox/components/nuxt/manufacturer-index).
|
|
221
221
|
|
|
222
222
|
## Storefront account
|
|
223
223
|
|
|
@@ -290,7 +290,7 @@ one card; unavailable representatives are omitted. No other products are substit
|
|
|
290
290
|
and no additional request is made. `CatalogRepresentative.vue` reuses
|
|
291
291
|
`ProductCard.vue` in compact mode. The cards are centered in the menu's product
|
|
292
292
|
area and keep the same width whether a category resolves one card or two. The
|
|
293
|
-
[product card guide](https://basklee.com/en/sandbox/appload/nuxt/init/products?component=productCard)
|
|
293
|
+
[product card guide](https://docs.basklee.com/en/sandbox/appload/nuxt/init/products?component=productCard)
|
|
294
294
|
describes its variants and actions.
|
|
295
295
|
|
|
296
296
|
The component owns its `isOpen`, `branchIds`, `activeId` and `shortcutId` state.
|
|
@@ -309,7 +309,7 @@ button, before category shortcuts. It receives `close`, which closes an open
|
|
|
309
309
|
menu; call it before navigating. `StorefrontHeader` uses it for its
|
|
310
310
|
Manufacturers and Journal links.
|
|
311
311
|
|
|
312
|
-
The [catalog guide](https://basklee.com/en/sandbox/appload/nuxt/init/catalog)
|
|
312
|
+
The [catalog guide](https://docs.basklee.com/en/sandbox/appload/nuxt/init/catalog)
|
|
313
313
|
documents the fields, menu behavior and representative data sources.
|
|
314
314
|
|
|
315
315
|
## Product parts
|
|
@@ -511,7 +511,7 @@ The close button, Escape and backdrop dismiss the dialog without replacing the
|
|
|
511
511
|
card. An in-flight request may still cache its group. The catalog stays open.
|
|
512
512
|
Application Load refresh/reset clears these states and closes the dialog.
|
|
513
513
|
|
|
514
|
-
See [secondary variant selection](https://basklee.com/en/sandbox/appload/nuxt/init/products?component=productCardVariants#product-secondary-variants)
|
|
514
|
+
See [secondary variant selection](https://docs.basklee.com/en/sandbox/appload/nuxt/init/products?component=productCardVariants#product-secondary-variants)
|
|
515
515
|
for the request and interactive component reference.
|
|
516
516
|
|
|
517
517
|
### Purchase availability
|
|
@@ -616,11 +616,11 @@ storefront's `YandexMap` uses `default_map` as its fallback center and
|
|
|
616
616
|
`public_keys.map_key` to load Yandex Maps JavaScript API 2.1. Those map and address
|
|
617
617
|
components are separate integrations, outside the supplied Nuxt component set.
|
|
618
618
|
|
|
619
|
-
[`geo_location_enabled`](https://basklee.com/en/sandbox/appload/nuxt/init/geo_location_enabled)
|
|
619
|
+
[`geo_location_enabled`](https://docs.basklee.com/en/sandbox/appload/nuxt/init/geo_location_enabled)
|
|
620
620
|
indicates that a backend geocoding plugin is selected for
|
|
621
|
-
[address lookup by longitude and latitude](https://basklee.com/en/sandbox/api/address_hints_suggest_location).
|
|
622
|
-
[Address-text suggestions](https://basklee.com/en/sandbox/api/address_hints_suggest)
|
|
623
|
-
and [city-text suggestions](https://basklee.com/en/sandbox/api/address_hints_suggest_city)
|
|
621
|
+
[address lookup by longitude and latitude](https://docs.basklee.com/en/sandbox/api/address_hints_suggest_location).
|
|
622
|
+
[Address-text suggestions](https://docs.basklee.com/en/sandbox/api/address_hints_suggest)
|
|
623
|
+
and [city-text suggestions](https://docs.basklee.com/en/sandbox/api/address_hints_suggest_city)
|
|
624
624
|
depend on the plugin configured for the supplied country. The coordinate-lookup
|
|
625
625
|
flag does not control those text suggestions, browser location permission or map
|
|
626
626
|
initialization.
|
|
@@ -640,7 +640,7 @@ address card shows the country flag from `country.iso_3166_1_a2` beside the
|
|
|
640
640
|
address label, with the localized country name as its accessible label, and a
|
|
641
641
|
line with the region, city, street, house and apartment. The card opens its
|
|
642
642
|
Edit, default-delivery and Delete actions from a menu button.
|
|
643
|
-
[Customer option loading](https://basklee.com/en/sandbox/api/reload_customer_app)
|
|
643
|
+
[Customer option loading](https://docs.basklee.com/en/sandbox/api/reload_customer_app)
|
|
644
644
|
describes the country/region reload requests and their value mapping. Loading
|
|
645
645
|
those options requires a signed-in active customer. The hint endpoints also
|
|
646
646
|
require a signed-in session and must be present in current Application Load paths.
|
|
@@ -900,11 +900,11 @@ address without usable IDs shows the whole list. While the list is narrowed, a
|
|
|
900
900
|
line above the plans says so and All links to `/tariffs` without the filter.
|
|
901
901
|
Search and the `tariff`/`period` values keep working with the filter. The sign-in form on `/profile` and its steps are
|
|
902
902
|
described in the
|
|
903
|
-
[sign-in and registration API guide](https://basklee.com/en/sandbox/api/auth_signin_signup).
|
|
903
|
+
[sign-in and registration API guide](https://docs.basklee.com/en/sandbox/api/auth_signin_signup).
|
|
904
904
|
|
|
905
905
|
## Sources and styles
|
|
906
906
|
|
|
907
|
-
The [Application Load guide](https://basklee.com/en/sandbox/appload/nuxt) links every
|
|
907
|
+
The [Application Load guide](https://docs.basklee.com/en/sandbox/appload/nuxt) links every
|
|
908
908
|
field to a sandbox with editable JSON, physical TypeScript interfaces, prop
|
|
909
909
|
editors and downloadable source. Each component page shows its main component
|
|
910
910
|
and primary TypeScript interface. Downloads preserve the files installed here.
|
|
@@ -926,7 +926,7 @@ notifications can request sign-in, and subscription requires profile email. The
|
|
|
926
926
|
generated storefront supplies sign-in and personal details at `/profile`. Failed mutations retain confirmed
|
|
927
927
|
data; a failed follow-up refresh retries only that read. Components previews
|
|
928
928
|
record actions without changing the reader's cart or session. The
|
|
929
|
-
[ProductCardActions guide](https://basklee.com/en/sandbox/components/nuxt/productCardActions)
|
|
929
|
+
[ProductCardActions guide](https://docs.basklee.com/en/sandbox/components/nuxt/productCardActions)
|
|
930
930
|
also applies cart quantities and notification subscriptions to its demonstration
|
|
931
931
|
product. Its low-stock control selects `EProductStatus.LOW_STOCK` with no available
|
|
932
932
|
quantity; switching it off selects `EProductStatus.PUBLISHED` with stock. Reset
|
|
@@ -1001,7 +1001,7 @@ If AppLoad has no new products, the generated home page uses
|
|
|
1001
1001
|
`store.setHomeNewProducts(products, sellers)` stores the confirmed products and IDs.
|
|
1002
1002
|
A failed request can be retried explicitly. AppLoad refresh/reset clears the
|
|
1003
1003
|
supplemental IDs and cancels stale results. The home component itself does not
|
|
1004
|
-
request products. The [Home guide](https://basklee.com/en/sandbox/components/nuxt/home#groups)
|
|
1004
|
+
request products. The [Home guide](https://docs.basklee.com/en/sandbox/components/nuxt/home#groups)
|
|
1005
1005
|
documents the rules and lets readers edit existing products in its preview.
|
|
1006
1006
|
|
|
1007
1007
|
`productLimit` defaults to 12 per section. More reveals the rest of the
|
|
@@ -1051,26 +1051,26 @@ slot receives `section`, `productIds`, `collection`, `disabled` and the current
|
|
|
1051
1051
|
`limit`; preserve `productIds` to retain each section’s grouping. The other slots
|
|
1052
1052
|
receive no props. Slots render only when their section has data. Replacement
|
|
1053
1053
|
content owns its event bindings. Source and child guides are under
|
|
1054
|
-
[Storefront home](https://basklee.com/en/sandbox/components/nuxt/home),
|
|
1055
|
-
[Categories](https://basklee.com/en/sandbox/components/nuxt/categories),
|
|
1056
|
-
[Banners](https://basklee.com/en/sandbox/components/nuxt/banners) and
|
|
1057
|
-
[Events](https://basklee.com/en/sandbox/components/nuxt/events), with matching
|
|
1054
|
+
[Storefront home](https://docs.basklee.com/en/sandbox/components/nuxt/home),
|
|
1055
|
+
[Categories](https://docs.basklee.com/en/sandbox/components/nuxt/categories),
|
|
1056
|
+
[Banners](https://docs.basklee.com/en/sandbox/components/nuxt/banners) and
|
|
1057
|
+
[Events](https://docs.basklee.com/en/sandbox/components/nuxt/events), with matching
|
|
1058
1058
|
Russian routes. They show the physical components in their parent with dashed
|
|
1059
1059
|
highlights and link back to Application Load.
|
|
1060
1060
|
|
|
1061
1061
|
### Visual settings, search filters and blog previews
|
|
1062
1062
|
|
|
1063
|
-
[Visual settings](https://basklee.com/en/sandbox/appload/nuxt/init/visual_settings)
|
|
1063
|
+
[Visual settings](https://docs.basklee.com/en/sandbox/appload/nuxt/init/visual_settings)
|
|
1064
1064
|
are consumed by the supplied Nuxt components:
|
|
1065
1065
|
|
|
1066
|
-
- [CatalogHeader](https://basklee.com/en/sandbox/components/nuxt/catalog)
|
|
1066
|
+
- [CatalogHeader](https://docs.basklee.com/en/sandbox/components/nuxt/catalog)
|
|
1067
1067
|
uses `menu_image` for shortcut thumbnails and `catalog_menu_image` inside its catalog panel.
|
|
1068
|
-
- [ProductGroup](https://basklee.com/en/sandbox/components/nuxt/product-group)
|
|
1068
|
+
- [ProductGroup](https://docs.basklee.com/en/sandbox/components/nuxt/product-group)
|
|
1069
1069
|
becomes a swipeable row on a narrow screen. `mobile_show_arrows` controls its previous/next
|
|
1070
1070
|
buttons when the row overflows. Desktop grids and promotion carousels are unaffected.
|
|
1071
1071
|
Optional `productIds` resolves an ordered set through `store.getProduct`; an omitted
|
|
1072
1072
|
value uses the AppLoad collection, and an empty array displays no cards.
|
|
1073
|
-
- [SearchFilters](https://basklee.com/en/sandbox/components/nuxt/search-filters)
|
|
1073
|
+
- [SearchFilters](https://docs.basklee.com/en/sandbox/components/nuxt/search-filters)
|
|
1074
1074
|
uses `show_filter_counters` for counts supplied in `selects` and `variants`.
|
|
1075
1075
|
`store.preserveSearchFacets(page_data)` retains the initial options and price
|
|
1076
1076
|
bounds from `products_search`; `store.setSearchFacets` explicitly replaces them
|
|
@@ -1079,16 +1079,16 @@ are consumed by the supplied Nuxt components:
|
|
|
1079
1079
|
update products, leaving the original selectors available. `disabled` prevents
|
|
1080
1080
|
selection; there are no slots.
|
|
1081
1081
|
- `single_seller_mode` hides
|
|
1082
|
-
[ProductCardSeller](https://basklee.com/en/sandbox/components/nuxt/productCardSeller)
|
|
1082
|
+
[ProductCardSeller](https://docs.basklee.com/en/sandbox/components/nuxt/productCardSeller)
|
|
1083
1083
|
and seller filters; manufacturer options remain visible.
|
|
1084
|
-
- [BlogPostGroup](https://basklee.com/en/sandbox/components/nuxt/blog) uses
|
|
1084
|
+
- [BlogPostGroup](https://docs.basklee.com/en/sandbox/components/nuxt/blog) uses
|
|
1085
1085
|
`blog_view_type`: `EBlogViewType.PORTRAIT` is a grid, `EBlogViewType.LIST` is a list,
|
|
1086
1086
|
and `EBlogViewType.CUSTOM` starts with a lead card, followed by groups of up to
|
|
1087
1087
|
three posts. Unknown values fall back to portrait; numeric strings are accepted.
|
|
1088
1088
|
`store.setBlogPosts(page_data.posts.data)` supplies previews from `blog_posts_get`.
|
|
1089
1089
|
The supplied journal requests as many posts per page as each layout needs to
|
|
1090
1090
|
fill complete rows.
|
|
1091
|
-
[BlogPostCard](https://basklee.com/en/sandbox/components/nuxt/blog-post) takes
|
|
1091
|
+
[BlogPostCard](https://docs.basklee.com/en/sandbox/components/nuxt/blog-post) takes
|
|
1092
1092
|
`postId`, `layout` (portrait by default, list or hero) and optional
|
|
1093
1093
|
`articlePath`, reads the post from the store, and shows its first ordered image
|
|
1094
1094
|
in a reserved area, date, reading time, localized title and plain-text preview.
|
|
@@ -1105,7 +1105,7 @@ AppLoad refresh and reset clear search facets, selected filters and blog posts.
|
|
|
1105
1105
|
The generated `/browse?q=...` page loads public responses through endpoint
|
|
1106
1106
|
discovery and handles pending/error/retry states and pagination; `/browse?view=blog`
|
|
1107
1107
|
redirects to `/journal`, which loads posts with `blog_posts_get`.
|
|
1108
|
-
[StorefrontJournal](https://basklee.com/en/sandbox/components/nuxt/journal)
|
|
1108
|
+
[StorefrontJournal](https://docs.basklee.com/en/sandbox/components/nuxt/journal)
|
|
1109
1109
|
filters by categories and authors in a right-hand column (a Filters toggle on
|
|
1110
1110
|
narrow screens), sends `filters.categories` and `filters.writers`, keeps the
|
|
1111
1111
|
list page in the URL `page` query and links cards to `/journal/<id>`. The
|
|
@@ -1115,7 +1115,7 @@ list loads in the browser, placeholder cards in the configured layout keep the
|
|
|
1115
1115
|
list's place. Blog
|
|
1116
1116
|
images and videos under `/ps3/blog/...` load through the storefront gateway.
|
|
1117
1117
|
The article page `/journal/<id>` renders
|
|
1118
|
-
[BlogArticle](https://basklee.com/en/sandbox/components/nuxt/blog-article).
|
|
1118
|
+
[BlogArticle](https://docs.basklee.com/en/sandbox/components/nuxt/blog-article).
|
|
1119
1119
|
The page loads the article during the server render and passes it to
|
|
1120
1120
|
`initialPost`, so the HTML contains the title, the text as plain paragraphs and
|
|
1121
1121
|
the related products; the formatted text replaces the paragraphs in the
|
|
@@ -1140,7 +1140,7 @@ colors and font styles. External links open in a new tab with
|
|
|
1140
1140
|
`rel="noopener noreferrer"`; editor links to other articles open
|
|
1141
1141
|
`/journal/<id>`; formulas show their LaTeX source; frames, scripts, forms and
|
|
1142
1142
|
event attributes are removed.
|
|
1143
|
-
[BlogComments](https://basklee.com/en/sandbox/components/nuxt/blog-comments)
|
|
1143
|
+
[BlogComments](https://docs.basklee.com/en/sandbox/components/nuxt/blog-comments)
|
|
1144
1144
|
pages through root comments (`show_only_main`) and loads the replies of every
|
|
1145
1145
|
shown comment with `filters.parent`, a page at a time and level by level, so
|
|
1146
1146
|
each reply sits directly beneath the comment it answers. Indentation
|
|
@@ -1197,14 +1197,14 @@ The category uses `grid`, which stays a vertical grid on a narrow screen and
|
|
|
1197
1197
|
shows no horizontal scroll arrows. Filters collapse behind a button in a narrow
|
|
1198
1198
|
result container; category navigation remains available while products load.
|
|
1199
1199
|
|
|
1200
|
-
The [Category page guide](https://basklee.com/en/sandbox/components/nuxt/category-page)
|
|
1200
|
+
The [Category page guide](https://docs.basklee.com/en/sandbox/components/nuxt/category-page)
|
|
1201
1201
|
contains the physical composition, dashed child boundaries, local preview
|
|
1202
1202
|
controls, field/input/event contracts and exact component/interface downloads.
|
|
1203
1203
|
The matching Russian guide uses `/ru/sandbox/components/nuxt/category-page`.
|
|
1204
1204
|
|
|
1205
1205
|
## Search, logout and preorder flows
|
|
1206
1206
|
|
|
1207
|
-
The [search results component](https://basklee.com/en/sandbox/components/nuxt/search-results)
|
|
1207
|
+
The [search results component](https://docs.basklee.com/en/sandbox/components/nuxt/search-results)
|
|
1208
1208
|
serves `/browse?q=...` and the category result area. The `/browse`,
|
|
1209
1209
|
`/featured` and `/category/:id` pages load the first result page during the
|
|
1210
1210
|
server render with `loadProductSearchSnapshot()` and pass it to
|
|
@@ -1288,7 +1288,7 @@ counts describe the initial scope, not the narrowed result. Product grids use
|
|
|
1288
1288
|
fewer columns as the container narrows. Mobile home
|
|
1289
1289
|
rows retain their existing swipe behavior.
|
|
1290
1290
|
|
|
1291
|
-
The [preorder dialog](https://basklee.com/en/sandbox/components/nuxt/preorder-dialog)
|
|
1291
|
+
The [preorder dialog](https://docs.basklee.com/en/sandbox/components/nuxt/preorder-dialog)
|
|
1292
1292
|
is `app/components/basklee/products/ProductPreorderDialog.vue`, nested under
|
|
1293
1293
|
Product actions in Components. The default layout opens it for the card's
|
|
1294
1294
|
`preorder` event. It shows the product and price; guests provide email or phone.
|
|
@@ -1298,7 +1298,7 @@ Pending requests disable resubmission and dismissal. Errors remain by the form.
|
|
|
1298
1298
|
`modal` defaults to true; false renders the same dialog within its container.
|
|
1299
1299
|
Both storefront and documentation product previews use this physical component.
|
|
1300
1300
|
|
|
1301
|
-
The [sign-out component](https://basklee.com/en/sandbox/components/nuxt/logout)
|
|
1301
|
+
The [sign-out component](https://docs.basklee.com/en/sandbox/components/nuxt/logout)
|
|
1302
1302
|
is `app/components/basklee/account/StorefrontLogout.vue`, under Profile menu.
|
|
1303
1303
|
The default layout opens `/logout` after `signOut`. The route shows progress,
|
|
1304
1304
|
uses `profile_logout` through the shared API client after mounting, refreshes
|
|
@@ -1326,8 +1326,8 @@ beside the page title. Logout is the last item of the account menu. Account requ
|
|
|
1326
1326
|
shared named API client, which sends the selected storefront language as `lang`;
|
|
1327
1327
|
registration saves it as the account's initial email-notification language.
|
|
1328
1328
|
Avatar upload uses multipart. Data changes only after confirmation. See the
|
|
1329
|
-
[profile guide](https://basklee.com/en/sandbox/components/nuxt/profile)
|
|
1330
|
-
and its [Russian version](https://basklee.com/ru/sandbox/components/nuxt/profile).
|
|
1329
|
+
[profile guide](https://docs.basklee.com/en/sandbox/components/nuxt/profile)
|
|
1330
|
+
and its [Russian version](https://docs.basklee.com/ru/sandbox/components/nuxt/profile).
|
|
1331
1331
|
|
|
1332
1332
|
The avatar opens the profile beside the customer's name. Square icon buttons
|
|
1333
1333
|
below it choose a file (camera: “Choose a photo”, or “Change photo” when a photo exists)
|
|
@@ -1337,7 +1337,7 @@ sign-in/registration and in the account password form, is
|
|
|
1337
1337
|
[`BaskleePasswordInput.vue`](../app/components/basklee/shared/BaskleePasswordInput.vue):
|
|
1338
1338
|
an eye button inside the field shows or hides the password, with
|
|
1339
1339
|
`aria-pressed`, “Show password” / “Hide password” labels and no form
|
|
1340
|
-
submission. See the [password field guide](https://basklee.com/en/sandbox/components/nuxt/password-input).
|
|
1340
|
+
submission. See the [password field guide](https://docs.basklee.com/en/sandbox/components/nuxt/password-input).
|
|
1341
1341
|
|
|
1342
1342
|
Lists, histories and search results with no items show
|
|
1343
1343
|
[`BaskleeEmptyState.vue`](../app/components/basklee/shared/BaskleeEmptyState.vue):
|
|
@@ -1345,7 +1345,7 @@ a monochrome line drawing chosen by `kind` (for example `reviews`, `orders`,
|
|
|
1345
1345
|
`wishlist`, `search`, `addresses`, `tickets`, `wallet`), the existing message,
|
|
1346
1346
|
an optional second line and an optional `actions` slot. The drawing uses theme
|
|
1347
1347
|
colors, is hidden from screen readers and adds no grey panel. See the
|
|
1348
|
-
[empty state guide](https://basklee.com/en/sandbox/components/nuxt/empty-state).
|
|
1348
|
+
[empty state guide](https://docs.basklee.com/en/sandbox/components/nuxt/empty-state).
|
|
1349
1349
|
|
|
1350
1350
|
Review authors and the current user in the review form are shown with
|
|
1351
1351
|
[`BaskleeAvatar.vue`](../app/components/basklee/shared/BaskleeAvatar.vue):
|
|
@@ -1354,7 +1354,7 @@ a round photo from `src` (`user.logo` in reviews and replies,
|
|
|
1354
1354
|
when the photo is missing or does not load. When a guest reacts to, replies to
|
|
1355
1355
|
or writes a review, the component opens `/profile` at once, returning to the
|
|
1356
1356
|
product page after sign-in.
|
|
1357
|
-
See the [avatar guide](https://basklee.com/en/sandbox/components/nuxt/avatar).
|
|
1357
|
+
See the [avatar guide](https://docs.basklee.com/en/sandbox/components/nuxt/avatar).
|
|
1358
1358
|
|
|
1359
1359
|
The path to the page being read is
|
|
1360
1360
|
[`BaskleeBreadcrumbs.vue`](../app/components/basklee/shared/BaskleeBreadcrumbs.vue):
|
|
@@ -1368,7 +1368,7 @@ at the storefront home page and the product itself. On narrow screens the path
|
|
|
1368
1368
|
wraps onto more lines instead of scrolling sideways, and nothing is collapsed;
|
|
1369
1369
|
while the product loads, the same row holds placeholder bars so the content
|
|
1370
1370
|
below keeps its place. See the
|
|
1371
|
-
[path guide](https://basklee.com/en/sandbox/components/nuxt/breadcrumbs).
|
|
1371
|
+
[path guide](https://docs.basklee.com/en/sandbox/components/nuxt/breadcrumbs).
|
|
1372
1372
|
|
|
1373
1373
|
A term that needs a sentence of its own explanation carries
|
|
1374
1374
|
[`BaskleeInfoHint.vue`](../app/components/basklee/shared/BaskleeInfoHint.vue):
|
|
@@ -1378,7 +1378,7 @@ for screen readers and for the button itself. The hint opens above the button
|
|
|
1378
1378
|
when there is not enough room below and to the left when its width would leave
|
|
1379
1379
|
the window; it sends no request and changes nothing. The plan cards use it for
|
|
1380
1380
|
the modules and limits of a subscription plan. See the
|
|
1381
|
-
[hint guide](https://basklee.com/en/sandbox/components/nuxt/info-hint).
|
|
1381
|
+
[hint guide](https://docs.basklee.com/en/sandbox/components/nuxt/info-hint).
|
|
1382
1382
|
|
|
1383
1383
|
The product page
|
|
1384
1384
|
[`StorefrontProduct.vue`](../app/components/basklee/products/StorefrontProduct.vue)
|
|
@@ -1418,7 +1418,7 @@ page layout keeps the page height and the section is marked `aria-busy`. A
|
|
|
1418
1418
|
with the complete seller or staff preview address view the key owner's product
|
|
1419
1419
|
without signing in. The same responsive layout shows a preview notice for unpublished
|
|
1420
1420
|
and option-only products, and the page uses `noindex, nofollow`. See the
|
|
1421
|
-
[product guide](https://basklee.com/en/sandbox/components/nuxt/product).
|
|
1421
|
+
[product guide](https://docs.basklee.com/en/sandbox/components/nuxt/product).
|
|
1422
1422
|
|
|
1423
1423
|
[`ProductReviews.vue`](../app/components/basklee/products/ProductReviews.vue)
|
|
1424
1424
|
keeps a readable maximum width. On the product page, `stats` from the first
|
|
@@ -1439,7 +1439,7 @@ only border. A new review of the product keeps its
|
|
|
1439
1439
|
place above the list. A review needs 1–5 stars: nothing is preselected, a
|
|
1440
1440
|
submit without stars shows the message under the stars instead of sending, and
|
|
1441
1441
|
Basklee's `rating` error appears there too; a reply has no stars and sends 0. See the
|
|
1442
|
-
[reviews guide](https://basklee.com/en/sandbox/components/nuxt/product-reviews).
|
|
1442
|
+
[reviews guide](https://docs.basklee.com/en/sandbox/components/nuxt/product-reviews).
|
|
1443
1443
|
|
|
1444
1444
|
The seller page `/sellers?seller=<id>` renders the same component with
|
|
1445
1445
|
`sellerId`: `products_view_feedbacks_feedback_get` receives
|
|
@@ -1460,7 +1460,7 @@ Home. Home and Catalog call `clearError` with the current `locale`. Labels use t
|
|
|
1460
1460
|
keeps the header and footer when Application Load succeeded; a failed Application
|
|
1461
1461
|
Load and failure statuses render without the layout. Error pages use
|
|
1462
1462
|
`noindex, nofollow` and never show error messages or stack traces. See the
|
|
1463
|
-
[error page guide](https://basklee.com/en/sandbox/components/nuxt/error-page).
|
|
1463
|
+
[error page guide](https://docs.basklee.com/en/sandbox/components/nuxt/error-page).
|
|
1464
1464
|
|
|
1465
1465
|
`app/composables/useBaskleeMissingPage.ts` opens this page for the product
|
|
1466
1466
|
page `/product/:id` and the article page `/journal/:id`: HTTP 503 when
|
|
@@ -1511,7 +1511,7 @@ the top loading bar from `app/app.vue` and a visually hidden `role="status"`
|
|
|
1511
1511
|
message instead of a status strip. Field errors stay as red text beside their inputs. Required fields show a
|
|
1512
1512
|
red `*` directly after the label text.
|
|
1513
1513
|
|
|
1514
|
-
The default layout renders the [footer](https://basklee.com/en/sandbox/components/nuxt/footer)
|
|
1514
|
+
The default layout renders the [footer](https://docs.basklee.com/en/sandbox/components/nuxt/footer)
|
|
1515
1515
|
with real store categories, home-section anchors, profile/journal navigation,
|
|
1516
1516
|
a contact-page link, a `/privacy` link and social links. On `/contact`, `StorefrontContact` places
|
|
1517
1517
|
company details (address, `tel:` phone link, registration numbers with copy
|
|
@@ -1700,8 +1700,8 @@ A failed reload blocks further changes until Refresh succeeds.
|
|
|
1700
1700
|
|
|
1701
1701
|
The [component contract](../app/components/basklee/cart/CartCheckoutDetails.README.md)
|
|
1702
1702
|
lists the request fields, nullable values, errors and delivery consequences.
|
|
1703
|
-
The [English guide](https://basklee.com/en/sandbox/components/nuxt/cart-checkout-details#behavior)
|
|
1704
|
-
and [Russian guide](https://basklee.com/ru/sandbox/components/nuxt/cart-checkout-details#behavior)
|
|
1703
|
+
The [English guide](https://docs.basklee.com/en/sandbox/components/nuxt/cart-checkout-details#behavior)
|
|
1704
|
+
and [Russian guide](https://docs.basklee.com/ru/sandbox/components/nuxt/cart-checkout-details#behavior)
|
|
1705
1705
|
explain each response field and customer action.
|
|
1706
1706
|
|
|
1707
1707
|
`CartCheckoutDetails` shows the cart's delivery address in both cart steps.
|
|
@@ -1978,13 +1978,13 @@ The API response tables also explain the following contracts / Таблицы о
|
|
|
1978
1978
|
|
|
1979
1979
|
| API | Contract / Контракт |
|
|
1980
1980
|
| --- | --- |
|
|
1981
|
-
| [cart_guest_get](https://basklee.com/en/sandbox/api/cart_guest_get) · [RU](https://basklee.com/ru/sandbox/api/cart_guest_get) | Checkout options and saved choices / Опции оформления и сохранённый выбор |
|
|
1982
|
-
| [invoices_get](https://basklee.com/en/sandbox/api/invoices_get) · [RU](https://basklee.com/ru/sandbox/api/invoices_get) | Transaction direction and refunds / Направление платежей и возвраты |
|
|
1983
|
-
| [subscriptions_get](https://basklee.com/en/sandbox/api/subscriptions_get) · [RU](https://basklee.com/ru/sandbox/api/subscriptions_get) | Subscription state, renewal and service data / Состояние подписки, продление и данные сервиса |
|
|
1984
|
-
| [profile_promocodes_get](https://basklee.com/en/sandbox/api/profile_promocodes_get) · [RU](https://basklee.com/ru/sandbox/api/profile_promocodes_get) | Issued codes and promotion conditions / Выданные коды и условия акций |
|
|
1985
|
-
| [orders_create](https://basklee.com/en/sandbox/api/orders_create) · [RU](https://basklee.com/ru/sandbox/api/orders_create) | Failure fields and recovery / Поля ошибок и исправление |
|
|
1986
|
-
| [profile_orders_get](https://basklee.com/en/sandbox/api/profile_orders_get) · [RU](https://basklee.com/ru/sandbox/api/profile_orders_get) | Ordered options, returns and downloads / Купленные опции, возвраты и загрузки |
|
|
1987
|
-
| [subscriptions_guest_search](https://basklee.com/en/sandbox/api/subscriptions_guest_search) · [RU](https://basklee.com/ru/sandbox/api/subscriptions_guest_search) | Plan parameters, units and headings / Параметры тарифа, единицы и подписи |
|
|
1981
|
+
| [cart_guest_get](https://docs.basklee.com/en/sandbox/api/cart_guest_get) · [RU](https://docs.basklee.com/ru/sandbox/api/cart_guest_get) | Checkout options and saved choices / Опции оформления и сохранённый выбор |
|
|
1982
|
+
| [invoices_get](https://docs.basklee.com/en/sandbox/api/invoices_get) · [RU](https://docs.basklee.com/ru/sandbox/api/invoices_get) | Transaction direction and refunds / Направление платежей и возвраты |
|
|
1983
|
+
| [subscriptions_get](https://docs.basklee.com/en/sandbox/api/subscriptions_get) · [RU](https://docs.basklee.com/ru/sandbox/api/subscriptions_get) | Subscription state, renewal and service data / Состояние подписки, продление и данные сервиса |
|
|
1984
|
+
| [profile_promocodes_get](https://docs.basklee.com/en/sandbox/api/profile_promocodes_get) · [RU](https://docs.basklee.com/ru/sandbox/api/profile_promocodes_get) | Issued codes and promotion conditions / Выданные коды и условия акций |
|
|
1985
|
+
| [orders_create](https://docs.basklee.com/en/sandbox/api/orders_create) · [RU](https://docs.basklee.com/ru/sandbox/api/orders_create) | Failure fields and recovery / Поля ошибок и исправление |
|
|
1986
|
+
| [profile_orders_get](https://docs.basklee.com/en/sandbox/api/profile_orders_get) · [RU](https://docs.basklee.com/ru/sandbox/api/profile_orders_get) | Ordered options, returns and downloads / Купленные опции, возвраты и загрузки |
|
|
1987
|
+
| [subscriptions_guest_search](https://docs.basklee.com/en/sandbox/api/subscriptions_guest_search) · [RU](https://docs.basklee.com/ru/sandbox/api/subscriptions_guest_search) | Plan parameters, units and headings / Параметры тарифа, единицы и подписи |
|
|
1988
1988
|
|
|
1989
1989
|
## Cart loading / Загрузка корзины
|
|
1990
1990
|
|
package/src/migrate.mjs
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// Projects made before the rename to Basklee (2026-11) use the orionplace-<framework> package, the orionplace/
|
|
2
|
-
// folders, Orionplace* names and ORIONPLACE_* settings. update renames them in the project's own files first, so
|
|
3
|
-
// the template update that follows sees an ordinary Basklee project. Domains *.orionplace.app keep their name.
|
|
4
|
-
import { createHash } from 'node:crypto';
|
|
5
|
-
import { existsSync } from 'node:fs';
|
|
6
|
-
import { mkdir, readdir, readFile, rm, rmdir, stat, writeFile } from 'node:fs/promises';
|
|
7
|
-
import { dirname, join, relative, sep } from 'node:path';
|
|
8
|
-
|
|
9
|
-
const OLD_DIR = 'orionplace';
|
|
10
|
-
const SKIP_DIRS = new Set(['node_modules', '.git', '.nuxt', '.output', '.next', '.svelte-kit', '.vercel', '.netlify',
|
|
11
|
-
'dist', 'build', '.gradle', '.cache', '.turbo']);
|
|
12
|
-
const MAX_BYTES = 5 * 1024 * 1024;
|
|
13
|
-
const RULES = [
|
|
14
|
-
[/Orion ?Marketplace(?!\.app\b)/g, 'Basklee'], // the product's old name in comments copied from the templates
|
|
15
|
-
[/ORIONPLACE(?!\.APP\b)/g, 'BASKLEE'],
|
|
16
|
-
[/Orionplace(?!\.app\b)/g, 'Basklee'],
|
|
17
|
-
[/orionplace(?!\.app\b)/g, 'basklee'],
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const hash = (text) => createHash('sha256').update(text).digest('hex');
|
|
21
|
-
const rename = (text) => RULES.reduce((out, [re, to]) => out.replace(re, to), text);
|
|
22
|
-
const toPosix = (path) => path.split(sep).join('/');
|
|
23
|
-
|
|
24
|
-
async function isLegacy(root) {
|
|
25
|
-
if (existsSync(join(root, OLD_DIR, '.generated.json'))) return true;
|
|
26
|
-
try {
|
|
27
|
-
const pkg = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
|
|
28
|
-
return Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).some((name) => /^orionplace-(nuxt|react|svelte)$/.test(name));
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function walk(root, dir = root, files = []) {
|
|
35
|
-
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
36
|
-
if (entry.isDirectory()) {
|
|
37
|
-
if (SKIP_DIRS.has(entry.name) || entry.name.startsWith('.basklee-backup-')) continue;
|
|
38
|
-
await walk(root, join(dir, entry.name), files);
|
|
39
|
-
} else if (entry.isFile()) {
|
|
40
|
-
files.push(toPosix(relative(root, join(dir, entry.name))));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return files;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Renames an old project in place. Returns null for a project that needs nothing, else
|
|
48
|
-
* { files, moved, backup, dependency } — with dryRun nothing is written.
|
|
49
|
-
* version: the version of the new package written into package.json.
|
|
50
|
-
*/
|
|
51
|
-
export async function migrateLegacyProject({ cwd, dryRun = false, packageName, version }) {
|
|
52
|
-
if (!(await isLegacy(cwd))) return null;
|
|
53
|
-
const changes = new Map(); // old relative path -> { to, content (string | Buffer), changed }
|
|
54
|
-
for (const path of await walk(cwd)) {
|
|
55
|
-
const to = path.split('/').map(rename).join('/');
|
|
56
|
-
const info = await stat(join(cwd, path));
|
|
57
|
-
let content = null;
|
|
58
|
-
if (info.size <= MAX_BYTES) {
|
|
59
|
-
const buf = await readFile(join(cwd, path));
|
|
60
|
-
if (!buf.subarray(0, 8000).includes(0)) {
|
|
61
|
-
const text = buf.toString('utf8');
|
|
62
|
-
const next = rename(text);
|
|
63
|
-
if (next !== text) content = next;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (to !== path || content !== null) changes.set(path, { to, content });
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Generated-file record: a file still equal to what the package wrote stays "unchanged" after the rename, so the
|
|
70
|
-
// template update may replace it; a file the owner edited stays edited.
|
|
71
|
-
const oldRecord = join(OLD_DIR, '.generated.json');
|
|
72
|
-
if (existsSync(join(cwd, oldRecord))) {
|
|
73
|
-
const previous = JSON.parse(await readFile(join(cwd, oldRecord), 'utf8'));
|
|
74
|
-
const record = {};
|
|
75
|
-
for (const [name, sum] of Object.entries(previous)) {
|
|
76
|
-
const newName = name.split('/').map(rename).join('/');
|
|
77
|
-
let current = null;
|
|
78
|
-
try { current = await readFile(join(cwd, name), 'utf8'); } catch { /* removed by the owner */ }
|
|
79
|
-
record[newName] = current !== null && hash(current) === sum ? hash(rename(current)) : sum;
|
|
80
|
-
}
|
|
81
|
-
changes.set(oldRecord, { to: rename(oldRecord), content: JSON.stringify(record, null, 2) + '\n' });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// package.json: the new package at the running version (the old pin names a version the new package lacks).
|
|
85
|
-
const pkgPath = 'package.json';
|
|
86
|
-
if (existsSync(join(cwd, pkgPath))) {
|
|
87
|
-
const text = changes.get(pkgPath)?.content ?? await readFile(join(cwd, pkgPath), 'utf8');
|
|
88
|
-
const pkg = JSON.parse(text);
|
|
89
|
-
for (const field of ['dependencies', 'devDependencies']) {
|
|
90
|
-
if (pkg[field]?.[packageName] !== undefined && version) pkg[field][packageName] = version;
|
|
91
|
-
}
|
|
92
|
-
changes.set(pkgPath, { to: pkgPath, content: JSON.stringify(pkg, null, 2) + '\n' });
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const files = [...changes].filter(([, c]) => c.content !== null).map(([from, c]) => c.to === from ? from : `${from} -> ${c.to}`);
|
|
96
|
-
const moved = [...changes].filter(([from, c]) => c.to !== from).length;
|
|
97
|
-
const backup = `.basklee-backup-${new Date().toISOString().replace(/[-:]/g, '').slice(0, 15)}`;
|
|
98
|
-
if (dryRun) return { files, moved, backup: null, dependency: `${packageName}@${version}` };
|
|
99
|
-
|
|
100
|
-
// Backup of every file the migration touches, at its old path.
|
|
101
|
-
for (const [from] of changes) {
|
|
102
|
-
const target = join(cwd, backup, from);
|
|
103
|
-
await mkdir(dirname(target), { recursive: true });
|
|
104
|
-
await writeFile(target, await readFile(join(cwd, from)));
|
|
105
|
-
}
|
|
106
|
-
for (const [from, { to, content }] of changes) {
|
|
107
|
-
const source = join(cwd, from);
|
|
108
|
-
const target = join(cwd, to);
|
|
109
|
-
const data = content ?? await readFile(source);
|
|
110
|
-
await mkdir(dirname(target), { recursive: true });
|
|
111
|
-
await writeFile(target, data, { mode: (await stat(source)).mode });
|
|
112
|
-
if (to !== from) await rm(source);
|
|
113
|
-
}
|
|
114
|
-
// Folders left empty by the moves (deepest first).
|
|
115
|
-
const dirs = new Set();
|
|
116
|
-
for (const [from, { to }] of changes) {
|
|
117
|
-
if (to === from) continue;
|
|
118
|
-
for (let dir = dirname(from); dir !== '.'; dir = dirname(dir)) dirs.add(dir);
|
|
119
|
-
}
|
|
120
|
-
for (const dir of [...dirs].sort((a, b) => b.split('/').length - a.split('/').length)) {
|
|
121
|
-
try { await rmdir(join(cwd, dir)); } catch { /* not empty: holds files the migration did not move */ }
|
|
122
|
-
}
|
|
123
|
-
return { files, moved, backup, dependency: `${packageName}@${version}` };
|
|
124
|
-
}
|