@shopify/create-hydrogen 1.0.9 → 2.0.2

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 (64) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/commands/init.js +133 -62
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/package.json +12 -8
  6. package/templates/template-hydrogen-default/.devcontainer/devcontainer.json +0 -18
  7. package/templates/template-hydrogen-default/.eslintrc.js +0 -3
  8. package/templates/template-hydrogen-default/.gitignore +0 -7
  9. package/templates/template-hydrogen-default/.stylelintrc.js +0 -17
  10. package/templates/template-hydrogen-default/.vscode/extensions.json +0 -8
  11. package/templates/template-hydrogen-default/README.md +0 -40
  12. package/templates/template-hydrogen-default/_gitignore +0 -80
  13. package/templates/template-hydrogen-default/index.html +0 -20
  14. package/templates/template-hydrogen-default/package.json.liquid +0 -48
  15. package/templates/template-hydrogen-default/postcss.config.js +0 -6
  16. package/templates/template-hydrogen-default/public/favicon.ico +0 -0
  17. package/templates/template-hydrogen-default/shopify.config.js +0 -5
  18. package/templates/template-hydrogen-default/src/App.server.jsx +0 -27
  19. package/templates/template-hydrogen-default/src/components/Button.client.jsx +0 -65
  20. package/templates/template-hydrogen-default/src/components/Cart.client.jsx +0 -265
  21. package/templates/template-hydrogen-default/src/components/CartIcon.jsx +0 -33
  22. package/templates/template-hydrogen-default/src/components/CartIconWithItems.client.jsx +0 -28
  23. package/templates/template-hydrogen-default/src/components/CartProvider.client.jsx +0 -35
  24. package/templates/template-hydrogen-default/src/components/CartToggle.client.jsx +0 -30
  25. package/templates/template-hydrogen-default/src/components/CartUIProvider.client.jsx +0 -45
  26. package/templates/template-hydrogen-default/src/components/CountrySelector.client.jsx +0 -116
  27. package/templates/template-hydrogen-default/src/components/DefaultSeo.server.jsx +0 -36
  28. package/templates/template-hydrogen-default/src/components/FeaturedCollection.jsx +0 -26
  29. package/templates/template-hydrogen-default/src/components/Footer.server.jsx +0 -103
  30. package/templates/template-hydrogen-default/src/components/Gallery.client.jsx +0 -66
  31. package/templates/template-hydrogen-default/src/components/Header.client.jsx +0 -62
  32. package/templates/template-hydrogen-default/src/components/Layout.server.jsx +0 -86
  33. package/templates/template-hydrogen-default/src/components/LoadMoreProducts.client.jsx +0 -56
  34. package/templates/template-hydrogen-default/src/components/LoadingFallback.jsx +0 -26
  35. package/templates/template-hydrogen-default/src/components/MobileCountrySelector.client.jsx +0 -64
  36. package/templates/template-hydrogen-default/src/components/MobileNavigation.client.jsx +0 -98
  37. package/templates/template-hydrogen-default/src/components/MoneyCompareAtPrice.client.jsx +0 -14
  38. package/templates/template-hydrogen-default/src/components/MoneyPrice.client.jsx +0 -15
  39. package/templates/template-hydrogen-default/src/components/Navigation.client.jsx +0 -23
  40. package/templates/template-hydrogen-default/src/components/NotFound.server.jsx +0 -93
  41. package/templates/template-hydrogen-default/src/components/OpenIcon.jsx +0 -33
  42. package/templates/template-hydrogen-default/src/components/ProductCard.jsx +0 -50
  43. package/templates/template-hydrogen-default/src/components/ProductDetails.client.jsx +0 -233
  44. package/templates/template-hydrogen-default/src/components/ProductOptions.client.jsx +0 -49
  45. package/templates/template-hydrogen-default/src/components/Welcome.server.jsx +0 -188
  46. package/templates/template-hydrogen-default/src/index.css +0 -68
  47. package/templates/template-hydrogen-default/src/pages/collections/[handle].server.jsx +0 -105
  48. package/templates/template-hydrogen-default/src/pages/index.server.jsx +0 -241
  49. package/templates/template-hydrogen-default/src/pages/pages/[handle].server.jsx +0 -37
  50. package/templates/template-hydrogen-default/src/pages/products/[handle].server.jsx +0 -66
  51. package/templates/template-hydrogen-default/src/pages/redirect.server.jsx +0 -4
  52. package/templates/template-hydrogen-default/src/pages/robots.txt.server.js +0 -40
  53. package/templates/template-hydrogen-default/src/pages/sitemap.xml.server.jsx +0 -151
  54. package/templates/template-hydrogen-default/src/routes/collections/[handle].server.jsx +0 -105
  55. package/templates/template-hydrogen-default/src/routes/index.server.jsx +0 -241
  56. package/templates/template-hydrogen-default/src/routes/pages/[handle].server.jsx +0 -37
  57. package/templates/template-hydrogen-default/src/routes/products/[handle].server.jsx +0 -66
  58. package/templates/template-hydrogen-default/src/routes/redirect.server.jsx +0 -4
  59. package/templates/template-hydrogen-default/src/routes/robots.txt.server.js +0 -40
  60. package/templates/template-hydrogen-default/src/routes/sitemap.xml.server.jsx +0 -151
  61. package/templates/template-hydrogen-default/tailwind.config.js +0 -26
  62. package/templates/template-hydrogen-default/vite.config.js +0 -10
  63. package/templates/template-hydrogen-minimal/README.md +0 -8
  64. package/templates/template-hydrogen-minimal/package.json +0 -14
@@ -1,151 +0,0 @@
1
- import {flattenConnection, useShopQuery} from '@shopify/hydrogen';
2
- import gql from 'graphql-tag';
3
-
4
- const MAX_URLS = 250; // the google limit is 50K, however, SF API only allow querying for 250 resources each time
5
-
6
- export default function Sitemap({request, response}) {
7
- response.doNotStream();
8
-
9
- const {data} = useShopQuery({
10
- query: QUERY,
11
- variables: {
12
- urlLimits: MAX_URLS,
13
- },
14
- // Cache the page for 24 hours
15
- cache: {maxAge: 60 * 60 * 24},
16
- });
17
-
18
- response.headers.set('content-type', 'application/xml');
19
-
20
- return response.send(shopSitemap(data, request.url));
21
- }
22
-
23
- function shopSitemap(data, baseUrl) {
24
- const productsData = flattenConnection(data.products).map((product) => {
25
- const url = product.onlineStoreUrl
26
- ? product.onlineStoreUrl
27
- : `${baseUrl}/products/${product.handle}`;
28
-
29
- const finalObject = {
30
- url,
31
- lastMod: product.updatedAt,
32
- changeFreq: 'daily',
33
- };
34
-
35
- if (product.featuredImage.url) {
36
- finalObject.image = {
37
- url: product.featuredImage.url,
38
- };
39
-
40
- if (product.title) {
41
- finalObject.image.title = product.title;
42
- }
43
-
44
- if (product.featuredImage.altText) {
45
- finalObject.image.caption = product.featuredImage.altText;
46
- }
47
-
48
- return finalObject;
49
- }
50
- });
51
-
52
- const collectionsData = flattenConnection(data.collections).map(
53
- (collection) => {
54
- const url = collection.onlineStoreUrl
55
- ? collection.onlineStoreUrl
56
- : `${baseUrl}/collections/${collection.handle}`;
57
-
58
- return {
59
- url,
60
- lastMod: collection.updatedAt,
61
- changeFreq: 'daily',
62
- };
63
- },
64
- );
65
-
66
- const pagesData = flattenConnection(data.pages).map((page) => {
67
- const url = page.onlineStoreUrl
68
- ? page.onlineStoreUrl
69
- : `${baseUrl}/pages/${page.handle}`;
70
-
71
- return {
72
- url,
73
- lastMod: page.updatedAt,
74
- changeFreq: 'weekly',
75
- };
76
- });
77
-
78
- const urlsDatas = [...productsData, ...collectionsData, ...pagesData];
79
-
80
- return `
81
- <urlset
82
- xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
83
- xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
84
- >
85
- ${urlsDatas.map((url) => renderUrlTag(url)).join('')}
86
- </urlset>`;
87
- }
88
-
89
- function renderUrlTag({url, lastMod, changeFreq, image}) {
90
- return `
91
- <url>
92
- <loc>${url}</loc>
93
- <lastmod>${lastMod}</lastmod>
94
- <changefreq>${changeFreq}</changefreq>
95
- ${
96
- image
97
- ? `
98
- <image:image>
99
- <image:loc>${image.url}</image:loc>
100
- <image:title>${image.title ?? ''}</image:title>
101
- <image:caption>${image.caption ?? ''}</image:caption>
102
- </image:image>`
103
- : ''
104
- }
105
-
106
- </url>
107
- `;
108
- }
109
-
110
- const QUERY = gql`
111
- query sitemaps($urlLimits: Int) {
112
- products(
113
- first: $urlLimits
114
- query: "published_status:'online_store:visible'"
115
- ) {
116
- edges {
117
- node {
118
- updatedAt
119
- handle
120
- onlineStoreUrl
121
- title
122
- featuredImage {
123
- url
124
- altText
125
- }
126
- }
127
- }
128
- }
129
- collections(
130
- first: $urlLimits
131
- query: "published_status:'online_store:visible'"
132
- ) {
133
- edges {
134
- node {
135
- updatedAt
136
- handle
137
- onlineStoreUrl
138
- }
139
- }
140
- }
141
- pages(first: $urlLimits, query: "published_status:'published'") {
142
- edges {
143
- node {
144
- updatedAt
145
- handle
146
- onlineStoreUrl
147
- }
148
- }
149
- }
150
- }
151
- `;
@@ -1,26 +0,0 @@
1
- module.exports = {
2
- content: ['./index.html', './src/**/*.{js,jsx,ts,tsx}'],
3
- theme: {
4
- extend: {
5
- typography: (theme) => ({
6
- DEFAULT: {
7
- css: {
8
- hr: {
9
- borderColor: theme('colors.gray.200'),
10
- borderTopWidth: '1px',
11
- marginTop: '2rem',
12
- marginBottom: '2rem',
13
- },
14
- 'ol > li::before': {
15
- color: theme('colors.gray.900'),
16
- },
17
- 'ul > li::before': {
18
- backgroundColor: theme('colors.gray.900'),
19
- },
20
- },
21
- },
22
- }),
23
- },
24
- },
25
- plugins: [require('@tailwindcss/typography')],
26
- };
@@ -1,10 +0,0 @@
1
- import {defineConfig} from 'vite';
2
- import hydrogen from '@shopify/hydrogen/plugin';
3
-
4
- import shopifyConfig from './shopify.config';
5
-
6
- // https://vitejs.dev/config/
7
- export default defineConfig({
8
- plugins: [hydrogen(shopifyConfig)],
9
- optimizeDeps: {include: ['@headlessui/react']},
10
- });
@@ -1,8 +0,0 @@
1
- # {{ name }}
2
-
3
- ## Set up
4
-
5
- 1. Clone the repository.
6
- 2. Install dependencies: `{{dependency_manager}} install`.
7
- 3. Run with `{{dependency_manager}} dev`
8
- 4. Build with `{{dependency_manager}} build`
@@ -1,14 +0,0 @@
1
- {
2
- "name": "{{name}}",
3
- "version": "0.1.0",
4
- "scripts": {},
5
- "dependencies": {
6
- "@shopify/cli": "{{shopify_cli_version}}",
7
- "@shopify/hydrogen": "{{hydrogen_version}}"
8
- },
9
- "keywords": [
10
- "template-hydrogen-minimal",
11
- "shopify-hydrogen"
12
- ],
13
- "author": "{{author}}"
14
- }