orionplace-svelte 0.5.0 → 0.6.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.
Files changed (31) hide show
  1. package/README.md +10 -1
  2. package/bin/orionplace-svelte.mjs +7 -0
  3. package/package.json +1 -1
  4. package/runtime/marketplace.d.mts +97 -0
  5. package/runtime/marketplace.mjs +519 -3
  6. package/src/project-readme.mjs +23 -2
  7. package/src/setup.mjs +1 -0
  8. package/src/sitemap.mjs +93 -0
  9. package/templates/src/hooks.server.ts +16 -2
  10. package/templates/src/lib/components/orionplace/account/ProfileDetailsForm.README.md +2 -0
  11. package/templates/src/lib/components/orionplace/account/ProfileDetailsForm.svelte +12 -2
  12. package/templates/src/lib/components/orionplace/cart/CartCheckoutDetails.README.md +4 -0
  13. package/templates/src/lib/components/orionplace/cart/CartCheckoutDetails.svelte +20 -9
  14. package/templates/src/lib/components/orionplace/catalog/StorefrontCatalog.svelte +2 -2
  15. package/templates/src/lib/composables/useOrionplacePageSeo.svelte.ts +31 -6
  16. package/templates/src/lib/composables/useOrionplaceProductSearch.svelte.ts +130 -11
  17. package/templates/src/lib/interfaces/orionplace/accounts/IProfileData.ts +2 -0
  18. package/templates/src/lib/interfaces/orionplace/appBase/IApploadUserProfile.ts +2 -0
  19. package/templates/src/lib/layouts/StorefrontPageHead.svelte +9 -0
  20. package/templates/src/lib/orionplace/navigation.svelte.ts +10 -2
  21. package/templates/src/lib/orionplace/pageLoad.ts +11 -1
  22. package/templates/src/lib/utils/orionplace/cartLabels.ts +2 -0
  23. package/templates/src/lib/utils/orionplace/pageSeo.ts +68 -0
  24. package/templates/src/lib/utils/orionplace/productListLocation.ts +130 -0
  25. package/templates/src/lib/utils/orionplace/profile.ts +12 -0
  26. package/templates/src/lib/utils/orionplace/profileLabels.ts +2 -0
  27. package/templates/src/routes/browse/+page.svelte +8 -1
  28. package/templates/src/routes/category/[id]/+page.svelte +12 -4
  29. package/templates/src/routes/featured/+page.svelte +10 -3
  30. package/templates/src/routes/robots.txt/+server.ts +9 -0
  31. package/templates/src/routes/sitemap.xml/+server.ts +10 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@ account, journal and support, in English and Russian. The package includes a
8
8
  setup CLI and the full storefront source, so every page and component in your
9
9
  project is yours to change.
10
10
 
11
- - **Setup CLI:** `init`, `set backend`, `add frontend`, `set mimic` and `update`.
11
+ - **Setup CLI:** `init`, `set backend`, `add frontend`, `set mimic`, `sitemap rebuild` and `update`.
12
12
  - **Server install:** `install` builds the storefront on your Linux server and
13
13
  runs it as a system service behind nginx with HTTPS.
14
14
  - **API gateway:** the browser calls `/api/...` on your own domain; the server
@@ -325,6 +325,8 @@ npx orionplace-svelte add frontend shop.example.com
325
325
  npx orionplace-svelte add frontend www.shop.example.com
326
326
  npx orionplace-svelte remove frontend www.shop.example.com
327
327
  npx orionplace-svelte set mimic shop.example.com
328
+ npx orionplace-svelte sitemap rebuild [shop.example.com]
329
+ npx orionplace-svelte sitemap status
328
330
  sudo npx orionplace-svelte install
329
331
  npx orionplace-svelte status
330
332
  sudo npx orionplace-svelte restart
@@ -341,8 +343,15 @@ npm run orionplace:remove-frontend -- www.shop.example.com
341
343
  npm run orionplace:mimic -- shop.example.com
342
344
  npm run orionplace:help
343
345
  npm run orionplace:update
346
+ npm run orionplace:sitemap
344
347
  ```
345
348
 
349
+ The storefront serves `/robots.txt` and `/sitemap.xml` (public pages, categories,
350
+ products and journal publications in every language). The sitemap is rebuilt
351
+ from the backend once an hour; `npm run orionplace:sitemap` rebuilds it at once,
352
+ for example after new publications, and the running storefront serves it without
353
+ a restart.
354
+
346
355
  `npm set` belongs to npm's own configuration system; use the commands above.
347
356
  The setup commands configure local integration files. They do not provision a
348
357
  backend, change your account or create DNS records. `install` deploys the
@@ -3,6 +3,7 @@ import { setupProject } from '../src/setup.mjs';
3
3
  import { updateProject } from '../src/update.mjs';
4
4
  import { installService } from '../src/install.mjs';
5
5
  import { SERVICE_ACTIONS, SERVICE_ALIASES, controlService, findApp, printService } from '../src/service.mjs';
6
+ import { sitemapCommand } from '../src/sitemap.mjs';
6
7
  import { readFile } from 'node:fs/promises';
7
8
  import { resolve } from 'node:path';
8
9
  import { createInterface } from 'node:readline/promises';
@@ -30,6 +31,9 @@ Commands for an existing project (run from its root):
30
31
  npx orionplace-svelte remove frontend <shop.example.com>
31
32
  npx orionplace-svelte set mimic <existing-frontend.example.com>
32
33
  npx orionplace-svelte set frontend <shop.example.com>
34
+ npx orionplace-svelte sitemap rebuild [domain] rebuild /sitemap.xml now (every frontend, or one);
35
+ the running storefront serves it at once
36
+ npx orionplace-svelte sitemap status [domain] when each sitemap was built
33
37
 
34
38
  On your Linux server (run from the project root):
35
39
  sudo npx orionplace-svelte install
@@ -131,6 +135,9 @@ try {
131
135
  }
132
136
  const done = await controlService({ action: command, cwd, name: install.name, lines: positional[1] ?? 100, follow, dryRun });
133
137
  process.exitCode = printService(done);
138
+ } else if (command === 'sitemap' && positional.length <= 3) {
139
+ if (dryRun) throw new Error('--dry-run is not a sitemap option; sitemap status shows the state without changes.');
140
+ process.exitCode = await sitemapCommand({ cwd, action: target, domain: positional[2] });
134
141
  } else if (command === 'init' && positional.length <= 2) {
135
142
  result = await setupProject({ cwd: target ? resolve(cwd, target) : cwd, dryRun });
136
143
  } else if (command === 'update' && positional.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orionplace-svelte",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "SvelteKit 2 storefront for your Orionplace marketplace: setup CLI, server API gateway, typed store and ready-made catalog, cart, checkout and account components in English and Russian, plus an Android app build.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,3 +25,100 @@ export declare function forwardMarketplace(
25
25
  request: Request,
26
26
  configuration?: MarketplaceConfiguration,
27
27
  ): Promise<Response>;
28
+
29
+ export interface MarketplaceSitemapPage {
30
+ path: string;
31
+ lastmod?: string | null;
32
+ locales?: string[];
33
+ }
34
+
35
+ export declare function marketplacePublicOrigin(
36
+ request: Request,
37
+ tenantDomain?: string,
38
+ ): string;
39
+
40
+ export declare function noindexPathPrefixes(value?: string): string[];
41
+
42
+ export declare function marketplaceNoindexPath(
43
+ pathname: string,
44
+ value?: string,
45
+ ): boolean;
46
+
47
+ export declare function sitemapIndexedPages(
48
+ pages: MarketplaceSitemapPage[],
49
+ value?: string,
50
+ ): MarketplaceSitemapPage[];
51
+
52
+ export declare function marketplaceRobots(origin: string): string;
53
+
54
+ export declare function marketplaceRobotsResponse(
55
+ request: Request,
56
+ configuration?: MarketplaceConfiguration,
57
+ ): Promise<Response>;
58
+
59
+ export declare function sitemapLocales(locales: unknown): string[];
60
+
61
+ export declare function sitemapLastmod(
62
+ value: unknown,
63
+ now?: number,
64
+ ): string | null;
65
+
66
+ export declare function sitemapApiPath(
67
+ paths: unknown,
68
+ name: string,
69
+ ): string | null;
70
+
71
+ export declare function sitemapCategoryIds(categories: unknown): number[];
72
+
73
+ export declare function marketplaceSitemapXml(
74
+ origin: string,
75
+ pages: MarketplaceSitemapPage[],
76
+ locales: string[],
77
+ ): string;
78
+
79
+ export declare function marketplaceSitemapResponse(
80
+ request: Request,
81
+ configuration?: MarketplaceConfiguration,
82
+ ): Promise<Response>;
83
+
84
+ export interface MarketplaceSitemap {
85
+ version: number;
86
+ domain: string;
87
+ built: string;
88
+ locales: string[];
89
+ pages: MarketplaceSitemapPage[];
90
+ }
91
+
92
+ export interface MarketplaceSitemapRebuild {
93
+ domain: string;
94
+ path: string;
95
+ built: string;
96
+ urls: number;
97
+ pages: number;
98
+ publications: number;
99
+ }
100
+
101
+ export declare const SITEMAP_LIFETIME: number;
102
+
103
+ export declare function readMarketplaceDomain(
104
+ domain: string,
105
+ options?: { root?: string },
106
+ ): Promise<MarketplaceTenant>;
107
+
108
+ export declare function marketplaceConfigDirectory(root?: string): string;
109
+
110
+ export declare function marketplaceDomains(root?: string): Promise<string[]>;
111
+
112
+ export declare function sitemapCacheDirectory(root?: string): string;
113
+
114
+ export declare function readSitemapCache(
115
+ domain: string,
116
+ root?: string,
117
+ ): Promise<MarketplaceSitemap | null>;
118
+
119
+ export declare function sitemapUrlCount(sitemap: MarketplaceSitemap): number;
120
+
121
+ export declare function rebuildMarketplaceSitemap(
122
+ domain: string,
123
+ options?: { root?: string },
124
+ ): Promise<MarketplaceSitemapRebuild>;