@shopify/cli-hydrogen 3.27.0 → 4.0.0-alpha.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 (249) hide show
  1. package/dist/commands/hydrogen/build.js +89 -0
  2. package/dist/commands/hydrogen/dev.js +116 -0
  3. package/dist/commands/hydrogen/init.js +42 -0
  4. package/dist/commands/hydrogen/preview.js +34 -0
  5. package/dist/hooks/init.js +21 -0
  6. package/dist/templates/demo-store/.editorconfig +8 -0
  7. package/dist/templates/demo-store/.eslintignore +4 -0
  8. package/dist/templates/demo-store/.eslintrc.js +16 -0
  9. package/dist/templates/demo-store/.graphqlrc.yml +1 -0
  10. package/dist/templates/demo-store/.prettierignore +2 -0
  11. package/dist/templates/demo-store/.turbo/turbo-build.log +13 -0
  12. package/dist/templates/demo-store/app/components/AccountAddressBook.tsx +97 -0
  13. package/dist/templates/demo-store/app/components/AccountDetails.tsx +41 -0
  14. package/dist/templates/demo-store/app/components/AddToCartButton.tsx +42 -0
  15. package/dist/templates/demo-store/app/components/Breadcrumbs.tsx +36 -0
  16. package/dist/templates/demo-store/app/components/Button.tsx +56 -0
  17. package/dist/templates/demo-store/app/components/Cart.tsx +431 -0
  18. package/dist/templates/demo-store/app/components/CartLoading.tsx +50 -0
  19. package/dist/templates/demo-store/app/components/CountrySelector.tsx +180 -0
  20. package/dist/templates/demo-store/app/components/Drawer.tsx +115 -0
  21. package/dist/templates/demo-store/app/components/FeaturedCollections.tsx +54 -0
  22. package/dist/templates/demo-store/app/components/FeaturedProducts.tsx +116 -0
  23. package/dist/templates/demo-store/app/components/FeaturedSection.tsx +39 -0
  24. package/dist/templates/demo-store/app/components/GenericError.tsx +58 -0
  25. package/dist/templates/demo-store/app/components/Grid.tsx +44 -0
  26. package/dist/templates/demo-store/app/components/Hero.tsx +136 -0
  27. package/dist/templates/demo-store/app/components/Icon.tsx +253 -0
  28. package/dist/templates/demo-store/app/components/Input.tsx +24 -0
  29. package/dist/templates/demo-store/app/components/Layout.tsx +492 -0
  30. package/dist/templates/demo-store/app/components/Link.tsx +46 -0
  31. package/dist/templates/demo-store/app/components/Modal.tsx +46 -0
  32. package/dist/templates/demo-store/app/components/NotFound.tsx +22 -0
  33. package/dist/templates/demo-store/app/components/OrderCard.tsx +85 -0
  34. package/dist/templates/demo-store/app/components/Pagination.tsx +277 -0
  35. package/dist/templates/demo-store/app/components/ProductCard.tsx +146 -0
  36. package/dist/templates/demo-store/app/components/ProductGallery.tsx +114 -0
  37. package/dist/templates/demo-store/app/components/ProductGrid.tsx +93 -0
  38. package/dist/templates/demo-store/app/components/ProductSwimlane.tsx +30 -0
  39. package/dist/templates/demo-store/app/components/Skeleton.tsx +24 -0
  40. package/dist/templates/demo-store/app/components/SortFilter.tsx +411 -0
  41. package/dist/templates/demo-store/app/components/Text.tsx +192 -0
  42. package/dist/templates/demo-store/app/components/index.ts +28 -0
  43. package/dist/templates/demo-store/app/data/countries.ts +194 -0
  44. package/dist/templates/demo-store/app/data/index.ts +1037 -0
  45. package/dist/templates/demo-store/app/entry.client.tsx +4 -0
  46. package/dist/templates/demo-store/app/entry.server.tsx +26 -0
  47. package/dist/templates/demo-store/app/hooks/useCartFetchers.tsx +14 -0
  48. package/dist/templates/demo-store/app/hooks/useIsHydrated.tsx +12 -0
  49. package/dist/templates/demo-store/app/lib/const.ts +10 -0
  50. package/dist/templates/demo-store/app/lib/placeholders.ts +242 -0
  51. package/dist/templates/demo-store/app/lib/seo/common.tsx +324 -0
  52. package/dist/templates/demo-store/app/lib/seo/debugger.tsx +175 -0
  53. package/dist/templates/demo-store/app/lib/seo/image.tsx +32 -0
  54. package/dist/templates/demo-store/app/lib/seo/index.ts +4 -0
  55. package/dist/templates/demo-store/app/lib/seo/seo.tsx +24 -0
  56. package/dist/templates/demo-store/app/lib/seo/types.ts +70 -0
  57. package/dist/templates/demo-store/app/lib/session.server.ts +57 -0
  58. package/dist/templates/demo-store/app/lib/type.ts +21 -0
  59. package/dist/templates/demo-store/app/lib/utils.ts +310 -0
  60. package/dist/templates/demo-store/app/root.tsx +282 -0
  61. package/dist/templates/demo-store/app/routes/$.tsx +7 -0
  62. package/dist/templates/demo-store/app/routes/$lang/$.tsx +1 -0
  63. package/dist/templates/demo-store/app/routes/$lang/[robots.txt].tsx +1 -0
  64. package/dist/templates/demo-store/app/routes/$lang/[sitemap.xml].tsx +1 -0
  65. package/dist/templates/demo-store/app/routes/$lang/account/__private/address/$id.tsx +1 -0
  66. package/dist/templates/demo-store/app/routes/$lang/account/__private/edit.tsx +1 -0
  67. package/dist/templates/demo-store/app/routes/$lang/account/__private/logout.ts +1 -0
  68. package/dist/templates/demo-store/app/routes/$lang/account/__private/orders.$id.tsx +1 -0
  69. package/dist/templates/demo-store/app/routes/$lang/account/__public/activate.$id.$activationToken.tsx +6 -0
  70. package/dist/templates/demo-store/app/routes/$lang/account/__public/login.tsx +7 -0
  71. package/dist/templates/demo-store/app/routes/$lang/account/__public/recover.tsx +1 -0
  72. package/dist/templates/demo-store/app/routes/$lang/account/__public/register.tsx +6 -0
  73. package/dist/templates/demo-store/app/routes/$lang/account/__public/reset.$id.$resetToken.tsx +5 -0
  74. package/dist/templates/demo-store/app/routes/$lang/account.tsx +1 -0
  75. package/dist/templates/demo-store/app/routes/$lang/api/countries.tsx +1 -0
  76. package/dist/templates/demo-store/app/routes/$lang/api/products.tsx +1 -0
  77. package/dist/templates/demo-store/app/routes/$lang/cart.tsx +1 -0
  78. package/dist/templates/demo-store/app/routes/$lang/collections/$collectionHandle.tsx +6 -0
  79. package/dist/templates/demo-store/app/routes/$lang/collections/all.tsx +1 -0
  80. package/dist/templates/demo-store/app/routes/$lang/collections/index.tsx +1 -0
  81. package/dist/templates/demo-store/app/routes/$lang/featured-products.tsx +1 -0
  82. package/dist/templates/demo-store/app/routes/$lang/index.tsx +7 -0
  83. package/dist/templates/demo-store/app/routes/$lang/journal/$journalHandle.tsx +7 -0
  84. package/dist/templates/demo-store/app/routes/$lang/journal/index.tsx +1 -0
  85. package/dist/templates/demo-store/app/routes/$lang/og-image.tsx +1 -0
  86. package/dist/templates/demo-store/app/routes/$lang/pages/$pageHandle.tsx +1 -0
  87. package/dist/templates/demo-store/app/routes/$lang/policies/$policyHandle.tsx +1 -0
  88. package/dist/templates/demo-store/app/routes/$lang/policies/index.tsx +1 -0
  89. package/dist/templates/demo-store/app/routes/$lang/products/$productHandle.tsx +6 -0
  90. package/dist/templates/demo-store/app/routes/$lang/products/index.tsx +1 -0
  91. package/dist/templates/demo-store/app/routes/$lang/search.tsx +6 -0
  92. package/dist/templates/demo-store/app/routes/[robots.txt].tsx +40 -0
  93. package/dist/templates/demo-store/app/routes/[sitemap.xml].tsx +198 -0
  94. package/dist/templates/demo-store/app/routes/account/__private/address/$id.tsx +320 -0
  95. package/dist/templates/demo-store/app/routes/account/__private/edit.tsx +273 -0
  96. package/dist/templates/demo-store/app/routes/account/__private/logout.ts +29 -0
  97. package/dist/templates/demo-store/app/routes/account/__private/orders.$id.tsx +324 -0
  98. package/dist/templates/demo-store/app/routes/account/__public/activate.$id.$activationToken.tsx +218 -0
  99. package/dist/templates/demo-store/app/routes/account/__public/login.tsx +197 -0
  100. package/dist/templates/demo-store/app/routes/account/__public/recover.tsx +144 -0
  101. package/dist/templates/demo-store/app/routes/account/__public/register.tsx +184 -0
  102. package/dist/templates/demo-store/app/routes/account/__public/reset.$id.$resetToken.tsx +214 -0
  103. package/dist/templates/demo-store/app/routes/account.tsx +191 -0
  104. package/dist/templates/demo-store/app/routes/api/countries.tsx +22 -0
  105. package/dist/templates/demo-store/app/routes/api/products.tsx +116 -0
  106. package/dist/templates/demo-store/app/routes/cart.tsx +498 -0
  107. package/dist/templates/demo-store/app/routes/collections/$collectionHandle.tsx +308 -0
  108. package/dist/templates/demo-store/app/routes/collections/all.tsx +5 -0
  109. package/dist/templates/demo-store/app/routes/collections/index.tsx +195 -0
  110. package/dist/templates/demo-store/app/routes/discounts.$code.tsx +60 -0
  111. package/dist/templates/demo-store/app/routes/featured-products.tsx +58 -0
  112. package/dist/templates/demo-store/app/routes/index.tsx +254 -0
  113. package/dist/templates/demo-store/app/routes/journal/$journalHandle.tsx +147 -0
  114. package/dist/templates/demo-store/app/routes/journal/index.tsx +150 -0
  115. package/dist/templates/demo-store/app/routes/og-image.tsx +19 -0
  116. package/dist/templates/demo-store/app/routes/pages/$pageHandle.tsx +82 -0
  117. package/dist/templates/demo-store/app/routes/policies/$policyHandle.tsx +117 -0
  118. package/dist/templates/demo-store/app/routes/policies/index.tsx +104 -0
  119. package/dist/templates/demo-store/app/routes/products/$productHandle.tsx +561 -0
  120. package/dist/templates/demo-store/app/routes/products/index.tsx +155 -0
  121. package/dist/templates/demo-store/app/routes/search.tsx +205 -0
  122. package/dist/templates/demo-store/app/styles/custom-font.css +13 -0
  123. package/dist/templates/demo-store/package-lock.json +25515 -0
  124. package/dist/templates/demo-store/package.json +67 -0
  125. package/dist/templates/demo-store/playwright.config.ts +109 -0
  126. package/dist/templates/demo-store/postcss.config.js +10 -0
  127. package/dist/templates/demo-store/public/favicon.svg +28 -0
  128. package/dist/templates/demo-store/public/fonts/IBMPlexSerif-Text.woff2 +0 -0
  129. package/dist/templates/demo-store/public/fonts/IBMPlexSerif-TextItalic.woff2 +0 -0
  130. package/dist/templates/demo-store/remix.config.js +12 -0
  131. package/dist/templates/demo-store/remix.env.d.ts +34 -0
  132. package/dist/templates/demo-store/remix.init/index.ts +15 -0
  133. package/dist/templates/demo-store/remix.init/package.json +7 -0
  134. package/dist/templates/demo-store/server.ts +87 -0
  135. package/dist/templates/demo-store/styles/app.css +182 -0
  136. package/dist/templates/demo-store/tailwind.config.js +70 -0
  137. package/dist/templates/demo-store/tests/cart.test.ts +70 -0
  138. package/dist/templates/demo-store/tests/seo.test.ts +36 -0
  139. package/dist/templates/demo-store/tests/utils.ts +100 -0
  140. package/dist/templates/demo-store/tsconfig.json +26 -0
  141. package/dist/templates/hello-world/.eslintignore +4 -0
  142. package/dist/templates/hello-world/.eslintrc.js +6 -0
  143. package/dist/templates/hello-world/.graphqlrc.yml +1 -0
  144. package/dist/templates/hello-world/.turbo/turbo-build.log +9 -0
  145. package/dist/templates/hello-world/README.md +20 -0
  146. package/dist/templates/hello-world/app/components/Layout.tsx +15 -0
  147. package/dist/templates/hello-world/app/components/index.ts +1 -0
  148. package/dist/templates/hello-world/app/entry.client.tsx +4 -0
  149. package/dist/templates/hello-world/app/entry.server.tsx +21 -0
  150. package/dist/templates/hello-world/app/root.tsx +212 -0
  151. package/dist/templates/hello-world/app/routes/index.tsx +7 -0
  152. package/dist/templates/hello-world/app/styles/app.css +38 -0
  153. package/dist/templates/hello-world/package-lock.json +27641 -0
  154. package/dist/templates/hello-world/package.json +41 -0
  155. package/dist/templates/hello-world/public/favicon.svg +28 -0
  156. package/dist/templates/hello-world/remix.env.d.ts +29 -0
  157. package/dist/templates/hello-world/server.ts +127 -0
  158. package/dist/templates/hello-world/tsconfig.json +25 -0
  159. package/dist/utils/config.js +81 -0
  160. package/dist/utils/flags.js +15 -0
  161. package/dist/utils/log.js +20 -0
  162. package/dist/utils/mini-oxygen.js +70 -0
  163. package/package.json +27 -64
  164. package/tmp-create-app.mjs +29 -0
  165. package/LICENSE +0 -8
  166. package/README.md +0 -63
  167. package/dist/cli/commands/hydrogen/add/eslint.d.ts +0 -11
  168. package/dist/cli/commands/hydrogen/add/eslint.js +0 -26
  169. package/dist/cli/commands/hydrogen/add/eslint.js.map +0 -1
  170. package/dist/cli/commands/hydrogen/add/tailwind.d.ts +0 -11
  171. package/dist/cli/commands/hydrogen/add/tailwind.js +0 -26
  172. package/dist/cli/commands/hydrogen/add/tailwind.js.map +0 -1
  173. package/dist/cli/commands/hydrogen/build.d.ts +0 -14
  174. package/dist/cli/commands/hydrogen/build.js +0 -49
  175. package/dist/cli/commands/hydrogen/build.js.map +0 -1
  176. package/dist/cli/commands/hydrogen/deploy.d.ts +0 -19
  177. package/dist/cli/commands/hydrogen/deploy.js +0 -58
  178. package/dist/cli/commands/hydrogen/deploy.js.map +0 -1
  179. package/dist/cli/commands/hydrogen/dev.d.ts +0 -13
  180. package/dist/cli/commands/hydrogen/dev.js +0 -31
  181. package/dist/cli/commands/hydrogen/dev.js.map +0 -1
  182. package/dist/cli/commands/hydrogen/info.d.ts +0 -12
  183. package/dist/cli/commands/hydrogen/info.js +0 -28
  184. package/dist/cli/commands/hydrogen/info.js.map +0 -1
  185. package/dist/cli/commands/hydrogen/preview.d.ts +0 -13
  186. package/dist/cli/commands/hydrogen/preview.js +0 -46
  187. package/dist/cli/commands/hydrogen/preview.js.map +0 -1
  188. package/dist/cli/constants.d.ts +0 -15
  189. package/dist/cli/constants.js +0 -16
  190. package/dist/cli/constants.js.map +0 -1
  191. package/dist/cli/flags.d.ts +0 -4
  192. package/dist/cli/flags.js +0 -16
  193. package/dist/cli/flags.js.map +0 -1
  194. package/dist/cli/models/hydrogen.d.ts +0 -22
  195. package/dist/cli/models/hydrogen.js +0 -82
  196. package/dist/cli/models/hydrogen.js.map +0 -1
  197. package/dist/cli/prompts/git-init.d.ts +0 -1
  198. package/dist/cli/prompts/git-init.js +0 -16
  199. package/dist/cli/prompts/git-init.js.map +0 -1
  200. package/dist/cli/services/build/check-lockfile.d.ts +0 -3
  201. package/dist/cli/services/build/check-lockfile.js +0 -80
  202. package/dist/cli/services/build/check-lockfile.js.map +0 -1
  203. package/dist/cli/services/build.d.ts +0 -14
  204. package/dist/cli/services/build.js +0 -44
  205. package/dist/cli/services/build.js.map +0 -1
  206. package/dist/cli/services/deploy/config.d.ts +0 -4
  207. package/dist/cli/services/deploy/config.js +0 -49
  208. package/dist/cli/services/deploy/config.js.map +0 -1
  209. package/dist/cli/services/deploy/error.d.ts +0 -4
  210. package/dist/cli/services/deploy/error.js +0 -11
  211. package/dist/cli/services/deploy/error.js.map +0 -1
  212. package/dist/cli/services/deploy/graphql/create_deployment.d.ts +0 -10
  213. package/dist/cli/services/deploy/graphql/create_deployment.js +0 -15
  214. package/dist/cli/services/deploy/graphql/create_deployment.js.map +0 -1
  215. package/dist/cli/services/deploy/graphql/upload_deployment.d.ts +0 -1
  216. package/dist/cli/services/deploy/graphql/upload_deployment.js +0 -16
  217. package/dist/cli/services/deploy/graphql/upload_deployment.js.map +0 -1
  218. package/dist/cli/services/deploy/types.d.ts +0 -37
  219. package/dist/cli/services/deploy/types.js +0 -2
  220. package/dist/cli/services/deploy/types.js.map +0 -1
  221. package/dist/cli/services/deploy/upload.d.ts +0 -5
  222. package/dist/cli/services/deploy/upload.js +0 -81
  223. package/dist/cli/services/deploy/upload.js.map +0 -1
  224. package/dist/cli/services/deploy.d.ts +0 -2
  225. package/dist/cli/services/deploy.js +0 -103
  226. package/dist/cli/services/deploy.js.map +0 -1
  227. package/dist/cli/services/dev/check-version.d.ts +0 -1
  228. package/dist/cli/services/dev/check-version.js +0 -30
  229. package/dist/cli/services/dev/check-version.js.map +0 -1
  230. package/dist/cli/services/dev.d.ts +0 -10
  231. package/dist/cli/services/dev.js +0 -36
  232. package/dist/cli/services/dev.js.map +0 -1
  233. package/dist/cli/services/eslint.d.ts +0 -8
  234. package/dist/cli/services/eslint.js +0 -74
  235. package/dist/cli/services/eslint.js.map +0 -1
  236. package/dist/cli/services/info.d.ts +0 -7
  237. package/dist/cli/services/info.js +0 -131
  238. package/dist/cli/services/info.js.map +0 -1
  239. package/dist/cli/services/preview.d.ts +0 -12
  240. package/dist/cli/services/preview.js +0 -63
  241. package/dist/cli/services/preview.js.map +0 -1
  242. package/dist/cli/services/tailwind.d.ts +0 -9
  243. package/dist/cli/services/tailwind.js +0 -103
  244. package/dist/cli/services/tailwind.js.map +0 -1
  245. package/dist/cli/utilities/load-config.d.ts +0 -5
  246. package/dist/cli/utilities/load-config.js +0 -6
  247. package/dist/cli/utilities/load-config.js.map +0 -1
  248. package/dist/tsconfig.tsbuildinfo +0 -1
  249. package/oclif.manifest.json +0 -1
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "demo-store",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "npm run build:css && shopify hydrogen build --entry ./server",
7
+ "build:css": "postcss styles --base styles --dir app/styles --env production",
8
+ "dev": "npm run build:css && concurrently -g -r npm:dev:css \"shopify hydrogen dev --entry ./server\"",
9
+ "dev:css": "postcss styles --base styles --dir app/styles -w",
10
+ "format": "prettier --write --ignore-unknown .",
11
+ "lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
12
+ "preview": "npm run build && shopify hydrogen preview",
13
+ "typecheck": "tsc --noEmit"
14
+ },
15
+ "prettier": "@shopify/prettier-config",
16
+ "dependencies": {
17
+ "@headlessui/react": "^1.7.2",
18
+ "@remix-run/react": "0.0.0-experimental-e18af792a",
19
+ "@shopify/cli": "^3.23.0",
20
+ "@shopify/cli-hydrogen": "^4.0.0-alpha.1",
21
+ "@shopify/hydrogen": "^2.0.0-alpha.1",
22
+ "@shopify/hydrogen-react": "^2022.10.3",
23
+ "@shopify/remix-oxygen": "^1.0.0-alpha.1",
24
+ "clsx": "^1.2.1",
25
+ "concurrently": "^7.5.0",
26
+ "cross-env": "^7.0.3",
27
+ "graphql": "^16.6.0",
28
+ "graphql-tag": "^2.12.6",
29
+ "isbot": "^3.6.5",
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0",
32
+ "react-intersection-observer": "^9.4.1",
33
+ "react-use": "^17.4.0",
34
+ "schema-dts": "^1.1.0",
35
+ "tiny-invariant": "^1.2.0",
36
+ "typographic-base": "^1.0.4"
37
+ },
38
+ "devDependencies": {
39
+ "@playwright/test": "^1.27.1",
40
+ "@remix-run/dev": "0.0.0-experimental-e18af792a",
41
+ "@remix-run/eslint-config": "0.0.0-experimental-e18af792a",
42
+ "@shopify/eslint-plugin": "^42.0.1",
43
+ "@shopify/oxygen-workers-types": "^3.17.2",
44
+ "@shopify/prettier-config": "^1.1.2",
45
+ "@tailwindcss/forms": "^0.5.3",
46
+ "@tailwindcss/typography": "^0.5.7",
47
+ "@types/eslint": "^8.4.10",
48
+ "@types/react": "^18.0.20",
49
+ "@types/react-dom": "^18.0.6",
50
+ "concurrently": "^7.4.0",
51
+ "cross-env": "^7.0.3",
52
+ "esbuild": "^0.15.14",
53
+ "eslint": "^8.20.0",
54
+ "eslint-plugin-hydrogen": "0.12.2",
55
+ "postcss": "^8.4.16",
56
+ "postcss-cli": "^10.0.0",
57
+ "postcss-import": "^15.0.0",
58
+ "postcss-preset-env": "^7.8.2",
59
+ "prettier": "^2.7.1",
60
+ "rimraf": "^3.0.2",
61
+ "tailwindcss": "^3.1.8",
62
+ "typescript": "^4.8.3"
63
+ },
64
+ "engines": {
65
+ "node": ">=16.13"
66
+ }
67
+ }
@@ -0,0 +1,109 @@
1
+ import type {PlaywrightTestConfig} from '@playwright/test';
2
+ import {devices} from '@playwright/test';
3
+
4
+ declare const process: {env: {CI: boolean}};
5
+
6
+ /**
7
+ * Read environment variables from file.
8
+ * https://github.com/motdotla/dotenv
9
+ */
10
+ // require('dotenv').config();
11
+
12
+ /**
13
+ * See https://playwright.dev/docs/test-configuration.
14
+ */
15
+ const config: PlaywrightTestConfig = {
16
+ testDir: './tests',
17
+ /* Maximum time one test can run for. */
18
+ timeout: 30 * 1000,
19
+ expect: {
20
+ /**
21
+ * Maximum time expect() should wait for the condition to be met.
22
+ * For example in `await expect(locator).toHaveText();`
23
+ */
24
+ timeout: 5000,
25
+ },
26
+ /* Run tests in files in parallel */
27
+ fullyParallel: true,
28
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
29
+ forbidOnly: !!process.env.CI,
30
+ /* Retry on CI only */
31
+ retries: process.env.CI ? 2 : 0,
32
+ /* Opt out of parallel tests on CI. */
33
+ workers: process.env.CI ? 1 : undefined,
34
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
35
+ reporter: 'html',
36
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
37
+ use: {
38
+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
39
+ actionTimeout: 0,
40
+ /* Base URL to use in actions like `await page.goto('/')`. */
41
+ baseURL: 'http://localhost:3000',
42
+
43
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
44
+ trace: 'on-first-retry',
45
+ },
46
+
47
+ /* Configure projects for major browsers */
48
+ projects: [
49
+ {
50
+ name: 'chromium',
51
+ use: {
52
+ ...devices['Desktop Chrome'],
53
+ },
54
+ },
55
+
56
+ // {
57
+ // name: 'firefox',
58
+ // use: {
59
+ // ...devices['Desktop Firefox'],
60
+ // },
61
+ // },
62
+
63
+ // {
64
+ // name: 'webkit',
65
+ // use: {
66
+ // ...devices['Desktop Safari'],
67
+ // },
68
+ // },
69
+
70
+ /* Test against mobile viewports. */
71
+ // {
72
+ // name: 'Mobile Chrome',
73
+ // use: {
74
+ // ...devices['Pixel 5'],
75
+ // },
76
+ // },
77
+ // {
78
+ // name: 'Mobile Safari',
79
+ // use: {
80
+ // ...devices['iPhone 12'],
81
+ // },
82
+ // },
83
+
84
+ /* Test against branded browsers. */
85
+ // {
86
+ // name: 'Microsoft Edge',
87
+ // use: {
88
+ // channel: 'msedge',
89
+ // },
90
+ // },
91
+ // {
92
+ // name: 'Google Chrome',
93
+ // use: {
94
+ // channel: 'chrome',
95
+ // },
96
+ // },
97
+ ],
98
+
99
+ /* Folder for test artifacts such as screenshots, videos, traces, etc. */
100
+ // outputDir: 'test-results/',
101
+
102
+ /* Run your local dev server before starting the tests */
103
+ webServer: {
104
+ command: 'npm run preview',
105
+ port: 3000,
106
+ },
107
+ };
108
+
109
+ export default config;
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ plugins: {
3
+ 'postcss-import': {},
4
+ 'tailwindcss/nesting': {},
5
+ tailwindcss: {},
6
+ 'postcss-preset-env': {
7
+ features: {'nesting-rules': false},
8
+ },
9
+ },
10
+ };
@@ -0,0 +1,28 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
2
+ <style>
3
+ .stroke {
4
+ stroke: #000;
5
+ }
6
+ .fill {
7
+ fill: #000;
8
+ }
9
+ @media (prefers-color-scheme: dark) {
10
+ .stroke {
11
+ stroke: #fff;
12
+ }
13
+ .fill {
14
+ fill: #fff;
15
+ }
16
+ }
17
+ </style>
18
+ <path
19
+ class="stroke"
20
+ fill-rule="evenodd"
21
+ d="M16.1 16.04 1 8.02 6.16 5.3l5.82 3.09 4.88-2.57-5.82-3.1L16.21 0l15.1 8.02-5.17 2.72-5.5-2.91-4.88 2.57 5.5 2.92-5.16 2.72Z"
22
+ />
23
+ <path
24
+ class="fill"
25
+ fill-rule="evenodd"
26
+ d="M16.1 32 1 23.98l5.16-2.72 5.82 3.08 4.88-2.57-5.82-3.08 5.17-2.73 15.1 8.02-5.17 2.72-5.5-2.92-4.88 2.58 5.5 2.92L16.1 32Z"
27
+ />
28
+ </svg>
@@ -0,0 +1,12 @@
1
+ // TODO: Change package name when we decide on a package name.
2
+ const {hydrogenRoutes} = require('@shopify/hydrogen/build');
3
+
4
+ /** @type {import('@remix-run/dev').AppConfig} */
5
+ module.exports = {
6
+ ignoredRouteFiles: ['**/.*'],
7
+ routes(defineRoutes) {
8
+ return hydrogenRoutes(defineRoutes, {
9
+ graphiql: process.env.NODE_ENV !== 'production',
10
+ });
11
+ },
12
+ };
@@ -0,0 +1,34 @@
1
+ /// <reference types="@remix-run/dev" />
2
+ /// <reference types="@shopify/remix-oxygen" />
3
+ /// <reference types="@shopify/oxygen-workers-types" />
4
+
5
+ import type {StorefrontClient} from '@shopify/hydrogen';
6
+ import type {HydrogenSession} from '~/lib/session.server';
7
+
8
+ /**
9
+ * Declare expected Env parameter in fetch handler.
10
+ */
11
+ declare global {
12
+ interface Env {
13
+ SESSION_SECRET: string;
14
+ SHOPIFY_STOREFRONT_API_PUBLIC_TOKEN: string;
15
+ SHOPIFY_STOREFRONT_API_VERSION: string;
16
+ SHOPIFY_STORE_DOMAIN: string;
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Declare local additions to `AppLoadContext` to include the session utilities we injected in `server.ts`.
22
+ */
23
+ declare module '@shopify/remix-oxygen' {
24
+ export interface AppLoadContext {
25
+ waitUntil: ExecutionContext['waitUntil'];
26
+ session: HydrogenSession;
27
+ storefront: StorefrontClient['storefront'];
28
+ cache: Cache;
29
+ env: Env;
30
+ }
31
+ }
32
+
33
+ // Needed to make this file a module.
34
+ export {};
@@ -0,0 +1,15 @@
1
+ /* eslint-disable no-console */
2
+
3
+ const run = ({rootDirectory}: {rootDirectory: string}) => {
4
+ console.log();
5
+ console.log(`Finished creating your Hydrogen storefront in ${rootDirectory}`);
6
+ console.log(`📚 Docs: https://shopify.dev/custom-storefronts/hydrogen`);
7
+ console.log(
8
+ `👋 Note: your project will display inventory from the Hydrogen Demo Store.`,
9
+ );
10
+ console.log();
11
+ };
12
+
13
+ export default run;
14
+
15
+ /* eslint-enable no-console */
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "remix.init",
3
+ "private": true,
4
+ "main": "index.mjs",
5
+ "license": "MIT",
6
+ "dependencies": {}
7
+ }
@@ -0,0 +1,87 @@
1
+ // Virtual entry point for the app
2
+ import * as remixBuild from '@remix-run/dev/server-build';
3
+ import {createRequestHandler, getBuyerIp} from '@shopify/remix-oxygen';
4
+ import {createStorefrontClient, proxyLiquidRoute} from '@shopify/hydrogen';
5
+ import {HydrogenSession} from '~/lib/session.server';
6
+ import {getLocaleFromRequest} from '~/lib/utils';
7
+
8
+ /**
9
+ * A global `process` object is only available during build to access NODE_ENV.
10
+ */
11
+ declare const process: {env: {NODE_ENV: string}};
12
+
13
+ /**
14
+ * Export a fetch handler in module format.
15
+ */
16
+ export default {
17
+ async fetch(
18
+ request: Request,
19
+ env: Env,
20
+ executionContext: ExecutionContext,
21
+ ): Promise<Response> {
22
+ try {
23
+ /**
24
+ * Proxy to the Online Store if needed.
25
+ */
26
+ const onlineStoreProxy =
27
+ new URL(request.url).pathname === '/proxy' ? '/pages/about' : null;
28
+
29
+ if (onlineStoreProxy) {
30
+ return await proxyLiquidRoute(
31
+ request,
32
+ env.SHOPIFY_STORE_DOMAIN,
33
+ onlineStoreProxy,
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Open a cache instance in the worker and a custom session instance.
39
+ */
40
+ if (!env?.SESSION_SECRET) {
41
+ throw new Error('SESSION_SECRET environment variable is not set');
42
+ }
43
+
44
+ const [cache, session] = await Promise.all([
45
+ caches.open('hydrogen'),
46
+ HydrogenSession.init(request, [env.SESSION_SECRET]),
47
+ ]);
48
+
49
+ /**
50
+ * Create a Remix request handler and pass
51
+ * Hydrogen's Storefront client to the loader context.
52
+ */
53
+ const handleRequest = createRequestHandler({
54
+ build: remixBuild,
55
+ mode: process.env.NODE_ENV,
56
+ getLoadContext() {
57
+ const waitUntil = executionContext.waitUntil.bind(executionContext);
58
+
59
+ const {storefront} = createStorefrontClient({
60
+ cache,
61
+ waitUntil,
62
+ buyerIp: getBuyerIp(request),
63
+ i18n: getLocaleFromRequest(request),
64
+ publicStorefrontToken: env.SHOPIFY_STOREFRONT_API_PUBLIC_TOKEN,
65
+ storeDomain: env.SHOPIFY_STORE_DOMAIN,
66
+ storefrontApiVersion:
67
+ env.SHOPIFY_STOREFRONT_API_VERSION || '2022-10',
68
+ });
69
+
70
+ return {
71
+ cache,
72
+ session,
73
+ waitUntil,
74
+ storefront,
75
+ env,
76
+ };
77
+ },
78
+ });
79
+
80
+ return await handleRequest(request);
81
+ } catch (error) {
82
+ // eslint-disable-next-line no-console
83
+ console.error(error);
84
+ return new Response('An unexpected error occurred', {status: 500});
85
+ }
86
+ },
87
+ };
@@ -0,0 +1,182 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ /* Tokens */
6
+ :root {
7
+ --color-primary: 20 20 20; /* Text, buttons, etc. */
8
+ --color-contrast: 250 250 249; /* Backgrounds, borders, etc. */
9
+ --color-accent: 191 72 0; /* Labels like "On sale" */
10
+ --font-size-fine: 0.75rem; /* text-xs */
11
+ --font-size-copy: 1rem; /* text-base */
12
+ --font-size-lead: 1.125rem; /* text-lg */
13
+ --font-size-heading: 2rem; /* text-2xl */
14
+ --font-size-display: 3rem; /* text-4xl */
15
+ --color-shop-pay: #5a31f4;
16
+ --shop-pay-button--width: 100%; /* Sets the width for the shop-pay-button web component */
17
+ --height-nav: 3rem;
18
+ --screen-height: 100vh;
19
+ --screen-height-dynamic: 100vh;
20
+
21
+ @media (min-width: 32em) {
22
+ --height-nav: 4rem;
23
+ }
24
+ @media (min-width: 48em) {
25
+ --height-nav: 6rem;
26
+ --font-size-heading: 2.25rem; /* text-4xl */
27
+ --font-size-display: 3.75rem; /* text-6xl */
28
+ }
29
+ @supports (height: 100svh) {
30
+ --screen-height: 100svh;
31
+ }
32
+ @supports (height: 100dvh) {
33
+ --screen-height-dynamic: 100dvh;
34
+ }
35
+ }
36
+
37
+ @media (prefers-color-scheme: dark) {
38
+ :root {
39
+ --color-primary: 250 250 250;
40
+ --color-contrast: 32 33 36;
41
+ --color-accent: 235 86 40;
42
+ }
43
+ }
44
+
45
+ @keyframes fadeInAnimation {
46
+ 0% {
47
+ opacity: 0;
48
+ }
49
+ 100% {
50
+ opacity: 1;
51
+ }
52
+ }
53
+
54
+ shop-pay-button {
55
+ width: 100%;
56
+ height: 3rem;
57
+ display: table;
58
+ }
59
+
60
+ @layer base {
61
+ * {
62
+ font-variant-ligatures: none;
63
+ }
64
+
65
+ body {
66
+ @apply border-primary/10 bg-contrast text-primary/90 antialiased;
67
+ }
68
+
69
+ html {
70
+ scroll-padding-top: 10rem;
71
+ }
72
+
73
+ model-viewer::part(default-progress-mask) {
74
+ display: none;
75
+ }
76
+
77
+ model-viewer::part(default-progress-bar) {
78
+ display: none;
79
+ }
80
+
81
+ input[type='search']::-webkit-search-decoration,
82
+ input[type='search']::-webkit-search-cancel-button,
83
+ input[type='search']::-webkit-search-results-button,
84
+ input[type='search']::-webkit-search-results-decoration {
85
+ -webkit-appearance: none;
86
+ }
87
+
88
+ a.active {
89
+ @apply border-b;
90
+ }
91
+
92
+ .prose {
93
+ h1,
94
+ h2,
95
+ h3,
96
+ h4,
97
+ h5,
98
+ h6 {
99
+ &:first-child {
100
+ @apply mt-0;
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ @layer components {
107
+ .article {
108
+ h2,
109
+ h3,
110
+ h4,
111
+ h5,
112
+ h6 {
113
+ @apply font-sans text-primary;
114
+ }
115
+ @apply prose mx-auto mb-12 grid justify-center font-serif text-primary;
116
+ p,
117
+ ul,
118
+ li {
119
+ @apply mb-4 text-lg;
120
+ }
121
+ img {
122
+ @apply md:-mx-8 lg:-mx-16;
123
+
124
+ @media (min-width: 48em) {
125
+ width: calc(100% + 4rem);
126
+ max-width: 100vw;
127
+ }
128
+ @media (min-width: 64em) {
129
+ width: calc(100% + 8rem);
130
+ }
131
+ }
132
+ }
133
+
134
+ .swimlane {
135
+ @apply grid w-full snap-x snap-mandatory scroll-px-6 grid-flow-col justify-start gap-4 overflow-x-scroll px-6 pb-4;
136
+ }
137
+ }
138
+
139
+ @layer utilities {
140
+ .fadeIn {
141
+ opacity: 0;
142
+ animation: fadeInAnimation ease 500ms forwards;
143
+ }
144
+
145
+ .hiddenScroll {
146
+ scrollbar-width: none;
147
+ &::-webkit-scrollbar {
148
+ display: none;
149
+ }
150
+ }
151
+
152
+ .absolute-center {
153
+ @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2;
154
+ }
155
+
156
+ .strike {
157
+ position: relative;
158
+ &::before {
159
+ content: '';
160
+ display: block;
161
+ position: absolute;
162
+ width: 108%;
163
+ height: 1.5px;
164
+ left: -4%;
165
+ top: 50%;
166
+ transform: translateY(-50%);
167
+ background: rgb(var(--color-primary));
168
+ box-shadow: 0.5px 0.5px 0px 0.5px rgb(var(--color-contrast));
169
+ }
170
+ }
171
+
172
+ .card-image {
173
+ @apply relative flex items-center justify-center overflow-clip rounded;
174
+ &::before {
175
+ content: ' ';
176
+ @apply absolute top-0 left-0 z-10 block h-full w-full rounded shadow-border;
177
+ }
178
+ img {
179
+ @apply aspect-[inherit] w-full object-cover;
180
+ }
181
+ }
182
+ }
@@ -0,0 +1,70 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ function withOpacityValue(variable) {
3
+ return ({opacityValue}) => {
4
+ if (opacityValue === undefined) {
5
+ return `rgb(var(${variable}))`;
6
+ }
7
+ return `rgb(var(${variable}) / ${opacityValue})`;
8
+ };
9
+ }
10
+
11
+ module.exports = {
12
+ content: ['./app/**/*.{js,ts,jsx,tsx}'],
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ primary: withOpacityValue('--color-primary'),
17
+ contrast: withOpacityValue('--color-contrast'),
18
+ notice: withOpacityValue('--color-accent'),
19
+ shopPay: 'var(--color-shop-pay)',
20
+ },
21
+ screens: {
22
+ sm: '32em',
23
+ md: '48em',
24
+ lg: '64em',
25
+ xl: '80em',
26
+ '2xl': '96em',
27
+ 'sm-max': {max: '48em'},
28
+ 'sm-only': {min: '32em', max: '48em'},
29
+ 'md-only': {min: '48em', max: '64em'},
30
+ 'lg-only': {min: '64em', max: '80em'},
31
+ 'xl-only': {min: '80em', max: '96em'},
32
+ '2xl-only': {min: '96em'},
33
+ },
34
+ spacing: {
35
+ nav: 'var(--height-nav)',
36
+ screen: 'var(--screen-height, 100vh)',
37
+ },
38
+ height: {
39
+ screen: 'var(--screen-height, 100vh)',
40
+ 'screen-no-nav':
41
+ 'calc(var(--screen-height, 100vh) - var(--height-nav))',
42
+ 'screen-dynamic': 'var(--screen-height-dynamic, 100vh)',
43
+ },
44
+ width: {
45
+ mobileGallery: 'calc(100vw - 3rem)',
46
+ },
47
+ fontFamily: {
48
+ sans: ['Helvetica Neue', 'ui-sans-serif', 'system-ui', 'sans-serif'],
49
+ serif: ['"IBMPlexSerif"', 'Palatino', 'ui-serif'],
50
+ },
51
+ fontSize: {
52
+ display: ['var(--font-size-display)', '1.1'],
53
+ heading: ['var(--font-size-heading)', '1.25'],
54
+ lead: ['var(--font-size-lead)', '1.333'],
55
+ copy: ['var(--font-size-copy)', '1.5'],
56
+ fine: ['var(--font-size-fine)', '1.333'],
57
+ },
58
+ maxWidth: {
59
+ 'prose-narrow': '45ch',
60
+ 'prose-wide': '80ch',
61
+ },
62
+ boxShadow: {
63
+ border: 'inset 0px 0px 0px 1px rgb(var(--color-primary) / 0.08)',
64
+ darkHeader: 'inset 0px -1px 0px 0px rgba(21, 21, 21, 0.4)',
65
+ lightHeader: 'inset 0px -1px 0px 0px rgba(21, 21, 21, 0.05)',
66
+ },
67
+ },
68
+ },
69
+ plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
70
+ };