@shopify/cli-hydrogen 4.0.0-alpha.1 → 4.0.0-alpha.10

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 (345) hide show
  1. package/dist/commands/hydrogen/build.js +35 -18
  2. package/dist/commands/hydrogen/check.js +34 -0
  3. package/dist/commands/hydrogen/dev.js +38 -44
  4. package/dist/commands/hydrogen/generate/route.js +174 -0
  5. package/dist/commands/hydrogen/generate/route.test.js +121 -0
  6. package/dist/commands/hydrogen/init.js +4 -4
  7. package/dist/commands/hydrogen/preview.js +6 -6
  8. package/dist/hooks/init.js +1 -4
  9. package/dist/templates/[robots.txt].tsx +41 -0
  10. package/dist/templates/[sitemap.xml].tsx +200 -0
  11. package/dist/templates/account/login.tsx +74 -0
  12. package/dist/templates/account/register.tsx +74 -0
  13. package/dist/templates/cart.tsx +43 -0
  14. package/dist/templates/collections/$collectionHandle.tsx +65 -0
  15. package/dist/templates/demo-store/.cache/content-v2/sha512/02/76/13bbea15bb42b81a204b0dc5f14726e0bfa8d012a7b284f887cc2e3c92195d6b07a78f199f990b311ca5fafa9079563503cdd81808cd9b7e496d86c72732 +1 -0
  16. package/dist/templates/demo-store/.cache/content-v2/sha512/04/98/0e81e9c8b9ebe79605df3bf2476728954d7ad01229239c4acbaaefe8e2aa6558b7a08b14cd245365258a7ef2191a7b1d656ae081cc1d129662476f547e96 +1 -0
  17. package/dist/templates/demo-store/.cache/content-v2/sha512/0d/2c/9c0b3f348e40c09b984fbb9d08a1e983e86b4ee155baf87d0fd2428689357600b1f0d71d1edcc0b7381c27eaa024e58b2b76f5a3ed14f836f0f17b0a9b0c +1 -0
  18. package/dist/templates/demo-store/.cache/content-v2/sha512/18/ed/a944ad29223f60420de387c0325270e1a26f7826a52c813bf5dd319660be2c1cf779dbd9be17aae3c9cd24baa75ddd411fd0674a0e4664b69e6115bf73ed +1 -0
  19. package/dist/templates/demo-store/.cache/content-v2/sha512/19/32/725ad9da4e9155ebe89c04ce462b0ced1a34e836fa4d0b8829baaf369979e173477fc3468eb1fc91562fbc7abef2a51dda6398a65dd490111a668d460647 +1 -0
  20. package/dist/templates/demo-store/.cache/content-v2/sha512/1e/24/595da822fb6e0d70b7a478b35192c23348911f81396b562a4c5d5ed52cf28ec3e9253496dc0e307da724bf0572b1e4c490b3c922af5b5c3ee13642b050ce +1 -0
  21. package/dist/templates/demo-store/.cache/content-v2/sha512/42/8e/b848de3b458a3ae29197f58d73db1dcd110d272982471001e4c049af15058851abe97b8671671c36918d87c97adde4c188df8648dc2f71128213dfc72dc2 +1 -0
  22. package/dist/templates/demo-store/.cache/content-v2/sha512/44/52/5bdf014389259b65ea3cf4ef77cbecdc3fe3f95487a53633fccd9dcf29e0eefcccc3a985ba720febd74aeb96e51259a3ccefc51c1c6d91f23fe362ad2bc9 +1 -0
  23. package/dist/templates/demo-store/.cache/content-v2/sha512/5c/12/8d5330d3dea4de70c4b434403ffd5c5083d7f2c2c68a2fc149bd066bc6cde6a75fcb5ab2b59772c72c108f42af3338ba95b69ab4248e1d1a7046e51607b7 +1 -0
  24. package/dist/templates/demo-store/.cache/content-v2/sha512/63/3a/fb02a5e332b2f3a90f634a25f88555704bfeaf5e371631306fcb0d0d548e3d2efd6b525bf62d54f8f0548b73cccabaa34ebb0d51e624bf67de37afb78c8c +1 -0
  25. package/dist/templates/demo-store/.cache/content-v2/sha512/73/40/c822831f11f08a9ceea944d0145b072ba6164a3e2e75f98fda5437cda6dfddf9ca9450445c1f3236228d6259ac95e4cde9bb6e5996490ed00b7b13b06121 +1 -0
  26. package/dist/templates/demo-store/.cache/content-v2/sha512/76/07/e5a2affb0d722624b151277bfa2c3cd26f1e5c0d3a11d5bb3ba745631b2e8fd1ade94990b19a6acb2805de34048a34c035406d4829bcf3f41a061b270d60 +1 -0
  27. package/dist/templates/demo-store/.cache/content-v2/sha512/86/ba/0dd1289bc16f8dda9cb229b7ffa7aa59c4bdba95e1352a0b61de02fccd726c0269d8cabeae04ffddf408f42491354e24866fe5801ee4bb1ea4b98cce482c +1 -0
  28. package/dist/templates/demo-store/.cache/content-v2/sha512/8e/7e/005894d7690ac4cc4f3301702083a6d900a8971af9f9f1b38dc4821809c3b6ed302521bfce7460c8673d38875c4187e3b9f59b5d4f4a399cc3869f5b0f55 +1 -0
  29. package/dist/templates/demo-store/.cache/content-v2/sha512/93/6b/e60098157f6bff8ba570cab2ffd97a14983109006f7fa87e4432728366f96dfb19e957d28754daa45f1b6cb2421d26ab59bbd5ce5a448d6102e8e662403d +1 -0
  30. package/dist/templates/demo-store/.cache/content-v2/sha512/95/3c/ad893b35be316318d41d6141e282cddf5d214b4c335d86498cea48f1ecf32c108a2d58f7aa4a51bdb309da5762afda4204a0551d1a203cf4e642f9669317 +1 -0
  31. package/dist/templates/demo-store/.cache/content-v2/sha512/9b/2b/829beb6526ccc7e54cfa51951fce87e756d17a2096b57011a441b2f9eb4f546e2a6cc650a872f033c5d38bb7b704b862e033212258ee5496c2c0c1cef0c8 +1 -0
  32. package/dist/templates/demo-store/.cache/content-v2/sha512/ae/9a/84c86ca2189f308cb995b8289870f41e4692da806538c67dbe3f4849718a6a7e712fa105aff5ceb5135d0eececf75ab7281e171975bf8ae1ace932046621 +1 -0
  33. package/dist/templates/demo-store/.cache/content-v2/sha512/ae/d9/a6fed1d3e4f1cd165a5a4dc633dbf277ea6cb6089b239cde32fef7d5d041590c05216207b5d6ad6b81d02865ce06b41670751940fd49c43b6bc80efc0076 +1 -0
  34. package/dist/templates/demo-store/.cache/content-v2/sha512/b1/56/584dd264cd440a690eaaaef18f8837dd5a32415fad319adbb289121c1812bcd34dfed87f66cd6ba3b4bf26bc988de0b19c32a593609e5656c9d8cfbc1b2c +1 -0
  35. package/dist/templates/demo-store/.cache/content-v2/sha512/b5/32/0a7d091d5e19d604dfc1702a81918fb1e21a5263eec2c443e1b0cc3b51d95dc894883dd5bf6851e27dfaf8566a9752d9fc24698cf77fbd692897eb0fb189 +1 -0
  36. package/dist/templates/demo-store/.cache/content-v2/sha512/bc/33/6e26ece5ac53d9eac9ac8a192ef39faf2a587a5808253c659fb1d371c477fc8074d428c8d1929b0d85dd1fec66fc79ea6b9fcb01507e2efec75fb7fbc2cc +1 -0
  37. package/dist/templates/demo-store/.cache/content-v2/sha512/d8/b5/26061c660a6fb2a2cabd1f7dcf701c984788ed6329891d8d540fa01b9b8ad4cda43fc436b61c0d76b687f1600ad46b59ea52da003b1e7edb4472f74399cb +1 -0
  38. package/dist/templates/demo-store/.cache/content-v2/sha512/e2/ab/e085c7b7942344631033fca463b3da5f58bb80e3a7f9e52140bb4ef3a46e1f10bb8aa1dbc401bec8718939075060c8acaf7a6e0b6e082f9b83f5a4590296 +1 -0
  39. package/dist/templates/demo-store/.cache/content-v2/sha512/e5/41/1521ee52031bdb29b551344ea7b79161701bfd506f12776bd0aca74255c38adae35405e44958ce8c6807f0a290e48aac6e28eb540dad3e62ae59dc487a8b +1 -0
  40. package/dist/templates/demo-store/.cache/content-v2/sha512/e8/ae/9b467e1d23913d4584d9417875b3cdc25f6dfed8b228f3a0c818129010b778aae1af1eb200b015ab428e79afe0ef1061262392fbdb96ed7da95efbe7f758 +1 -0
  41. package/dist/templates/demo-store/.cache/content-v2/sha512/ea/40/1c04ae276d1792713cf3118f13f0d73df08b3604b039412073447f7410c95a2a6567aca59d31b263cb9119085fba85d208f25b71b3c96ef151f418b7cd48 +1 -0
  42. package/dist/templates/demo-store/.cache/content-v2/sha512/ec/9a/4e2483d9a13faadd1cbcfe0ab70cdf87a838fe1cf04d11c56c478472e08f5b9e785654654d9b338c051fd762d20e23f14f2c1e110664815f1012c3ab8a08 +1 -0
  43. package/dist/templates/demo-store/.cache/content-v2/sha512/f0/62/eca4034f805cff0ae6d9c9f08128afa5e9bc40f2177b2ff2e8625187e02b6219e9b049300d2a90c7fe947873483161a8b2b040c1cd376d908a7e3e4cb8bf +1 -0
  44. package/dist/templates/demo-store/.cache/content-v2/sha512/f2/5f/9ccdef519bdb0a99e4f88d4c2c5a2acd4bf79507c81e4403263a875f093ad8d04dd863c4d610426a2974a4f95713c0cd9f29d06b294a6960c2cabffa6c42 +1 -0
  45. package/dist/templates/demo-store/.cache/content-v2/sha512/f4/ca/0f5ba83b2d5596d6f5917cab8ecedc1a457d62bf4988914f35161e4a4bd39a85030d1f69e2da82d9c2652985f7ca7c8ec2e79fe0235d534911543090b3c5 +1 -0
  46. package/dist/templates/demo-store/.cache/index-v5/05/44/bebd201ef5e9e9a7c41bd789ff110691a32c7f7fbbbdd630f33d96667cd1 +2 -0
  47. package/dist/templates/demo-store/.cache/index-v5/26/b5/113aeb17f9f4ef406a1f8b143895199ca545fd0cc1e7972435a092910963 +2 -0
  48. package/dist/templates/demo-store/.cache/index-v5/2c/09/e60b5cd818510e0cbec908aae3b74175e35e446f4383e87c21489433a11e +2 -0
  49. package/dist/templates/demo-store/.cache/index-v5/38/21/c3fb7841590b85142018ba88a01045ef1249ac34211342579f0129eae294 +2 -0
  50. package/dist/templates/demo-store/.cache/index-v5/3a/98/8858fe7de4bf85d37c71adc322cc95335b498bef9a4ae41db324bf5696cc +2 -0
  51. package/dist/templates/demo-store/.cache/index-v5/3e/40/7021422a7cae2c05484b491fb5b85edd82b325e598ac9e5c6afb858049da +2 -0
  52. package/dist/templates/demo-store/.cache/index-v5/47/2f/8e9ec62247eca3464d07de774855bb30a56145adc6525b907490e0c1bda0 +2 -0
  53. package/dist/templates/demo-store/.cache/index-v5/5e/83/14bed234cd143eaf4043de721fcf4250a5adc7008e76d663365e8a322c88 +2 -0
  54. package/dist/templates/demo-store/.cache/index-v5/5f/87/f79366b4aab5423acdda7930c6c989c49dd1c6607885df3afaa5e6873c9f +2 -0
  55. package/dist/templates/demo-store/.cache/index-v5/6e/9e/dc622ea9b5c66089a08f3e8b7a0e62a29e85bab337da0a3b28d6126185ec +2 -0
  56. package/dist/templates/demo-store/.cache/index-v5/71/4c/401eb7f3b2db5e56857a3ddd90e61181e636a5d01cc569ff8671ddf7f14b +2 -0
  57. package/dist/templates/demo-store/.cache/index-v5/79/2e/b0dd8fcd37a11ecb71cfd33184651560cabda672e55e0b244fc6f825190c +2 -0
  58. package/dist/templates/demo-store/.cache/index-v5/7b/e1/807e64f6a84e568bf9163283e9d49b77b24ff24bd8eed751d9fd94ea404a +2 -0
  59. package/dist/templates/demo-store/.cache/index-v5/85/07/e0c4be5b8442583f11be2d0b6f09171d22721437456b745eb2c977294995 +2 -0
  60. package/dist/templates/demo-store/.cache/index-v5/87/4d/89bc172664efe0dc7f86d8e67559073b2900ae079bd42ae9e3c015d38ab0 +2 -0
  61. package/dist/templates/demo-store/.cache/index-v5/8c/0d/a633a8771437b330d83eef0fdd99a81c41356b2bdc81f80ec9277f92b060 +2 -0
  62. package/dist/templates/demo-store/.cache/index-v5/a3/fc/e2e503290d165b9b0e20c6880bc23ff8ec39a440482418b5103c36be66b9 +2 -0
  63. package/dist/templates/demo-store/.cache/index-v5/a5/bc/d87ab9468457cb872d6c360f8acecd05e0f88b7239b50754f120706fabd4 +2 -0
  64. package/dist/templates/demo-store/.cache/index-v5/a5/c0/8e6e4f498a17b6198e54f204247ba544e6404b282d4ce3065d85fa69a8a4 +2 -0
  65. package/dist/templates/demo-store/.cache/index-v5/af/65/89b0c9eb41779c1658ace443604fea125c524bc95cfc71c9b6300da2dc81 +2 -0
  66. package/dist/templates/demo-store/.cache/index-v5/b2/75/51549baf010c977c70017db497fd9bd20e1efa9b658a6d52761c559f9c0b +2 -0
  67. package/dist/templates/demo-store/.cache/index-v5/bb/db/9dc2cbdcdc6ff352f9a34463a02e198aa2123a4c2e4ef37fea8b8ccae413 +2 -0
  68. package/dist/templates/demo-store/.cache/index-v5/c8/52/09bfbca72b45aec745fc339c27986edefa85e40bd69113275a6ecd6495e9 +2 -0
  69. package/dist/templates/demo-store/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +2 -0
  70. package/dist/templates/demo-store/.cache/index-v5/d3/ca/ff5860148f0bedafb91dab72b54462de81a32a21210324c45a051b197b48 +2 -0
  71. package/dist/templates/demo-store/.cache/index-v5/d4/55/296e80e87e2652f4cf1aebd5419fe73ef16c94ab20cd0400166d44ea1746 +2 -0
  72. package/dist/templates/demo-store/.cache/index-v5/da/7a/4b6977be684885e550a0d8fd21c955d0195371ffc3a9535a5a7b950a5ac9 +2 -0
  73. package/dist/templates/demo-store/.cache/index-v5/dd/aa/599a1cd855476ba058c63ae75a9c006ca11f7fbc2efc00b361d7f1b95cb4 +2 -0
  74. package/dist/templates/demo-store/.cache/index-v5/df/d2/bcfa3853e61309abab85dbd561dbc632ad0ea79b24f1b77c95f861eead5f +2 -0
  75. package/dist/templates/demo-store/.cache/index-v5/df/f5/cc3a1197c607eac768ab1b1cdb7b53a7f87b67c23c92da957d45a5bd0bda +2 -0
  76. package/dist/templates/demo-store/.cache/index-v5/e4/bd/743967c269ef70a14ba6b5dd223d26759eae9295d79f165c66f514b7d8d3 +2 -0
  77. package/dist/templates/demo-store/_env +6 -0
  78. package/dist/templates/demo-store/_gitignore +9 -0
  79. package/dist/templates/demo-store/app/components/AccountAddressBook.tsx +2 -2
  80. package/dist/templates/demo-store/app/components/AccountDetails.tsx +1 -1
  81. package/dist/templates/demo-store/app/components/AddToCartButton.tsx +1 -1
  82. package/dist/templates/demo-store/app/components/Cart.tsx +3 -3
  83. package/dist/templates/demo-store/app/components/CountrySelector.tsx +1 -1
  84. package/dist/templates/demo-store/app/components/FeaturedCollections.tsx +5 -5
  85. package/dist/templates/demo-store/app/components/FeaturedProducts.tsx +1 -1
  86. package/dist/templates/demo-store/app/components/FeaturedSection.tsx +1 -4
  87. package/dist/templates/demo-store/app/components/GenericError.tsx +1 -1
  88. package/dist/templates/demo-store/app/components/Hero.tsx +9 -16
  89. package/dist/templates/demo-store/app/components/Layout.tsx +43 -36
  90. package/dist/templates/demo-store/app/components/OrderCard.tsx +3 -6
  91. package/dist/templates/demo-store/app/components/Pagination.tsx +1 -1
  92. package/dist/templates/demo-store/app/components/ProductCard.tsx +6 -20
  93. package/dist/templates/demo-store/app/components/ProductGallery.tsx +2 -2
  94. package/dist/templates/demo-store/app/components/ProductGrid.tsx +1 -4
  95. package/dist/templates/demo-store/app/components/ProductSwimlane.tsx +1 -1
  96. package/dist/templates/demo-store/app/components/SortFilter.tsx +5 -2
  97. package/dist/templates/demo-store/app/data/fragments.ts +73 -0
  98. package/dist/templates/demo-store/app/lib/placeholders.ts +4 -2
  99. package/dist/templates/demo-store/app/lib/type.ts +1 -1
  100. package/dist/templates/demo-store/app/lib/utils.ts +1 -1
  101. package/dist/templates/demo-store/app/root.tsx +100 -22
  102. package/dist/templates/demo-store/app/routes/{$.tsx → ($lang)/$.tsx} +0 -0
  103. package/dist/templates/demo-store/app/routes/{[sitemap.xml].tsx → ($lang)/[sitemap.xml].tsx} +3 -3
  104. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__private/address/$id.tsx +124 -27
  105. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__private/edit.tsx +27 -5
  106. package/dist/templates/demo-store/app/routes/($lang)/account/__private/logout.ts +25 -0
  107. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__private/orders.$id.tsx +131 -13
  108. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__public/activate.$id.$activationToken.tsx +38 -7
  109. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__public/login.tsx +54 -4
  110. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__public/recover.tsx +20 -4
  111. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__public/register.tsx +33 -3
  112. package/dist/templates/demo-store/app/routes/{account → ($lang)/account}/__public/reset.$id.$resetToken.tsx +40 -8
  113. package/dist/templates/demo-store/app/routes/{account.tsx → ($lang)/account.tsx} +126 -17
  114. package/dist/templates/demo-store/app/routes/{api → ($lang)/api}/countries.tsx +0 -0
  115. package/dist/templates/demo-store/app/routes/{api → ($lang)/api}/products.tsx +6 -37
  116. package/dist/templates/demo-store/app/routes/{cart.tsx → ($lang)/cart.tsx} +24 -12
  117. package/dist/templates/demo-store/app/routes/{collections → ($lang)/collections}/$collectionHandle.tsx +28 -33
  118. package/dist/templates/demo-store/app/routes/{collections → ($lang)/collections}/all.tsx +0 -0
  119. package/dist/templates/demo-store/app/routes/{collections → ($lang)/collections}/index.tsx +9 -10
  120. package/dist/templates/demo-store/app/routes/{discounts.$code.tsx → ($lang)/discounts.$code.tsx} +0 -0
  121. package/dist/templates/demo-store/app/routes/{featured-products.tsx → ($lang)/featured-products.tsx} +5 -5
  122. package/dist/templates/demo-store/app/routes/{index.tsx → ($lang)/index.tsx} +54 -38
  123. package/dist/templates/demo-store/app/routes/{journal → ($lang)/journal}/$journalHandle.tsx +15 -17
  124. package/dist/templates/demo-store/app/routes/{journal → ($lang)/journal}/index.tsx +6 -7
  125. package/dist/templates/demo-store/app/routes/{pages → ($lang)/pages}/$pageHandle.tsx +13 -21
  126. package/dist/templates/demo-store/app/routes/{policies → ($lang)/policies}/$policyHandle.tsx +3 -4
  127. package/dist/templates/demo-store/app/routes/{policies → ($lang)/policies}/index.tsx +7 -19
  128. package/dist/templates/demo-store/app/routes/{products → ($lang)/products}/$productHandle.tsx +53 -20
  129. package/dist/templates/demo-store/app/routes/{products → ($lang)/products}/index.tsx +6 -15
  130. package/dist/templates/demo-store/app/routes/{search.tsx → ($lang)/search.tsx} +7 -14
  131. package/dist/templates/demo-store/app/styles/app.css +4117 -0
  132. package/dist/templates/demo-store/app/styles/custom-font.css +2 -2
  133. package/dist/templates/demo-store/{public → app/styles}/fonts/IBMPlexSerif-Text.woff2 +0 -0
  134. package/dist/templates/demo-store/{public → app/styles}/fonts/IBMPlexSerif-TextItalic.woff2 +0 -0
  135. package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
  136. package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
  137. package/dist/templates/demo-store/dist/client/build/_assets/app-5V46SKC6.css +1 -0
  138. package/dist/templates/demo-store/dist/client/build/_assets/custom-font-WVPOFKHF.css +1 -0
  139. package/dist/templates/demo-store/dist/client/build/_assets/favicon-5FIZBM2K.svg +28 -0
  140. package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js +2 -0
  141. package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js.map +7 -0
  142. package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js +9 -0
  143. package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js.map +7 -0
  144. package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js +2 -0
  145. package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js.map +7 -0
  146. package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js +2 -0
  147. package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js.map +7 -0
  148. package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js +31 -0
  149. package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js.map +7 -0
  150. package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js +2 -0
  151. package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js.map +7 -0
  152. package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js +72 -0
  153. package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js.map +7 -0
  154. package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js +2 -0
  155. package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js.map +7 -0
  156. package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js +7 -0
  157. package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js.map +7 -0
  158. package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js +25 -0
  159. package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js.map +7 -0
  160. package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js +2 -0
  161. package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js.map +7 -0
  162. package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js +2 -0
  163. package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js.map +7 -0
  164. package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js +2 -0
  165. package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js.map +7 -0
  166. package/dist/templates/demo-store/dist/client/build/manifest-1AF0BBA5.js +1 -0
  167. package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js +3 -0
  168. package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js.map +7 -0
  169. package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js +2 -0
  170. package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js.map +7 -0
  171. package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js +2 -0
  172. package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js.map +7 -0
  173. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js +2 -0
  174. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js.map +7 -0
  175. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js +2 -0
  176. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js.map +7 -0
  177. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js +2 -0
  178. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js.map +7 -0
  179. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js +2 -0
  180. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js.map +7 -0
  181. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js +2 -0
  182. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js.map +7 -0
  183. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js +2 -0
  184. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js.map +7 -0
  185. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js +2 -0
  186. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js.map +7 -0
  187. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js +2 -0
  188. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js.map +7 -0
  189. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js +2 -0
  190. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js.map +7 -0
  191. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js +2 -0
  192. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js.map +7 -0
  193. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js +2 -0
  194. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js.map +7 -0
  195. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js +18 -0
  196. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js.map +7 -0
  197. package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js +55 -0
  198. package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js.map +7 -0
  199. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js +83 -0
  200. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js.map +7 -0
  201. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js +2 -0
  202. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js.map +7 -0
  203. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js +2 -0
  204. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js.map +7 -0
  205. package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js +2 -0
  206. package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js.map +7 -0
  207. package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js +2 -0
  208. package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js.map +7 -0
  209. package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js +59 -0
  210. package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js.map +7 -0
  211. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js +2 -0
  212. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js.map +7 -0
  213. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js +2 -0
  214. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js.map +7 -0
  215. package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js +2 -0
  216. package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js.map +7 -0
  217. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js +2 -0
  218. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js.map +7 -0
  219. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js +2 -0
  220. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js.map +7 -0
  221. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js +102 -0
  222. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js.map +7 -0
  223. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js +24 -0
  224. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js.map +7 -0
  225. package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js +54 -0
  226. package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js.map +7 -0
  227. package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js +2 -0
  228. package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js.map +7 -0
  229. package/dist/templates/demo-store/dist/client/favicon.svg +28 -0
  230. package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
  231. package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
  232. package/dist/templates/demo-store/dist/worker/index.js +1352 -0
  233. package/dist/templates/demo-store/dist/worker/index.js.map +7 -0
  234. package/dist/templates/demo-store/package.json +6 -9
  235. package/dist/templates/demo-store/remix.env.d.ts +12 -6
  236. package/dist/templates/demo-store/remix.init/index.js +25 -0
  237. package/dist/templates/demo-store/remix.init/package.json +1 -1
  238. package/dist/templates/demo-store/server.ts +28 -42
  239. package/dist/templates/demo-store/tsconfig.json +1 -2
  240. package/dist/templates/graphiql.tsx +10 -0
  241. package/dist/templates/hello-world/.cache/content-v2/sha512/13/4d/016017e6bcf9be61273229516bd898b7df8dad06121807f9b80f1e2acca7e9790dcc476d08b81a899d8d29d38331b4a459d66f3c7f9dc4303ca2fcc167b7 +1 -0
  242. package/dist/templates/hello-world/.cache/content-v2/sha512/99/79/957d59c381e42c01e473b69a7befabebff88d7ae53269b038a7aca4993e3e773e6a1144223532f089df44c4d866af69317389a969681566e3e71ef5e023c +1 -0
  243. package/dist/templates/hello-world/.cache/index-v5/09/f6/fe4b05c4157320b8b59b3f84116195be0437d87357d743d21acd638a4606 +2 -0
  244. package/dist/templates/hello-world/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +2 -0
  245. package/dist/templates/hello-world/_env +6 -0
  246. package/dist/templates/hello-world/_gitignore +8 -0
  247. package/dist/templates/hello-world/app/components/Layout.tsx +29 -1
  248. package/dist/templates/hello-world/app/entry.server.tsx +4 -4
  249. package/dist/templates/hello-world/app/root.tsx +23 -131
  250. package/dist/templates/hello-world/app/routes/index.tsx +9 -0
  251. package/dist/templates/hello-world/dist/client/build/_assets/app-NBPUE4H5.css +1 -0
  252. package/dist/templates/hello-world/dist/client/build/_assets/favicon-5FIZBM2K.svg +28 -0
  253. package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js +31 -0
  254. package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js.map +7 -0
  255. package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js +2 -0
  256. package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js.map +7 -0
  257. package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js +9 -0
  258. package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js.map +7 -0
  259. package/dist/templates/hello-world/dist/client/build/manifest-8ABA8B0B.js +1 -0
  260. package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js +2 -0
  261. package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js.map +7 -0
  262. package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js +2 -0
  263. package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js.map +7 -0
  264. package/dist/templates/hello-world/dist/client/favicon.svg +28 -0
  265. package/dist/templates/hello-world/dist/worker/index.js +68 -0
  266. package/dist/templates/hello-world/dist/worker/index.js.map +7 -0
  267. package/dist/templates/hello-world/package.json +7 -6
  268. package/dist/templates/hello-world/remix.env.d.ts +12 -6
  269. package/dist/templates/hello-world/remix.init/index.js +25 -0
  270. package/dist/templates/hello-world/remix.init/package.json +7 -0
  271. package/dist/templates/hello-world/server.ts +29 -27
  272. package/dist/templates/index.tsx +7 -0
  273. package/dist/templates/pages/$pageHandle.tsx +74 -0
  274. package/dist/templates/policies/$policyHandle.tsx +87 -0
  275. package/dist/templates/policies/index.tsx +65 -0
  276. package/dist/templates/products/$productHandle.tsx +57 -0
  277. package/dist/tmp-create-app.js +33 -0
  278. package/dist/utils/check-lockfile.js +75 -0
  279. package/dist/utils/check-version.js +50 -0
  280. package/dist/utils/config.js +36 -54
  281. package/dist/utils/flags.js +3 -3
  282. package/dist/utils/mini-oxygen.js +3 -3
  283. package/dist/utils/missing-routes.js +68 -0
  284. package/dist/utils/virtual-routes.js +47 -0
  285. package/dist/utils/virtual-routes.test.js +46 -0
  286. package/dist/virtual-routes/assets/dummy.js +1 -0
  287. package/dist/virtual-routes/assets/dummy.ts +1 -0
  288. package/dist/virtual-routes/assets/favicon.svg +28 -0
  289. package/dist/virtual-routes/assets/styles.css +5 -0
  290. package/dist/virtual-routes/components/Layout.jsx +6 -0
  291. package/dist/virtual-routes/routes/graphiql.jsx +5 -0
  292. package/dist/virtual-routes/routes/index.jsx +12 -0
  293. package/dist/virtual-routes/virtual-root.jsx +38 -0
  294. package/oclif.manifest.json +1 -0
  295. package/package.json +19 -9
  296. package/dist/templates/demo-store/.turbo/turbo-build.log +0 -13
  297. package/dist/templates/demo-store/app/data/index.ts +0 -1037
  298. package/dist/templates/demo-store/app/lib/seo/common.tsx +0 -324
  299. package/dist/templates/demo-store/app/lib/seo/debugger.tsx +0 -175
  300. package/dist/templates/demo-store/app/lib/seo/image.tsx +0 -32
  301. package/dist/templates/demo-store/app/lib/seo/index.ts +0 -4
  302. package/dist/templates/demo-store/app/lib/seo/seo.tsx +0 -24
  303. package/dist/templates/demo-store/app/lib/seo/types.ts +0 -70
  304. package/dist/templates/demo-store/app/routes/$lang/$.tsx +0 -1
  305. package/dist/templates/demo-store/app/routes/$lang/[robots.txt].tsx +0 -1
  306. package/dist/templates/demo-store/app/routes/$lang/[sitemap.xml].tsx +0 -1
  307. package/dist/templates/demo-store/app/routes/$lang/account/__private/address/$id.tsx +0 -1
  308. package/dist/templates/demo-store/app/routes/$lang/account/__private/edit.tsx +0 -1
  309. package/dist/templates/demo-store/app/routes/$lang/account/__private/logout.ts +0 -1
  310. package/dist/templates/demo-store/app/routes/$lang/account/__private/orders.$id.tsx +0 -1
  311. package/dist/templates/demo-store/app/routes/$lang/account/__public/activate.$id.$activationToken.tsx +0 -6
  312. package/dist/templates/demo-store/app/routes/$lang/account/__public/login.tsx +0 -7
  313. package/dist/templates/demo-store/app/routes/$lang/account/__public/recover.tsx +0 -1
  314. package/dist/templates/demo-store/app/routes/$lang/account/__public/register.tsx +0 -6
  315. package/dist/templates/demo-store/app/routes/$lang/account/__public/reset.$id.$resetToken.tsx +0 -5
  316. package/dist/templates/demo-store/app/routes/$lang/account.tsx +0 -1
  317. package/dist/templates/demo-store/app/routes/$lang/api/countries.tsx +0 -1
  318. package/dist/templates/demo-store/app/routes/$lang/api/products.tsx +0 -1
  319. package/dist/templates/demo-store/app/routes/$lang/cart.tsx +0 -1
  320. package/dist/templates/demo-store/app/routes/$lang/collections/$collectionHandle.tsx +0 -6
  321. package/dist/templates/demo-store/app/routes/$lang/collections/all.tsx +0 -1
  322. package/dist/templates/demo-store/app/routes/$lang/collections/index.tsx +0 -1
  323. package/dist/templates/demo-store/app/routes/$lang/featured-products.tsx +0 -1
  324. package/dist/templates/demo-store/app/routes/$lang/index.tsx +0 -7
  325. package/dist/templates/demo-store/app/routes/$lang/journal/$journalHandle.tsx +0 -7
  326. package/dist/templates/demo-store/app/routes/$lang/journal/index.tsx +0 -1
  327. package/dist/templates/demo-store/app/routes/$lang/og-image.tsx +0 -1
  328. package/dist/templates/demo-store/app/routes/$lang/pages/$pageHandle.tsx +0 -1
  329. package/dist/templates/demo-store/app/routes/$lang/policies/$policyHandle.tsx +0 -1
  330. package/dist/templates/demo-store/app/routes/$lang/policies/index.tsx +0 -1
  331. package/dist/templates/demo-store/app/routes/$lang/products/$productHandle.tsx +0 -6
  332. package/dist/templates/demo-store/app/routes/$lang/products/index.tsx +0 -1
  333. package/dist/templates/demo-store/app/routes/$lang/search.tsx +0 -6
  334. package/dist/templates/demo-store/app/routes/account/__private/logout.ts +0 -29
  335. package/dist/templates/demo-store/app/routes/og-image.tsx +0 -19
  336. package/dist/templates/demo-store/package-lock.json +0 -25515
  337. package/dist/templates/demo-store/playwright.config.ts +0 -109
  338. package/dist/templates/demo-store/remix.config.js +0 -12
  339. package/dist/templates/demo-store/remix.init/index.ts +0 -15
  340. package/dist/templates/demo-store/tests/cart.test.ts +0 -70
  341. package/dist/templates/demo-store/tests/seo.test.ts +0 -36
  342. package/dist/templates/demo-store/tests/utils.ts +0 -100
  343. package/dist/templates/hello-world/.turbo/turbo-build.log +0 -9
  344. package/dist/templates/hello-world/package-lock.json +0 -27641
  345. package/tmp-create-app.mjs +0 -29
@@ -1,18 +1,18 @@
1
1
  import path from 'path';
2
- import * as remix from '@remix-run/dev/dist/compiler.js';
3
- import fsExtra from 'fs-extra';
4
2
  import { output } from '@shopify/cli-kit';
5
3
  import colors from '@shopify/cli-kit/node/colors';
6
4
  import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
7
- import { flags } from '../../utils/flags.js';
5
+ import { commonFlags } from '../../utils/flags.js';
8
6
  import Command from '@shopify/cli-kit/node/base-command';
9
- import { Flags } from '@oclif/core';
7
+ import Flags from '@oclif/core/lib/flags.js';
8
+ import { checkLockfileStatus } from '../../utils/check-lockfile.js';
9
+ import { findMissingRoutes } from '../../utils/missing-routes.js';
10
10
 
11
11
  const LOG_WORKER_BUILT = "\u{1F4E6} Worker built";
12
12
  class Build extends Command {
13
13
  static description = "Builds a Hydrogen storefront for production";
14
14
  static flags = {
15
- ...flags,
15
+ ...commonFlags,
16
16
  sourcemap: Flags.boolean({
17
17
  env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP"
18
18
  }),
@@ -20,21 +20,22 @@ class Build extends Command {
20
20
  env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP",
21
21
  required: true
22
22
  }),
23
- minify: Flags.boolean({
24
- description: "Minify the build output",
25
- env: "SHOPIFY_HYDROGEN_FLAG_MINIFY"
23
+ disableRouteWarning: Flags.boolean({
24
+ description: "Disable warning about missing standard routes",
25
+ env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_ROUTE_WARNING"
26
26
  })
27
27
  };
28
28
  async run() {
29
- const { flags: flags2 } = await this.parse(Build);
30
- const directory = flags2.path ? path.resolve(flags2.path) : process.cwd();
31
- await runBuild({ ...flags2, path: directory });
29
+ const { flags } = await this.parse(Build);
30
+ const directory = flags.path ? path.resolve(flags.path) : process.cwd();
31
+ await runBuild({ ...flags, path: directory });
32
32
  }
33
33
  }
34
34
  async function runBuild({
35
35
  entry,
36
+ path: appPath,
36
37
  sourcemap = true,
37
- path: appPath
38
+ disableRouteWarning = false
38
39
  }) {
39
40
  if (!process.env.NODE_ENV) {
40
41
  process.env.NODE_ENV = "production";
@@ -47,18 +48,24 @@ async function runBuild({
47
48
  buildPathWorkerFile,
48
49
  publicPath
49
50
  } = getProjectPaths(appPath, entry);
51
+ await checkLockfileStatus(root);
50
52
  console.time(LOG_WORKER_BUILT);
51
- const remixConfig = await getRemixConfig(root, entryFile, publicPath);
52
- await fsExtra.rm(buildPath, { force: true, recursive: true });
53
+ const { default: fsExtra } = await import('fs-extra');
54
+ const [remixConfig] = await Promise.all([
55
+ getRemixConfig(root, entryFile, publicPath),
56
+ fsExtra.rm(buildPath, { force: true, recursive: true })
57
+ ]);
53
58
  output.info(`
54
59
  \u{1F3D7}\uFE0F Building in ${process.env.NODE_ENV} mode...`);
60
+ const { build } = await import('@remix-run/dev/dist/compiler/build.js');
61
+ const { logCompileFailure } = await import('@remix-run/dev/dist/compiler/onCompileFailure.js');
55
62
  await Promise.all([
56
63
  copyPublicFiles(publicPath, buildPathClient),
57
- remix.build(remixConfig, {
64
+ build(remixConfig, {
58
65
  mode: process.env.NODE_ENV,
59
66
  sourcemap,
60
- onBuildFailure: (failure) => {
61
- remix.formatBuildFailure(failure);
67
+ onCompileFailure: (failure) => {
68
+ logCompileFailure(failure);
62
69
  throw Error();
63
70
  }
64
71
  })
@@ -78,8 +85,18 @@ async function runBuild({
78
85
  );
79
86
  }
80
87
  }
88
+ if (!disableRouteWarning) {
89
+ const missingRoutes = findMissingRoutes(remixConfig);
90
+ if (missingRoutes.length) {
91
+ output.warn(
92
+ "\u{1F6A8} Standard Shopify routes missing; run `shopify hydrogen check routes` for more details."
93
+ );
94
+ }
95
+ }
96
+ process.exit(0);
81
97
  }
82
- function copyPublicFiles(publicPath, buildPathClient) {
98
+ async function copyPublicFiles(publicPath, buildPathClient) {
99
+ const { default: fsExtra } = await import('fs-extra');
83
100
  return fsExtra.copy(publicPath, buildPathClient, {
84
101
  recursive: true,
85
102
  overwrite: true
@@ -0,0 +1,34 @@
1
+ import Command from '@shopify/cli-kit/node/base-command';
2
+ import { path } from '@shopify/cli-kit';
3
+ import { commonFlags } from '../../utils/flags.js';
4
+ import { getRemixConfig } from '../../utils/config.js';
5
+ import { logMissingRoutes, findMissingRoutes } from '../../utils/missing-routes.js';
6
+
7
+ class GenerateRoute extends Command {
8
+ static flags = {
9
+ path: commonFlags.path
10
+ };
11
+ static args = [
12
+ {
13
+ name: "resource",
14
+ description: `The resource to check. Currently only 'routes' is supported.`,
15
+ required: true,
16
+ options: ["routes"]
17
+ }
18
+ ];
19
+ async run() {
20
+ const { flags, args } = await this.parse(GenerateRoute);
21
+ const directory = flags.path ? path.resolve(flags.path) : process.cwd();
22
+ if (args.resource === "routes") {
23
+ await runCheckRoutes({ directory });
24
+ } else {
25
+ throw new Error("Invalid command argument.");
26
+ }
27
+ }
28
+ }
29
+ async function runCheckRoutes({ directory }) {
30
+ const remixConfig = await getRemixConfig(directory, "", "");
31
+ logMissingRoutes(findMissingRoutes(remixConfig));
32
+ }
33
+
34
+ export { GenerateRoute as default };
@@ -1,14 +1,15 @@
1
1
  import path from 'path';
2
- import fs from 'fs-extra';
3
- import * as remix from '@remix-run/dev/dist/compiler.js';
2
+ import fs from 'fs/promises';
4
3
  import { output } from '@shopify/cli-kit';
5
4
  import { copyPublicFiles } from './build.js';
6
5
  import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
7
6
  import { muteDevLogs } from '../../utils/log.js';
8
- import { flags } from '../../utils/flags.js';
7
+ import { commonFlags } from '../../utils/flags.js';
9
8
  import Command from '@shopify/cli-kit/node/base-command';
10
- import { Flags } from '@oclif/core';
9
+ import Flags from '@oclif/core/lib/flags.js';
11
10
  import { startMiniOxygen } from '../../utils/mini-oxygen.js';
11
+ import { checkHydrogenVersion } from '../../utils/check-version.js';
12
+ import { addVirtualRoutes } from '../../utils/virtual-routes.js';
12
13
 
13
14
  const LOG_INITIAL_BUILD = "\n\u{1F3C1} Initial build";
14
15
  const LOG_REBUILDING = "\u{1F9F1} Rebuilding...";
@@ -16,7 +17,7 @@ const LOG_REBUILT = "\u{1F680} Rebuilt";
16
17
  class Dev extends Command {
17
18
  static description = "Runs Hydrogen storefront in a MiniOxygen worker in development";
18
19
  static flags = {
19
- ...flags,
20
+ ...commonFlags,
20
21
  port: Flags.integer({
21
22
  description: "Port to run the preview server on",
22
23
  env: "SHOPIFY_HYDROGEN_FLAG_PORT",
@@ -25,49 +26,55 @@ class Dev extends Command {
25
26
  entry: Flags.string({
26
27
  env: "SHOPIFY_HYDROGEN_FLAG_ENTRY",
27
28
  required: true
29
+ }),
30
+ disableVirtualRoutes: Flags.boolean({
31
+ env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",
32
+ default: false
28
33
  })
29
34
  };
30
35
  async run() {
31
- const { flags: flags2 } = await this.parse(Dev);
32
- const directory = flags2.path ? path.resolve(flags2.path) : process.cwd();
33
- await runDev({ ...flags2, path: directory });
36
+ const { flags } = await this.parse(Dev);
37
+ const directory = flags.path ? path.resolve(flags.path) : process.cwd();
38
+ await runDev({ ...flags, path: directory });
34
39
  }
35
40
  }
36
41
  async function runDev({
37
42
  entry,
38
43
  port,
39
- path: appPath
44
+ path: appPath,
45
+ disableVirtualRoutes
40
46
  }) {
41
47
  if (!process.env.NODE_ENV)
42
48
  process.env.NODE_ENV = "development";
43
49
  muteDevLogs();
44
- await compileAndWatch(getProjectPaths(appPath, entry), { port });
50
+ await compileAndWatch(entry, appPath, port, disableVirtualRoutes);
45
51
  }
46
- async function compileAndWatch(projectPaths, options = {}, isInit = true) {
47
- isInit && console.time(LOG_INITIAL_BUILD);
48
- const { root, entryFile, publicPath, buildPathClient, buildPathWorkerFile } = projectPaths;
49
- const shouldReloadRemixApp = (file) => file.startsWith(path.resolve(root, "remix.config.")) || process.env.LOCAL_DEV && (file.includes(path.resolve("/hydrogen/src/templates/")) || file.includes(path.resolve("/hydrogen/dist/build/index.js")));
50
- const remixConfig = await getRemixConfig(
51
- root,
52
- entryFile,
53
- publicPath,
54
- options.cacheBust
55
- );
52
+ async function compileAndWatch(entry, appPath, port, disableVirtualRoutes = false) {
53
+ console.time(LOG_INITIAL_BUILD);
54
+ const { root, entryFile, publicPath, buildPathClient, buildPathWorkerFile } = getProjectPaths(appPath, entry);
55
+ const checkingHydrogenVersion = checkHydrogenVersion(root);
56
56
  const copyingFiles = copyPublicFiles(publicPath, buildPathClient);
57
- const stopCompileWatcher = await remix.watch(remixConfig, {
57
+ const reloadConfig = async () => {
58
+ const config = await getRemixConfig(root, entryFile, publicPath);
59
+ return disableVirtualRoutes ? config : addVirtualRoutes(config);
60
+ };
61
+ const { watch } = await import('@remix-run/dev/dist/compiler/watch.js');
62
+ await watch(await reloadConfig(), {
63
+ reloadConfig,
58
64
  mode: process.env.NODE_ENV,
59
65
  async onInitialBuild() {
60
66
  await copyingFiles;
61
- if (isInit) {
62
- console.timeEnd(LOG_INITIAL_BUILD);
63
- await startMiniOxygen({
64
- root,
65
- port: options.port,
66
- watch: true,
67
- buildPathWorkerFile,
68
- buildPathClient
69
- });
70
- }
67
+ console.timeEnd(LOG_INITIAL_BUILD);
68
+ await startMiniOxygen({
69
+ root,
70
+ port,
71
+ watch: true,
72
+ buildPathWorkerFile,
73
+ buildPathClient
74
+ });
75
+ const showUpgrade = await checkingHydrogenVersion;
76
+ if (showUpgrade)
77
+ showUpgrade();
71
78
  },
72
79
  async onFileCreated(file) {
73
80
  output.info(`
@@ -75,9 +82,6 @@ async function compileAndWatch(projectPaths, options = {}, isInit = true) {
75
82
  if (file.startsWith(publicPath)) {
76
83
  await copyPublicFiles(file, file.replace(publicPath, buildPathClient));
77
84
  }
78
- if (shouldReloadRemixApp(file)) {
79
- await reloadRemixApp(file);
80
- }
81
85
  },
82
86
  async onFileChanged(file) {
83
87
  output.info(`
@@ -85,9 +89,6 @@ async function compileAndWatch(projectPaths, options = {}, isInit = true) {
85
89
  if (file.startsWith(publicPath)) {
86
90
  await copyPublicFiles(file, file.replace(publicPath, buildPathClient));
87
91
  }
88
- if (shouldReloadRemixApp(file)) {
89
- await reloadRemixApp(file);
90
- }
91
92
  },
92
93
  async onFileDeleted(file) {
93
94
  output.info(`
@@ -95,9 +96,6 @@ async function compileAndWatch(projectPaths, options = {}, isInit = true) {
95
96
  if (file.startsWith(publicPath)) {
96
97
  await fs.unlink(file.replace(publicPath, buildPathClient));
97
98
  }
98
- if (shouldReloadRemixApp(file)) {
99
- await reloadRemixApp(file);
100
- }
101
99
  },
102
100
  onRebuildStart() {
103
101
  output.info(LOG_REBUILDING);
@@ -107,10 +105,6 @@ async function compileAndWatch(projectPaths, options = {}, isInit = true) {
107
105
  console.timeEnd(LOG_REBUILT);
108
106
  }
109
107
  });
110
- async function reloadRemixApp(cacheBust) {
111
- await stopCompileWatcher();
112
- compileAndWatch(projectPaths, { ...options, cacheBust }, false);
113
- }
114
108
  }
115
109
 
116
110
  export { Dev as default, runDev };
@@ -0,0 +1,174 @@
1
+ import Command from '@shopify/cli-kit/node/base-command';
2
+ import { path, error, file, ui } from '@shopify/cli-kit';
3
+ import { renderSuccess } from '@shopify/cli-kit/node/ui';
4
+ import { commonFlags } from '../../../utils/flags.js';
5
+ import Flags from '@oclif/core/lib/flags.js';
6
+ import ts from 'typescript';
7
+ import prettier from 'prettier';
8
+
9
+ const ROUTE_MAP = {
10
+ page: "/pages/$pageHandle",
11
+ cart: "/cart",
12
+ products: "/products/$productHandle",
13
+ collections: "/collections/$collectionHandle",
14
+ policies: ["/policies/index", "/policies/$policyHandle"],
15
+ robots: "/[robots.txt]",
16
+ sitemap: "/[sitemap.xml]",
17
+ account: ["/account/login", "/account/register"]
18
+ };
19
+ const ROUTES = [...Object.keys(ROUTE_MAP), "all"];
20
+ class GenerateRoute extends Command {
21
+ static flags = {
22
+ path: commonFlags.path,
23
+ adapter: Flags.string({
24
+ description: "The Remix adapter for imports in the template (default: @shopify/remix-oxygen)",
25
+ env: "SHOPIFY_HYDROGEN_FLAG_ADAPTER"
26
+ }),
27
+ force: Flags.boolean({
28
+ char: "f",
29
+ description: "Overwrite existing files",
30
+ env: "SHOPIFY_HYDROGEN_FLAG_FORCE"
31
+ })
32
+ };
33
+ static args = [
34
+ {
35
+ name: "route",
36
+ description: `The route to generate a route for.`,
37
+ required: true,
38
+ options: ROUTES,
39
+ env: "SHOPIFY_HYDROGEN_ARG_ROUTE"
40
+ }
41
+ ];
42
+ async run() {
43
+ const result = /* @__PURE__ */ new Map();
44
+ const { flags, args } = await this.parse(GenerateRoute);
45
+ const directory = flags.path ? path.resolve(flags.path) : process.cwd();
46
+ const { route } = args;
47
+ const routePath = route === "all" ? Object.values(ROUTE_MAP).flat() : ROUTE_MAP[route];
48
+ if (!routePath) {
49
+ throw new error.Abort(
50
+ `No template generator found for ${route}. Try one of ${ROUTES.join()}`
51
+ );
52
+ }
53
+ const isTypescript = await file.exists(
54
+ path.join(directory, "tsconfig.json")
55
+ );
56
+ const routesArray = Array.isArray(routePath) ? routePath : [routePath];
57
+ try {
58
+ for (const item of routesArray) {
59
+ result.set(
60
+ item,
61
+ await runGenerate(item, {
62
+ directory,
63
+ typescript: isTypescript,
64
+ force: flags.force,
65
+ adapter: flags.adapter
66
+ })
67
+ );
68
+ }
69
+ } catch (err) {
70
+ throw new error.Abort(err.message);
71
+ }
72
+ const extension = isTypescript ? ".tsx" : ".jsx";
73
+ const success = Array.from(result.values()).filter(
74
+ (result2) => result2.operation !== "skipped"
75
+ );
76
+ renderSuccess({
77
+ headline: `${success.length} of ${result.size} route${result.size > 1 ? "s" : ""} generated`,
78
+ body: Array.from(result.entries()).map(([path2, result2]) => {
79
+ const { operation } = result2;
80
+ return `\u2022 [${operation}] app/routes${path2}${extension}`;
81
+ }).join("\n")
82
+ });
83
+ }
84
+ }
85
+ async function runGenerate(route, {
86
+ directory,
87
+ typescript,
88
+ force,
89
+ adapter,
90
+ templatesRoot = new URL("../../../", import.meta.url).pathname
91
+ }) {
92
+ const extension = typescript ? ".tsx" : ".jsx";
93
+ const templatePath = path.join(templatesRoot, "templates", `${route}.tsx`);
94
+ const destinationPath = path.join(
95
+ directory,
96
+ "app",
97
+ "routes",
98
+ `${route}${extension}`
99
+ );
100
+ const relativeDestinationPath = path.relative(directory, destinationPath);
101
+ if (!force && await file.exists(destinationPath)) {
102
+ const options = [
103
+ { name: "No", value: "skip" },
104
+ { name: `Yes`, value: "overwrite" }
105
+ ];
106
+ const choice = await ui.prompt([
107
+ {
108
+ type: "select",
109
+ name: "value",
110
+ message: `The file ${path.relativize(
111
+ relativeDestinationPath
112
+ )} already exists. Do you want to overwrite it?`,
113
+ choices: options
114
+ }
115
+ ]);
116
+ return {
117
+ operation: choice.value === "skip" ? "skipped" : "overwritten"
118
+ };
119
+ }
120
+ let templateContent = await file.read(templatePath);
121
+ if (!typescript) {
122
+ const config = await file.exists(path.join(directory, "jsconfig.json")) ? await import(path.join(directory, "jsconfig.json")) : {
123
+ lib: ["DOM", "DOM.Iterable", "ES2022"],
124
+ isolatedModules: true,
125
+ esModuleInterop: true,
126
+ resolveJsonModule: true,
127
+ target: "ES2022",
128
+ strict: true,
129
+ allowJs: true,
130
+ forceConsistentCasingInFileNames: true,
131
+ skipLibCheck: true
132
+ };
133
+ const withArtificialNewLines = escapeNewLines(templateContent);
134
+ const compiled = compile(withArtificialNewLines, config);
135
+ templateContent = restoreNewLines(compiled.outputText);
136
+ }
137
+ if (adapter) {
138
+ templateContent = templateContent.replace(
139
+ /@shopify\/remix-oxygen/g,
140
+ adapter
141
+ );
142
+ }
143
+ templateContent = await format(templateContent, destinationPath);
144
+ if (!await file.exists(path.dirname(destinationPath))) {
145
+ await file.mkdir(path.dirname(destinationPath));
146
+ }
147
+ await file.write(destinationPath, templateContent);
148
+ return {
149
+ operation: "generated"
150
+ };
151
+ }
152
+ const escapeNewLines = (code) => code.replace(/\n\n/g, "\n/* :newline: */");
153
+ const restoreNewLines = (code) => code.replace(/\/\* :newline: \*\//g, "\n");
154
+ function compile(code, options = {}) {
155
+ return ts.transpileModule(code, {
156
+ reportDiagnostics: false,
157
+ compilerOptions: {
158
+ ...options,
159
+ jsx: 1,
160
+ removeComments: false
161
+ }
162
+ });
163
+ }
164
+ async function format(content, filePath) {
165
+ const config = await prettier.resolveConfig(filePath) || {};
166
+ const ext = path.extname(filePath);
167
+ const formattedContent = await prettier.format(content, {
168
+ parser: ext === ".tsx" || ext === ".ts" ? "typescript" : "babel",
169
+ ...config
170
+ });
171
+ return formattedContent;
172
+ }
173
+
174
+ export { GenerateRoute as default, runGenerate };
@@ -0,0 +1,121 @@
1
+ import { describe, beforeEach, vi, it, expect } from 'vitest';
2
+ import { temporaryDirectoryTask } from 'tempy';
3
+ import { runGenerate } from './route.js';
4
+ import { file, path, ui } from '@shopify/cli-kit';
5
+
6
+ describe("generate/route", () => {
7
+ beforeEach(() => {
8
+ vi.resetAllMocks();
9
+ vi.mock("@shopify/cli-kit", async () => {
10
+ const cliKit = await vi.importActual("@shopify/cli-kit");
11
+ return {
12
+ ...cliKit,
13
+ output: {
14
+ ...cliKit.output,
15
+ success: vi.fn()
16
+ },
17
+ ui: {
18
+ prompt: vi.fn()
19
+ }
20
+ };
21
+ });
22
+ });
23
+ it("generates a route file", async () => {
24
+ await temporaryDirectoryTask(async (tmpDir) => {
25
+ const route = "pages/$pageHandle";
26
+ const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
27
+ files: [],
28
+ templates: [[route, 'const str = "hello world"']]
29
+ });
30
+ await runGenerate(route, {
31
+ directory: appRoot,
32
+ templatesRoot
33
+ });
34
+ expect(
35
+ await file.read(path.join(appRoot, "app/routes", `${route}.jsx`))
36
+ ).toContain('const str = "hello world"');
37
+ });
38
+ });
39
+ it("produces a typescript file when typescript argument is true", async () => {
40
+ await temporaryDirectoryTask(async (tmpDir) => {
41
+ const route = "pages/$pageHandle";
42
+ const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
43
+ files: [],
44
+ templates: [[route, 'const str = "hello typescript"']]
45
+ });
46
+ await runGenerate(route, {
47
+ directory: appRoot,
48
+ templatesRoot,
49
+ typescript: true
50
+ });
51
+ expect(
52
+ await file.read(path.join(appRoot, "app/routes", `${route}.tsx`))
53
+ ).toContain('const str = "hello typescript"');
54
+ });
55
+ });
56
+ it("prompts the user if there the file already exists", async () => {
57
+ await temporaryDirectoryTask(async (tmpDir) => {
58
+ vi.mocked(ui.prompt).mockImplementationOnce(async () => {
59
+ return { value: "overwrite" };
60
+ });
61
+ const route = "page/$pageHandle";
62
+ const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
63
+ files: [[`app/routes/${route}.jsx`, 'const str = "I exist"']],
64
+ templates: [[route, 'const str = "hello world"']]
65
+ });
66
+ await runGenerate(route, {
67
+ directory: appRoot,
68
+ templatesRoot
69
+ });
70
+ expect(ui.prompt).toHaveBeenCalledWith(
71
+ expect.arrayContaining([
72
+ expect.objectContaining({
73
+ message: expect.stringContaining("already exists")
74
+ })
75
+ ])
76
+ );
77
+ });
78
+ });
79
+ it("does not prompt the user if the force property is true", async () => {
80
+ await temporaryDirectoryTask(async (tmpDir) => {
81
+ vi.mocked(ui.prompt).mockImplementationOnce(async () => {
82
+ return { value: "overwrite" };
83
+ });
84
+ const route = "page/$pageHandle";
85
+ const { appRoot, templatesRoot } = await createHydrogen(tmpDir, {
86
+ files: [[`app/routes/${route}.jsx`, 'const str = "I exist"']],
87
+ templates: [[route, 'const str = "hello world"']]
88
+ });
89
+ await runGenerate(route, {
90
+ directory: appRoot,
91
+ templatesRoot,
92
+ force: true
93
+ });
94
+ expect(ui.prompt).not.toHaveBeenCalled();
95
+ });
96
+ });
97
+ });
98
+ async function createHydrogen(directory, {
99
+ files,
100
+ templates
101
+ } = {
102
+ files: [],
103
+ templates: []
104
+ }) {
105
+ for (const item of files) {
106
+ const [filePath, fileContent] = item;
107
+ const fullFilePath = path.join(directory, "app", filePath);
108
+ await file.mkdir(path.dirname(fullFilePath));
109
+ await file.write(fullFilePath, fileContent);
110
+ }
111
+ for (const item of templates) {
112
+ const [filePath, fileContent] = item;
113
+ const fullFilePath = path.join(directory, "templates", `${filePath}.tsx`);
114
+ await file.mkdir(path.dirname(fullFilePath));
115
+ await file.write(fullFilePath, fileContent);
116
+ }
117
+ return {
118
+ appRoot: path.join(directory, "app"),
119
+ templatesRoot: directory
120
+ };
121
+ }
@@ -1,6 +1,5 @@
1
- import { cli } from '@remix-run/dev';
2
1
  import Command from '@shopify/cli-kit/node/base-command';
3
- import { Flags } from '@oclif/core';
2
+ import Flags from '@oclif/core/lib/flags.js';
4
3
 
5
4
  class Init extends Command {
6
5
  static description = "Creates a new Hydrogen storefront project";
@@ -24,7 +23,7 @@ class Init extends Command {
24
23
  await runInit({ ...flags });
25
24
  }
26
25
  }
27
- function runInit({
26
+ async function runInit({
28
27
  template,
29
28
  typescript,
30
29
  token
@@ -33,9 +32,10 @@ function runInit({
33
32
  "--template",
34
33
  template,
35
34
  "--install",
36
- typescript ? "--typescript" : "",
35
+ typescript ? "--typescript" : "--no-typescript",
37
36
  token ? `--token ${token}` : ""
38
37
  ];
38
+ const { cli } = await import('@remix-run/dev');
39
39
  cli.run(["create", ...defaults]);
40
40
  }
41
41
 
@@ -1,18 +1,18 @@
1
1
  import Command from '@shopify/cli-kit/node/base-command';
2
2
  import { muteDevLogs } from '../../utils/log.js';
3
3
  import { getProjectPaths } from '../../utils/config.js';
4
- import { flags } from '../../utils/flags.js';
4
+ import { commonFlags } from '../../utils/flags.js';
5
5
  import { startMiniOxygen } from '../../utils/mini-oxygen.js';
6
6
 
7
7
  class Preview extends Command {
8
8
  static description = "Runs an existing Hydrogen storefront build in a MiniOxygen worker";
9
9
  static flags = {
10
- paths: flags.path,
11
- port: flags.port
10
+ paths: commonFlags.path,
11
+ port: commonFlags.port
12
12
  };
13
13
  async run() {
14
- const { flags: flags2 } = await this.parse(Preview);
15
- await runPreview({ ...flags2 });
14
+ const { flags } = await this.parse(Preview);
15
+ await runPreview({ ...flags });
16
16
  }
17
17
  }
18
18
  async function runPreview({
@@ -21,8 +21,8 @@ async function runPreview({
21
21
  }) {
22
22
  if (!process.env.NODE_ENV)
23
23
  process.env.NODE_ENV = "production";
24
- const { root, buildPathWorkerFile, buildPathClient } = getProjectPaths(appPath);
25
24
  muteDevLogs({ workerReload: false });
25
+ const { root, buildPathWorkerFile, buildPathClient } = getProjectPaths(appPath);
26
26
  await startMiniOxygen({
27
27
  root,
28
28
  port,
@@ -3,10 +3,7 @@ import { output } from '@shopify/cli-kit';
3
3
 
4
4
  const EXPERIMENTAL_VM_MODULES_FLAG = "--experimental-vm-modules";
5
5
  const hook = async function(options) {
6
- if (!options.id || !["hydrogen:dev", "hydrogen:preview"].includes(options.id)) {
7
- return;
8
- }
9
- if (!process.execArgv.includes(EXPERIMENTAL_VM_MODULES_FLAG) && !(process.env.NODE_OPTIONS ?? "").includes(EXPERIMENTAL_VM_MODULES_FLAG)) {
6
+ if (options.id && ["hydrogen:dev", "hydrogen:preview"].includes(options.id) && !process.execArgv.includes(EXPERIMENTAL_VM_MODULES_FLAG) && !(process.env.NODE_OPTIONS ?? "").includes(EXPERIMENTAL_VM_MODULES_FLAG)) {
10
7
  output.debug(
11
8
  `Restarting CLI process with ${EXPERIMENTAL_VM_MODULES_FLAG} flag.`
12
9
  );