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

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 (346) hide show
  1. package/dist/commands/hydrogen/build.d.ts +23 -0
  2. package/dist/commands/hydrogen/build.js +38 -21
  3. package/dist/commands/hydrogen/check.d.ts +18 -0
  4. package/dist/commands/hydrogen/check.js +1 -0
  5. package/dist/commands/hydrogen/dev.d.ts +21 -0
  6. package/dist/commands/hydrogen/dev.js +10 -15
  7. package/dist/commands/hydrogen/generate/route.d.ts +33 -0
  8. package/dist/commands/hydrogen/generate/route.js +51 -62
  9. package/dist/commands/hydrogen/generate/route.test.d.ts +1 -0
  10. package/dist/commands/hydrogen/generate/routes.d.ts +16 -0
  11. package/dist/commands/hydrogen/generate/routes.js +22 -0
  12. package/dist/commands/hydrogen/init.d.ts +22 -0
  13. package/dist/commands/hydrogen/init.js +169 -25
  14. package/dist/commands/hydrogen/preview.d.ts +17 -0
  15. package/dist/commands/hydrogen/preview.js +2 -2
  16. package/dist/create-app.d.ts +1 -0
  17. package/dist/create-app.js +4 -0
  18. package/dist/{templates → generator-templates/routes}/[robots.txt].tsx +0 -0
  19. package/dist/{templates → generator-templates/routes}/[sitemap.xml].tsx +0 -0
  20. package/dist/{templates → generator-templates/routes}/account/login.tsx +0 -0
  21. package/dist/{templates → generator-templates/routes}/account/register.tsx +0 -0
  22. package/dist/{templates → generator-templates/routes}/cart.tsx +0 -0
  23. package/dist/{templates → generator-templates/routes}/collections/$collectionHandle.tsx +0 -0
  24. package/dist/{templates → generator-templates/routes}/graphiql.tsx +0 -0
  25. package/dist/{templates → generator-templates/routes}/index.tsx +0 -0
  26. package/dist/{templates → generator-templates/routes}/pages/$pageHandle.tsx +0 -0
  27. package/dist/{templates → generator-templates/routes}/policies/$policyHandle.tsx +0 -0
  28. package/dist/{templates → generator-templates/routes}/policies/index.tsx +0 -0
  29. package/dist/{templates → generator-templates/routes}/products/$productHandle.tsx +0 -0
  30. package/dist/hooks/init.d.ts +5 -0
  31. package/dist/utils/check-lockfile.d.ts +3 -0
  32. package/dist/utils/check-version.d.ts +3 -0
  33. package/dist/utils/config.d.ts +14 -0
  34. package/dist/utils/flags.d.ts +11 -0
  35. package/dist/utils/flags.js +20 -3
  36. package/dist/utils/flags.test.d.ts +1 -0
  37. package/dist/utils/flags.test.js +18 -0
  38. package/dist/utils/log.d.ts +5 -0
  39. package/dist/utils/mini-oxygen.d.ts +11 -0
  40. package/dist/utils/mini-oxygen.js +4 -1
  41. package/dist/utils/missing-routes.d.ts +6 -0
  42. package/dist/utils/template-downloader.d.ts +11 -0
  43. package/dist/utils/template-downloader.js +66 -0
  44. package/dist/utils/transpile-ts.d.ts +16 -0
  45. package/dist/utils/transpile-ts.js +161 -0
  46. package/dist/utils/virtual-routes.d.ts +7 -0
  47. package/dist/utils/virtual-routes.test.d.ts +1 -0
  48. package/dist/virtual-routes/assets/dummy.d.ts +1 -0
  49. package/oclif.manifest.json +1 -1
  50. package/package.json +17 -2
  51. package/dist/templates/demo-store/.cache/content-v2/sha512/02/76/13bbea15bb42b81a204b0dc5f14726e0bfa8d012a7b284f887cc2e3c92195d6b07a78f199f990b311ca5fafa9079563503cdd81808cd9b7e496d86c72732 +0 -1
  52. package/dist/templates/demo-store/.cache/content-v2/sha512/04/98/0e81e9c8b9ebe79605df3bf2476728954d7ad01229239c4acbaaefe8e2aa6558b7a08b14cd245365258a7ef2191a7b1d656ae081cc1d129662476f547e96 +0 -1
  53. package/dist/templates/demo-store/.cache/content-v2/sha512/0d/2c/9c0b3f348e40c09b984fbb9d08a1e983e86b4ee155baf87d0fd2428689357600b1f0d71d1edcc0b7381c27eaa024e58b2b76f5a3ed14f836f0f17b0a9b0c +0 -1
  54. package/dist/templates/demo-store/.cache/content-v2/sha512/18/ed/a944ad29223f60420de387c0325270e1a26f7826a52c813bf5dd319660be2c1cf779dbd9be17aae3c9cd24baa75ddd411fd0674a0e4664b69e6115bf73ed +0 -1
  55. package/dist/templates/demo-store/.cache/content-v2/sha512/19/32/725ad9da4e9155ebe89c04ce462b0ced1a34e836fa4d0b8829baaf369979e173477fc3468eb1fc91562fbc7abef2a51dda6398a65dd490111a668d460647 +0 -1
  56. package/dist/templates/demo-store/.cache/content-v2/sha512/1e/24/595da822fb6e0d70b7a478b35192c23348911f81396b562a4c5d5ed52cf28ec3e9253496dc0e307da724bf0572b1e4c490b3c922af5b5c3ee13642b050ce +0 -1
  57. package/dist/templates/demo-store/.cache/content-v2/sha512/42/8e/b848de3b458a3ae29197f58d73db1dcd110d272982471001e4c049af15058851abe97b8671671c36918d87c97adde4c188df8648dc2f71128213dfc72dc2 +0 -1
  58. package/dist/templates/demo-store/.cache/content-v2/sha512/44/52/5bdf014389259b65ea3cf4ef77cbecdc3fe3f95487a53633fccd9dcf29e0eefcccc3a985ba720febd74aeb96e51259a3ccefc51c1c6d91f23fe362ad2bc9 +0 -1
  59. package/dist/templates/demo-store/.cache/content-v2/sha512/5c/12/8d5330d3dea4de70c4b434403ffd5c5083d7f2c2c68a2fc149bd066bc6cde6a75fcb5ab2b59772c72c108f42af3338ba95b69ab4248e1d1a7046e51607b7 +0 -1
  60. package/dist/templates/demo-store/.cache/content-v2/sha512/63/3a/fb02a5e332b2f3a90f634a25f88555704bfeaf5e371631306fcb0d0d548e3d2efd6b525bf62d54f8f0548b73cccabaa34ebb0d51e624bf67de37afb78c8c +0 -1
  61. package/dist/templates/demo-store/.cache/content-v2/sha512/73/40/c822831f11f08a9ceea944d0145b072ba6164a3e2e75f98fda5437cda6dfddf9ca9450445c1f3236228d6259ac95e4cde9bb6e5996490ed00b7b13b06121 +0 -1
  62. package/dist/templates/demo-store/.cache/content-v2/sha512/76/07/e5a2affb0d722624b151277bfa2c3cd26f1e5c0d3a11d5bb3ba745631b2e8fd1ade94990b19a6acb2805de34048a34c035406d4829bcf3f41a061b270d60 +0 -1
  63. package/dist/templates/demo-store/.cache/content-v2/sha512/86/ba/0dd1289bc16f8dda9cb229b7ffa7aa59c4bdba95e1352a0b61de02fccd726c0269d8cabeae04ffddf408f42491354e24866fe5801ee4bb1ea4b98cce482c +0 -1
  64. package/dist/templates/demo-store/.cache/content-v2/sha512/8e/7e/005894d7690ac4cc4f3301702083a6d900a8971af9f9f1b38dc4821809c3b6ed302521bfce7460c8673d38875c4187e3b9f59b5d4f4a399cc3869f5b0f55 +0 -1
  65. package/dist/templates/demo-store/.cache/content-v2/sha512/93/6b/e60098157f6bff8ba570cab2ffd97a14983109006f7fa87e4432728366f96dfb19e957d28754daa45f1b6cb2421d26ab59bbd5ce5a448d6102e8e662403d +0 -1
  66. package/dist/templates/demo-store/.cache/content-v2/sha512/95/3c/ad893b35be316318d41d6141e282cddf5d214b4c335d86498cea48f1ecf32c108a2d58f7aa4a51bdb309da5762afda4204a0551d1a203cf4e642f9669317 +0 -1
  67. package/dist/templates/demo-store/.cache/content-v2/sha512/9b/2b/829beb6526ccc7e54cfa51951fce87e756d17a2096b57011a441b2f9eb4f546e2a6cc650a872f033c5d38bb7b704b862e033212258ee5496c2c0c1cef0c8 +0 -1
  68. package/dist/templates/demo-store/.cache/content-v2/sha512/ae/9a/84c86ca2189f308cb995b8289870f41e4692da806538c67dbe3f4849718a6a7e712fa105aff5ceb5135d0eececf75ab7281e171975bf8ae1ace932046621 +0 -1
  69. package/dist/templates/demo-store/.cache/content-v2/sha512/ae/d9/a6fed1d3e4f1cd165a5a4dc633dbf277ea6cb6089b239cde32fef7d5d041590c05216207b5d6ad6b81d02865ce06b41670751940fd49c43b6bc80efc0076 +0 -1
  70. package/dist/templates/demo-store/.cache/content-v2/sha512/b1/56/584dd264cd440a690eaaaef18f8837dd5a32415fad319adbb289121c1812bcd34dfed87f66cd6ba3b4bf26bc988de0b19c32a593609e5656c9d8cfbc1b2c +0 -1
  71. package/dist/templates/demo-store/.cache/content-v2/sha512/b5/32/0a7d091d5e19d604dfc1702a81918fb1e21a5263eec2c443e1b0cc3b51d95dc894883dd5bf6851e27dfaf8566a9752d9fc24698cf77fbd692897eb0fb189 +0 -1
  72. package/dist/templates/demo-store/.cache/content-v2/sha512/bc/33/6e26ece5ac53d9eac9ac8a192ef39faf2a587a5808253c659fb1d371c477fc8074d428c8d1929b0d85dd1fec66fc79ea6b9fcb01507e2efec75fb7fbc2cc +0 -1
  73. package/dist/templates/demo-store/.cache/content-v2/sha512/d8/b5/26061c660a6fb2a2cabd1f7dcf701c984788ed6329891d8d540fa01b9b8ad4cda43fc436b61c0d76b687f1600ad46b59ea52da003b1e7edb4472f74399cb +0 -1
  74. package/dist/templates/demo-store/.cache/content-v2/sha512/e2/ab/e085c7b7942344631033fca463b3da5f58bb80e3a7f9e52140bb4ef3a46e1f10bb8aa1dbc401bec8718939075060c8acaf7a6e0b6e082f9b83f5a4590296 +0 -1
  75. package/dist/templates/demo-store/.cache/content-v2/sha512/e5/41/1521ee52031bdb29b551344ea7b79161701bfd506f12776bd0aca74255c38adae35405e44958ce8c6807f0a290e48aac6e28eb540dad3e62ae59dc487a8b +0 -1
  76. package/dist/templates/demo-store/.cache/content-v2/sha512/e8/ae/9b467e1d23913d4584d9417875b3cdc25f6dfed8b228f3a0c818129010b778aae1af1eb200b015ab428e79afe0ef1061262392fbdb96ed7da95efbe7f758 +0 -1
  77. package/dist/templates/demo-store/.cache/content-v2/sha512/ea/40/1c04ae276d1792713cf3118f13f0d73df08b3604b039412073447f7410c95a2a6567aca59d31b263cb9119085fba85d208f25b71b3c96ef151f418b7cd48 +0 -1
  78. package/dist/templates/demo-store/.cache/content-v2/sha512/ec/9a/4e2483d9a13faadd1cbcfe0ab70cdf87a838fe1cf04d11c56c478472e08f5b9e785654654d9b338c051fd762d20e23f14f2c1e110664815f1012c3ab8a08 +0 -1
  79. package/dist/templates/demo-store/.cache/content-v2/sha512/f0/62/eca4034f805cff0ae6d9c9f08128afa5e9bc40f2177b2ff2e8625187e02b6219e9b049300d2a90c7fe947873483161a8b2b040c1cd376d908a7e3e4cb8bf +0 -1
  80. package/dist/templates/demo-store/.cache/content-v2/sha512/f2/5f/9ccdef519bdb0a99e4f88d4c2c5a2acd4bf79507c81e4403263a875f093ad8d04dd863c4d610426a2974a4f95713c0cd9f29d06b294a6960c2cabffa6c42 +0 -1
  81. package/dist/templates/demo-store/.cache/content-v2/sha512/f4/ca/0f5ba83b2d5596d6f5917cab8ecedc1a457d62bf4988914f35161e4a4bd39a85030d1f69e2da82d9c2652985f7ca7c8ec2e79fe0235d534911543090b3c5 +0 -1
  82. package/dist/templates/demo-store/.cache/index-v5/05/44/bebd201ef5e9e9a7c41bd789ff110691a32c7f7fbbbdd630f33d96667cd1 +0 -2
  83. package/dist/templates/demo-store/.cache/index-v5/26/b5/113aeb17f9f4ef406a1f8b143895199ca545fd0cc1e7972435a092910963 +0 -2
  84. package/dist/templates/demo-store/.cache/index-v5/2c/09/e60b5cd818510e0cbec908aae3b74175e35e446f4383e87c21489433a11e +0 -2
  85. package/dist/templates/demo-store/.cache/index-v5/38/21/c3fb7841590b85142018ba88a01045ef1249ac34211342579f0129eae294 +0 -2
  86. package/dist/templates/demo-store/.cache/index-v5/3a/98/8858fe7de4bf85d37c71adc322cc95335b498bef9a4ae41db324bf5696cc +0 -2
  87. package/dist/templates/demo-store/.cache/index-v5/3e/40/7021422a7cae2c05484b491fb5b85edd82b325e598ac9e5c6afb858049da +0 -2
  88. package/dist/templates/demo-store/.cache/index-v5/47/2f/8e9ec62247eca3464d07de774855bb30a56145adc6525b907490e0c1bda0 +0 -2
  89. package/dist/templates/demo-store/.cache/index-v5/5e/83/14bed234cd143eaf4043de721fcf4250a5adc7008e76d663365e8a322c88 +0 -2
  90. package/dist/templates/demo-store/.cache/index-v5/5f/87/f79366b4aab5423acdda7930c6c989c49dd1c6607885df3afaa5e6873c9f +0 -2
  91. package/dist/templates/demo-store/.cache/index-v5/6e/9e/dc622ea9b5c66089a08f3e8b7a0e62a29e85bab337da0a3b28d6126185ec +0 -2
  92. package/dist/templates/demo-store/.cache/index-v5/71/4c/401eb7f3b2db5e56857a3ddd90e61181e636a5d01cc569ff8671ddf7f14b +0 -2
  93. package/dist/templates/demo-store/.cache/index-v5/79/2e/b0dd8fcd37a11ecb71cfd33184651560cabda672e55e0b244fc6f825190c +0 -2
  94. package/dist/templates/demo-store/.cache/index-v5/7b/e1/807e64f6a84e568bf9163283e9d49b77b24ff24bd8eed751d9fd94ea404a +0 -2
  95. package/dist/templates/demo-store/.cache/index-v5/85/07/e0c4be5b8442583f11be2d0b6f09171d22721437456b745eb2c977294995 +0 -2
  96. package/dist/templates/demo-store/.cache/index-v5/87/4d/89bc172664efe0dc7f86d8e67559073b2900ae079bd42ae9e3c015d38ab0 +0 -2
  97. package/dist/templates/demo-store/.cache/index-v5/8c/0d/a633a8771437b330d83eef0fdd99a81c41356b2bdc81f80ec9277f92b060 +0 -2
  98. package/dist/templates/demo-store/.cache/index-v5/a3/fc/e2e503290d165b9b0e20c6880bc23ff8ec39a440482418b5103c36be66b9 +0 -2
  99. package/dist/templates/demo-store/.cache/index-v5/a5/bc/d87ab9468457cb872d6c360f8acecd05e0f88b7239b50754f120706fabd4 +0 -2
  100. package/dist/templates/demo-store/.cache/index-v5/a5/c0/8e6e4f498a17b6198e54f204247ba544e6404b282d4ce3065d85fa69a8a4 +0 -2
  101. package/dist/templates/demo-store/.cache/index-v5/af/65/89b0c9eb41779c1658ace443604fea125c524bc95cfc71c9b6300da2dc81 +0 -2
  102. package/dist/templates/demo-store/.cache/index-v5/b2/75/51549baf010c977c70017db497fd9bd20e1efa9b658a6d52761c559f9c0b +0 -2
  103. package/dist/templates/demo-store/.cache/index-v5/bb/db/9dc2cbdcdc6ff352f9a34463a02e198aa2123a4c2e4ef37fea8b8ccae413 +0 -2
  104. package/dist/templates/demo-store/.cache/index-v5/c8/52/09bfbca72b45aec745fc339c27986edefa85e40bd69113275a6ecd6495e9 +0 -2
  105. package/dist/templates/demo-store/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +0 -2
  106. package/dist/templates/demo-store/.cache/index-v5/d3/ca/ff5860148f0bedafb91dab72b54462de81a32a21210324c45a051b197b48 +0 -2
  107. package/dist/templates/demo-store/.cache/index-v5/d4/55/296e80e87e2652f4cf1aebd5419fe73ef16c94ab20cd0400166d44ea1746 +0 -2
  108. package/dist/templates/demo-store/.cache/index-v5/da/7a/4b6977be684885e550a0d8fd21c955d0195371ffc3a9535a5a7b950a5ac9 +0 -2
  109. package/dist/templates/demo-store/.cache/index-v5/dd/aa/599a1cd855476ba058c63ae75a9c006ca11f7fbc2efc00b361d7f1b95cb4 +0 -2
  110. package/dist/templates/demo-store/.cache/index-v5/df/d2/bcfa3853e61309abab85dbd561dbc632ad0ea79b24f1b77c95f861eead5f +0 -2
  111. package/dist/templates/demo-store/.cache/index-v5/df/f5/cc3a1197c607eac768ab1b1cdb7b53a7f87b67c23c92da957d45a5bd0bda +0 -2
  112. package/dist/templates/demo-store/.cache/index-v5/e4/bd/743967c269ef70a14ba6b5dd223d26759eae9295d79f165c66f514b7d8d3 +0 -2
  113. package/dist/templates/demo-store/.editorconfig +0 -8
  114. package/dist/templates/demo-store/.eslintignore +0 -4
  115. package/dist/templates/demo-store/.eslintrc.js +0 -16
  116. package/dist/templates/demo-store/.graphqlrc.yml +0 -1
  117. package/dist/templates/demo-store/.prettierignore +0 -2
  118. package/dist/templates/demo-store/_env +0 -6
  119. package/dist/templates/demo-store/_gitignore +0 -9
  120. package/dist/templates/demo-store/app/components/AccountAddressBook.tsx +0 -97
  121. package/dist/templates/demo-store/app/components/AccountDetails.tsx +0 -41
  122. package/dist/templates/demo-store/app/components/AddToCartButton.tsx +0 -42
  123. package/dist/templates/demo-store/app/components/Breadcrumbs.tsx +0 -36
  124. package/dist/templates/demo-store/app/components/Button.tsx +0 -56
  125. package/dist/templates/demo-store/app/components/Cart.tsx +0 -431
  126. package/dist/templates/demo-store/app/components/CartLoading.tsx +0 -50
  127. package/dist/templates/demo-store/app/components/CountrySelector.tsx +0 -180
  128. package/dist/templates/demo-store/app/components/Drawer.tsx +0 -115
  129. package/dist/templates/demo-store/app/components/FeaturedCollections.tsx +0 -54
  130. package/dist/templates/demo-store/app/components/FeaturedProducts.tsx +0 -116
  131. package/dist/templates/demo-store/app/components/FeaturedSection.tsx +0 -36
  132. package/dist/templates/demo-store/app/components/GenericError.tsx +0 -58
  133. package/dist/templates/demo-store/app/components/Grid.tsx +0 -44
  134. package/dist/templates/demo-store/app/components/Hero.tsx +0 -129
  135. package/dist/templates/demo-store/app/components/Icon.tsx +0 -253
  136. package/dist/templates/demo-store/app/components/Input.tsx +0 -24
  137. package/dist/templates/demo-store/app/components/Layout.tsx +0 -499
  138. package/dist/templates/demo-store/app/components/Link.tsx +0 -46
  139. package/dist/templates/demo-store/app/components/Modal.tsx +0 -46
  140. package/dist/templates/demo-store/app/components/NotFound.tsx +0 -22
  141. package/dist/templates/demo-store/app/components/OrderCard.tsx +0 -82
  142. package/dist/templates/demo-store/app/components/Pagination.tsx +0 -277
  143. package/dist/templates/demo-store/app/components/ProductCard.tsx +0 -132
  144. package/dist/templates/demo-store/app/components/ProductGallery.tsx +0 -114
  145. package/dist/templates/demo-store/app/components/ProductGrid.tsx +0 -90
  146. package/dist/templates/demo-store/app/components/ProductSwimlane.tsx +0 -30
  147. package/dist/templates/demo-store/app/components/Skeleton.tsx +0 -24
  148. package/dist/templates/demo-store/app/components/SortFilter.tsx +0 -414
  149. package/dist/templates/demo-store/app/components/Text.tsx +0 -192
  150. package/dist/templates/demo-store/app/components/index.ts +0 -28
  151. package/dist/templates/demo-store/app/data/countries.ts +0 -194
  152. package/dist/templates/demo-store/app/data/fragments.ts +0 -73
  153. package/dist/templates/demo-store/app/entry.client.tsx +0 -4
  154. package/dist/templates/demo-store/app/entry.server.tsx +0 -26
  155. package/dist/templates/demo-store/app/hooks/useCartFetchers.tsx +0 -14
  156. package/dist/templates/demo-store/app/hooks/useIsHydrated.tsx +0 -12
  157. package/dist/templates/demo-store/app/lib/const.ts +0 -10
  158. package/dist/templates/demo-store/app/lib/placeholders.ts +0 -244
  159. package/dist/templates/demo-store/app/lib/session.server.ts +0 -57
  160. package/dist/templates/demo-store/app/lib/type.ts +0 -21
  161. package/dist/templates/demo-store/app/lib/utils.ts +0 -310
  162. package/dist/templates/demo-store/app/root.tsx +0 -360
  163. package/dist/templates/demo-store/app/routes/($lang)/$.tsx +0 -7
  164. package/dist/templates/demo-store/app/routes/($lang)/[sitemap.xml].tsx +0 -198
  165. package/dist/templates/demo-store/app/routes/($lang)/account/__private/address/$id.tsx +0 -417
  166. package/dist/templates/demo-store/app/routes/($lang)/account/__private/edit.tsx +0 -295
  167. package/dist/templates/demo-store/app/routes/($lang)/account/__private/logout.ts +0 -25
  168. package/dist/templates/demo-store/app/routes/($lang)/account/__private/orders.$id.tsx +0 -442
  169. package/dist/templates/demo-store/app/routes/($lang)/account/__public/activate.$id.$activationToken.tsx +0 -249
  170. package/dist/templates/demo-store/app/routes/($lang)/account/__public/login.tsx +0 -247
  171. package/dist/templates/demo-store/app/routes/($lang)/account/__public/recover.tsx +0 -160
  172. package/dist/templates/demo-store/app/routes/($lang)/account/__public/register.tsx +0 -214
  173. package/dist/templates/demo-store/app/routes/($lang)/account/__public/reset.$id.$resetToken.tsx +0 -246
  174. package/dist/templates/demo-store/app/routes/($lang)/account.tsx +0 -300
  175. package/dist/templates/demo-store/app/routes/($lang)/api/countries.tsx +0 -22
  176. package/dist/templates/demo-store/app/routes/($lang)/api/products.tsx +0 -85
  177. package/dist/templates/demo-store/app/routes/($lang)/cart.tsx +0 -510
  178. package/dist/templates/demo-store/app/routes/($lang)/collections/$collectionHandle.tsx +0 -303
  179. package/dist/templates/demo-store/app/routes/($lang)/collections/all.tsx +0 -5
  180. package/dist/templates/demo-store/app/routes/($lang)/collections/index.tsx +0 -194
  181. package/dist/templates/demo-store/app/routes/($lang)/discounts.$code.tsx +0 -60
  182. package/dist/templates/demo-store/app/routes/($lang)/featured-products.tsx +0 -58
  183. package/dist/templates/demo-store/app/routes/($lang)/index.tsx +0 -270
  184. package/dist/templates/demo-store/app/routes/($lang)/journal/$journalHandle.tsx +0 -145
  185. package/dist/templates/demo-store/app/routes/($lang)/journal/index.tsx +0 -149
  186. package/dist/templates/demo-store/app/routes/($lang)/pages/$pageHandle.tsx +0 -74
  187. package/dist/templates/demo-store/app/routes/($lang)/policies/$policyHandle.tsx +0 -116
  188. package/dist/templates/demo-store/app/routes/($lang)/policies/index.tsx +0 -92
  189. package/dist/templates/demo-store/app/routes/($lang)/products/$productHandle.tsx +0 -594
  190. package/dist/templates/demo-store/app/routes/($lang)/products/index.tsx +0 -146
  191. package/dist/templates/demo-store/app/routes/($lang)/search.tsx +0 -198
  192. package/dist/templates/demo-store/app/routes/[robots.txt].tsx +0 -40
  193. package/dist/templates/demo-store/app/styles/app.css +0 -4117
  194. package/dist/templates/demo-store/app/styles/custom-font.css +0 -13
  195. package/dist/templates/demo-store/app/styles/fonts/IBMPlexSerif-Text.woff2 +0 -0
  196. package/dist/templates/demo-store/app/styles/fonts/IBMPlexSerif-TextItalic.woff2 +0 -0
  197. package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
  198. package/dist/templates/demo-store/dist/client/build/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
  199. package/dist/templates/demo-store/dist/client/build/_assets/app-5V46SKC6.css +0 -1
  200. package/dist/templates/demo-store/dist/client/build/_assets/custom-font-WVPOFKHF.css +0 -1
  201. package/dist/templates/demo-store/dist/client/build/_assets/favicon-5FIZBM2K.svg +0 -28
  202. package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js +0 -2
  203. package/dist/templates/demo-store/dist/client/build/_shared/chunk-2JM6VWTP.js.map +0 -7
  204. package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js +0 -9
  205. package/dist/templates/demo-store/dist/client/build/_shared/chunk-3RDIRS72.js.map +0 -7
  206. package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js +0 -2
  207. package/dist/templates/demo-store/dist/client/build/_shared/chunk-AYHDHSL7.js.map +0 -7
  208. package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js +0 -2
  209. package/dist/templates/demo-store/dist/client/build/_shared/chunk-E5DM2WN5.js.map +0 -7
  210. package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js +0 -31
  211. package/dist/templates/demo-store/dist/client/build/_shared/chunk-EGF7BKAH.js.map +0 -7
  212. package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js +0 -2
  213. package/dist/templates/demo-store/dist/client/build/_shared/chunk-MEPKJ2VW.js.map +0 -7
  214. package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js +0 -72
  215. package/dist/templates/demo-store/dist/client/build/_shared/chunk-N73MA4O3.js.map +0 -7
  216. package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js +0 -2
  217. package/dist/templates/demo-store/dist/client/build/_shared/chunk-S5VPOIXA.js.map +0 -7
  218. package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js +0 -7
  219. package/dist/templates/demo-store/dist/client/build/_shared/chunk-SJXYTHYC.js.map +0 -7
  220. package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js +0 -25
  221. package/dist/templates/demo-store/dist/client/build/_shared/chunk-W7NVY25S.js.map +0 -7
  222. package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js +0 -2
  223. package/dist/templates/demo-store/dist/client/build/_shared/chunk-YU4DAQHP.js.map +0 -7
  224. package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js +0 -2
  225. package/dist/templates/demo-store/dist/client/build/_shared/log-seo-tags-3MQL2PTY-EVG3H53P.js.map +0 -7
  226. package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js +0 -2
  227. package/dist/templates/demo-store/dist/client/build/entry.client-OO4LDNWK.js.map +0 -7
  228. package/dist/templates/demo-store/dist/client/build/manifest-1AF0BBA5.js +0 -1
  229. package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js +0 -3
  230. package/dist/templates/demo-store/dist/client/build/root-FV6LPUDT.js.map +0 -7
  231. package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js +0 -2
  232. package/dist/templates/demo-store/dist/client/build/routes/($lang)/$-HDBACFGJ.js.map +0 -7
  233. package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js +0 -2
  234. package/dist/templates/demo-store/dist/client/build/routes/($lang)/[sitemap.xml]-AAQRJL2R.js.map +0 -7
  235. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js +0 -2
  236. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/address/$id-EQYOPKPY.js.map +0 -7
  237. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js +0 -2
  238. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/edit-YM3NVGDL.js.map +0 -7
  239. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js +0 -2
  240. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/logout-7KXWFBCX.js.map +0 -7
  241. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js +0 -2
  242. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__private/orders.$id-QODJFNZS.js.map +0 -7
  243. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js +0 -2
  244. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/activate.$id.$activationToken-VQ76BWT7.js.map +0 -7
  245. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js +0 -2
  246. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/login-IRZTYHQF.js.map +0 -7
  247. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js +0 -2
  248. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/recover-4VLNDEUK.js.map +0 -7
  249. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js +0 -2
  250. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/register-6GG4XAMH.js.map +0 -7
  251. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js +0 -2
  252. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account/__public/reset.$id.$resetToken-SIXY5J2S.js.map +0 -7
  253. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js +0 -2
  254. package/dist/templates/demo-store/dist/client/build/routes/($lang)/account-G7FQFZFP.js.map +0 -7
  255. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js +0 -2
  256. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/countries-UD6BGYL2.js.map +0 -7
  257. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js +0 -18
  258. package/dist/templates/demo-store/dist/client/build/routes/($lang)/api/products-Y2SK2JNE.js.map +0 -7
  259. package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js +0 -55
  260. package/dist/templates/demo-store/dist/client/build/routes/($lang)/cart-TFONAIOG.js.map +0 -7
  261. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js +0 -83
  262. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/$collectionHandle-HSKYTXMD.js.map +0 -7
  263. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js +0 -2
  264. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/all-IXDFOKCK.js.map +0 -7
  265. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js +0 -2
  266. package/dist/templates/demo-store/dist/client/build/routes/($lang)/collections/index-RXXMMLNQ.js.map +0 -7
  267. package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js +0 -2
  268. package/dist/templates/demo-store/dist/client/build/routes/($lang)/discounts.$code-GYKQBNLQ.js.map +0 -7
  269. package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js +0 -2
  270. package/dist/templates/demo-store/dist/client/build/routes/($lang)/featured-products-KNUST6DD.js.map +0 -7
  271. package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js +0 -59
  272. package/dist/templates/demo-store/dist/client/build/routes/($lang)/index-DZYZ23DT.js.map +0 -7
  273. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js +0 -2
  274. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/$journalHandle-BFPXMHRY.js.map +0 -7
  275. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js +0 -2
  276. package/dist/templates/demo-store/dist/client/build/routes/($lang)/journal/index-TVV6RNDT.js.map +0 -7
  277. package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js +0 -2
  278. package/dist/templates/demo-store/dist/client/build/routes/($lang)/pages/$pageHandle-2JU4FDNU.js.map +0 -7
  279. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js +0 -2
  280. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/$policyHandle-B2JUECEA.js.map +0 -7
  281. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js +0 -2
  282. package/dist/templates/demo-store/dist/client/build/routes/($lang)/policies/index-DKYSL4RX.js.map +0 -7
  283. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js +0 -102
  284. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/$productHandle-CSUUFYMX.js.map +0 -7
  285. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js +0 -24
  286. package/dist/templates/demo-store/dist/client/build/routes/($lang)/products/index-VAQVPD22.js.map +0 -7
  287. package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js +0 -54
  288. package/dist/templates/demo-store/dist/client/build/routes/($lang)/search-UVGUQAJG.js.map +0 -7
  289. package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js +0 -2
  290. package/dist/templates/demo-store/dist/client/build/routes/[robots.txt]-YG62MDLB.js.map +0 -7
  291. package/dist/templates/demo-store/dist/client/favicon.svg +0 -28
  292. package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-Text-YFMZNZW6.woff2 +0 -0
  293. package/dist/templates/demo-store/dist/worker/_assets/IBMPlexSerif-TextItalic-CS6L5H7S.woff2 +0 -0
  294. package/dist/templates/demo-store/dist/worker/index.js +0 -1352
  295. package/dist/templates/demo-store/dist/worker/index.js.map +0 -7
  296. package/dist/templates/demo-store/package.json +0 -64
  297. package/dist/templates/demo-store/postcss.config.js +0 -10
  298. package/dist/templates/demo-store/public/favicon.svg +0 -28
  299. package/dist/templates/demo-store/remix.env.d.ts +0 -40
  300. package/dist/templates/demo-store/remix.init/index.js +0 -25
  301. package/dist/templates/demo-store/remix.init/package.json +0 -7
  302. package/dist/templates/demo-store/server.ts +0 -73
  303. package/dist/templates/demo-store/styles/app.css +0 -182
  304. package/dist/templates/demo-store/tailwind.config.js +0 -70
  305. package/dist/templates/demo-store/tsconfig.json +0 -25
  306. package/dist/templates/hello-world/.cache/content-v2/sha512/13/4d/016017e6bcf9be61273229516bd898b7df8dad06121807f9b80f1e2acca7e9790dcc476d08b81a899d8d29d38331b4a459d66f3c7f9dc4303ca2fcc167b7 +0 -1
  307. package/dist/templates/hello-world/.cache/content-v2/sha512/99/79/957d59c381e42c01e473b69a7befabebff88d7ae53269b038a7aca4993e3e773e6a1144223532f089df44c4d866af69317389a969681566e3e71ef5e023c +0 -1
  308. package/dist/templates/hello-world/.cache/index-v5/09/f6/fe4b05c4157320b8b59b3f84116195be0437d87357d743d21acd638a4606 +0 -2
  309. package/dist/templates/hello-world/.cache/index-v5/d0/c4/d960260ece228d28f70e317741b3f3f3df05c53956d870235837ae2b73b4 +0 -2
  310. package/dist/templates/hello-world/.eslintignore +0 -4
  311. package/dist/templates/hello-world/.eslintrc.js +0 -6
  312. package/dist/templates/hello-world/.graphqlrc.yml +0 -1
  313. package/dist/templates/hello-world/README.md +0 -20
  314. package/dist/templates/hello-world/_env +0 -6
  315. package/dist/templates/hello-world/_gitignore +0 -8
  316. package/dist/templates/hello-world/app/components/Layout.tsx +0 -43
  317. package/dist/templates/hello-world/app/components/index.ts +0 -1
  318. package/dist/templates/hello-world/app/entry.client.tsx +0 -4
  319. package/dist/templates/hello-world/app/entry.server.tsx +0 -21
  320. package/dist/templates/hello-world/app/root.tsx +0 -104
  321. package/dist/templates/hello-world/app/routes/index.tsx +0 -16
  322. package/dist/templates/hello-world/app/styles/app.css +0 -38
  323. package/dist/templates/hello-world/dist/client/build/_assets/app-NBPUE4H5.css +0 -1
  324. package/dist/templates/hello-world/dist/client/build/_assets/favicon-5FIZBM2K.svg +0 -28
  325. package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js +0 -31
  326. package/dist/templates/hello-world/dist/client/build/_shared/chunk-AEML26BQ.js.map +0 -7
  327. package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js +0 -2
  328. package/dist/templates/hello-world/dist/client/build/_shared/chunk-RKJPHUBS.js.map +0 -7
  329. package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js +0 -9
  330. package/dist/templates/hello-world/dist/client/build/entry.client-ZGMV2YX5.js.map +0 -7
  331. package/dist/templates/hello-world/dist/client/build/manifest-8ABA8B0B.js +0 -1
  332. package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js +0 -2
  333. package/dist/templates/hello-world/dist/client/build/root-HK7BXYY5.js.map +0 -7
  334. package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js +0 -2
  335. package/dist/templates/hello-world/dist/client/build/routes/index-YNIEU6B3.js.map +0 -7
  336. package/dist/templates/hello-world/dist/client/favicon.svg +0 -28
  337. package/dist/templates/hello-world/dist/worker/index.js +0 -68
  338. package/dist/templates/hello-world/dist/worker/index.js.map +0 -7
  339. package/dist/templates/hello-world/package.json +0 -42
  340. package/dist/templates/hello-world/public/favicon.svg +0 -28
  341. package/dist/templates/hello-world/remix.env.d.ts +0 -35
  342. package/dist/templates/hello-world/remix.init/index.js +0 -25
  343. package/dist/templates/hello-world/remix.init/package.json +0 -7
  344. package/dist/templates/hello-world/server.ts +0 -129
  345. package/dist/templates/hello-world/tsconfig.json +0 -25
  346. package/dist/tmp-create-app.js +0 -33
@@ -0,0 +1,23 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ declare class Build extends Command {
5
+ static description: string;
6
+ static flags: {
7
+ entry: _oclif_core_lib_interfaces_parser_js.OptionFlag<string>;
8
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
9
+ sourcemap: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
10
+ "disable-route-warning": _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+ declare function runBuild({ entry, path: appPath, sourcemap, disableRouteWarning, }: {
15
+ entry: string;
16
+ path?: string;
17
+ sourcemap?: boolean;
18
+ disableRouteWarning?: boolean;
19
+ }): Promise<void>;
20
+ declare function copyPublicFiles(publicPath: string, buildPathClient: string): Promise<void>;
21
+ declare function assertEntryFileExists(filePath: string): Promise<void>;
22
+
23
+ export { assertEntryFileExists, copyPublicFiles, Build as default, runBuild };
@@ -1,8 +1,9 @@
1
1
  import path from 'path';
2
- import { output } from '@shopify/cli-kit';
2
+ import { file, output } from '@shopify/cli-kit';
3
3
  import colors from '@shopify/cli-kit/node/colors';
4
+ import { renderFatalError } from '@shopify/cli-kit/node/ui';
4
5
  import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
5
- import { commonFlags } from '../../utils/flags.js';
6
+ import { commonFlags, flagsToCamelObject } from '../../utils/flags.js';
6
7
  import Command from '@shopify/cli-kit/node/base-command';
7
8
  import Flags from '@oclif/core/lib/flags.js';
8
9
  import { checkLockfileStatus } from '../../utils/check-lockfile.js';
@@ -10,25 +11,24 @@ import { findMissingRoutes } from '../../utils/missing-routes.js';
10
11
 
11
12
  const LOG_WORKER_BUILT = "\u{1F4E6} Worker built";
12
13
  class Build extends Command {
13
- static description = "Builds a Hydrogen storefront for production";
14
+ static description = "Builds a Hydrogen storefront for production.";
14
15
  static flags = {
15
- ...commonFlags,
16
+ entry: commonFlags.entry,
17
+ path: commonFlags.path,
16
18
  sourcemap: Flags.boolean({
17
- env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP"
18
- }),
19
- entry: Flags.string({
19
+ description: "Generate sourcemaps for the build.",
20
20
  env: "SHOPIFY_HYDROGEN_FLAG_SOURCEMAP",
21
- required: true
21
+ default: true
22
22
  }),
23
- disableRouteWarning: Flags.boolean({
24
- description: "Disable warning about missing standard routes",
23
+ ["disable-route-warning"]: Flags.boolean({
24
+ description: "Disable warning about missing standard routes.",
25
25
  env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_ROUTE_WARNING"
26
26
  })
27
27
  };
28
28
  async run() {
29
29
  const { flags } = await this.parse(Build);
30
30
  const directory = flags.path ? path.resolve(flags.path) : process.cwd();
31
- await runBuild({ ...flags, path: directory });
31
+ await runBuild({ ...flagsToCamelObject(flags), path: directory });
32
32
  }
33
33
  }
34
34
  async function runBuild({
@@ -48,12 +48,12 @@ async function runBuild({
48
48
  buildPathWorkerFile,
49
49
  publicPath
50
50
  } = getProjectPaths(appPath, entry);
51
+ await assertEntryFileExists(entryFile);
51
52
  await checkLockfileStatus(root);
52
53
  console.time(LOG_WORKER_BUILT);
53
- const { default: fsExtra } = await import('fs-extra');
54
54
  const [remixConfig] = await Promise.all([
55
55
  getRemixConfig(root, entryFile, publicPath),
56
- fsExtra.rm(buildPath, { force: true, recursive: true })
56
+ file.rmdir(buildPath, { force: true })
57
57
  ]);
58
58
  output.info(`
59
59
  \u{1F3D7}\uFE0F Building in ${process.env.NODE_ENV} mode...`);
@@ -72,8 +72,7 @@ async function runBuild({
72
72
  ]);
73
73
  if (process.env.NODE_ENV !== "development") {
74
74
  console.timeEnd(LOG_WORKER_BUILT);
75
- const { size } = await fsExtra.stat(buildPathWorkerFile);
76
- const sizeMB = size / (1024 * 1024);
75
+ const sizeMB = await file.size(buildPathWorkerFile) / (1024 * 1024);
77
76
  output.info(
78
77
  output.content` ${colors.dim(
79
78
  path.relative(root, buildPathWorkerFile)
@@ -96,11 +95,29 @@ async function runBuild({
96
95
  process.exit(0);
97
96
  }
98
97
  async function copyPublicFiles(publicPath, buildPathClient) {
99
- const { default: fsExtra } = await import('fs-extra');
100
- return fsExtra.copy(publicPath, buildPathClient, {
101
- recursive: true,
102
- overwrite: true
103
- });
98
+ return file.copy(publicPath, buildPathClient);
99
+ }
100
+ async function assertEntryFileExists(filePath) {
101
+ const exists = await file.exists(filePath);
102
+ if (!exists) {
103
+ if (!path.extname(filePath)) {
104
+ const { readdir } = await import('fs/promises');
105
+ const files = await readdir(path.dirname(filePath));
106
+ const exists2 = files.some((file2) => {
107
+ const { name, ext } = path.parse(file2);
108
+ return name === path.basename(filePath) && /^\.[jt]s$/.test(ext);
109
+ });
110
+ if (exists2)
111
+ return;
112
+ }
113
+ renderFatalError({
114
+ name: "FileNotFound",
115
+ type: 0,
116
+ message: "Entry file not found",
117
+ tryMessage: "Ensure the file exists and pass the correct path with the --entry flag"
118
+ });
119
+ process.exit(1);
120
+ }
104
121
  }
105
122
 
106
- export { copyPublicFiles, Build as default, runBuild };
123
+ export { assertEntryFileExists, copyPublicFiles, Build as default, runBuild };
@@ -0,0 +1,18 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ declare class GenerateRoute extends Command {
5
+ static description: string;
6
+ static flags: {
7
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
8
+ };
9
+ static args: {
10
+ name: string;
11
+ description: string;
12
+ required: boolean;
13
+ options: string[];
14
+ }[];
15
+ run(): Promise<void>;
16
+ }
17
+
18
+ export { GenerateRoute as default };
@@ -5,6 +5,7 @@ import { getRemixConfig } from '../../utils/config.js';
5
5
  import { logMissingRoutes, findMissingRoutes } from '../../utils/missing-routes.js';
6
6
 
7
7
  class GenerateRoute extends Command {
8
+ static description = "Returns diagnostic information about a Hydrogen storefront.";
8
9
  static flags = {
9
10
  path: commonFlags.path
10
11
  };
@@ -0,0 +1,21 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ declare class Dev extends Command {
5
+ static description: string;
6
+ static flags: {
7
+ entry: _oclif_core_lib_interfaces_parser_js.OptionFlag<string>;
8
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
9
+ port: _oclif_core_lib_interfaces_parser_js.OptionFlag<number>;
10
+ "disable-virtual-routes": _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+ declare function runDev({ entry, port, path: appPath, disableVirtualRoutes, }: {
15
+ entry: string;
16
+ port?: number;
17
+ path?: string;
18
+ disableVirtualRoutes?: boolean;
19
+ }): Promise<void>;
20
+
21
+ export { Dev as default, runDev };
@@ -1,10 +1,10 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs/promises';
3
3
  import { output } from '@shopify/cli-kit';
4
- import { copyPublicFiles } from './build.js';
4
+ import { assertEntryFileExists, copyPublicFiles } from './build.js';
5
5
  import { getProjectPaths, getRemixConfig } from '../../utils/config.js';
6
6
  import { muteDevLogs } from '../../utils/log.js';
7
- import { commonFlags } from '../../utils/flags.js';
7
+ import { commonFlags, flagsToCamelObject } from '../../utils/flags.js';
8
8
  import Command from '@shopify/cli-kit/node/base-command';
9
9
  import Flags from '@oclif/core/lib/flags.js';
10
10
  import { startMiniOxygen } from '../../utils/mini-oxygen.js';
@@ -15,19 +15,13 @@ const LOG_INITIAL_BUILD = "\n\u{1F3C1} Initial build";
15
15
  const LOG_REBUILDING = "\u{1F9F1} Rebuilding...";
16
16
  const LOG_REBUILT = "\u{1F680} Rebuilt";
17
17
  class Dev extends Command {
18
- static description = "Runs Hydrogen storefront in a MiniOxygen worker in development";
18
+ static description = "Runs Hydrogen storefront in an Oxygen worker for development.";
19
19
  static flags = {
20
- ...commonFlags,
21
- port: Flags.integer({
22
- description: "Port to run the preview server on",
23
- env: "SHOPIFY_HYDROGEN_FLAG_PORT",
24
- default: 3e3
25
- }),
26
- entry: Flags.string({
27
- env: "SHOPIFY_HYDROGEN_FLAG_ENTRY",
28
- required: true
29
- }),
30
- disableVirtualRoutes: Flags.boolean({
20
+ entry: commonFlags.entry,
21
+ path: commonFlags.path,
22
+ port: commonFlags.port,
23
+ ["disable-virtual-routes"]: Flags.boolean({
24
+ description: "Disable rendering fallback routes when a route file doesn't exist",
31
25
  env: "SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",
32
26
  default: false
33
27
  })
@@ -35,7 +29,7 @@ class Dev extends Command {
35
29
  async run() {
36
30
  const { flags } = await this.parse(Dev);
37
31
  const directory = flags.path ? path.resolve(flags.path) : process.cwd();
38
- await runDev({ ...flags, path: directory });
32
+ await runDev({ ...flagsToCamelObject(flags), path: directory });
39
33
  }
40
34
  }
41
35
  async function runDev({
@@ -52,6 +46,7 @@ async function runDev({
52
46
  async function compileAndWatch(entry, appPath, port, disableVirtualRoutes = false) {
53
47
  console.time(LOG_INITIAL_BUILD);
54
48
  const { root, entryFile, publicPath, buildPathClient, buildPathWorkerFile } = getProjectPaths(appPath, entry);
49
+ await assertEntryFileExists(entryFile);
55
50
  const checkingHydrogenVersion = checkHydrogenVersion(root);
56
51
  const copyingFiles = copyPublicFiles(publicPath, buildPathClient);
57
52
  const reloadConfig = async () => {
@@ -0,0 +1,33 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ interface Result {
5
+ operation: 'generated' | 'skipped' | 'overwritten';
6
+ }
7
+ declare class GenerateRoute extends Command {
8
+ static description: string;
9
+ static flags: {
10
+ adapter: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
11
+ typescript: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
12
+ force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
13
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
14
+ };
15
+ static hidden: true;
16
+ static args: {
17
+ name: string;
18
+ description: string;
19
+ required: boolean;
20
+ options: string[];
21
+ env: string;
22
+ }[];
23
+ run(): Promise<void>;
24
+ }
25
+ declare function runGenerate(route: string, { directory, typescript, force, adapter, templatesRoot, }: {
26
+ directory: string;
27
+ typescript?: boolean;
28
+ force?: boolean;
29
+ adapter?: string;
30
+ templatesRoot?: string;
31
+ }): Promise<Result>;
32
+
33
+ export { GenerateRoute as default, runGenerate };
@@ -1,10 +1,10 @@
1
1
  import Command from '@shopify/cli-kit/node/base-command';
2
- import { path, error, file, ui } from '@shopify/cli-kit';
2
+ import { path, file, ui } from '@shopify/cli-kit';
3
+ import { AbortError } from '@shopify/cli-kit/node/error';
3
4
  import { renderSuccess } from '@shopify/cli-kit/node/ui';
4
5
  import { commonFlags } from '../../../utils/flags.js';
5
6
  import Flags from '@oclif/core/lib/flags.js';
6
- import ts from 'typescript';
7
- import prettier from 'prettier';
7
+ import { transpileFile, format, resolveFormatConfig } from '../../../utils/transpile-ts.js';
8
8
 
9
9
  const ROUTE_MAP = {
10
10
  page: "/pages/$pageHandle",
@@ -18,22 +18,24 @@ const ROUTE_MAP = {
18
18
  };
19
19
  const ROUTES = [...Object.keys(ROUTE_MAP), "all"];
20
20
  class GenerateRoute extends Command {
21
+ static description = "Generates a standard Shopify route.";
21
22
  static flags = {
22
- path: commonFlags.path,
23
23
  adapter: Flags.string({
24
- description: "The Remix adapter for imports in the template (default: @shopify/remix-oxygen)",
24
+ description: "Remix adapter used in the route. The default is `@shopify/remix-oxygen`.",
25
25
  env: "SHOPIFY_HYDROGEN_FLAG_ADAPTER"
26
26
  }),
27
- force: Flags.boolean({
28
- char: "f",
29
- description: "Overwrite existing files",
30
- env: "SHOPIFY_HYDROGEN_FLAG_FORCE"
31
- })
27
+ typescript: Flags.boolean({
28
+ description: "Generate TypeScript files",
29
+ env: "SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"
30
+ }),
31
+ force: commonFlags.force,
32
+ path: commonFlags.path
32
33
  };
34
+ static hidden;
33
35
  static args = [
34
36
  {
35
37
  name: "route",
36
- description: `The route to generate a route for.`,
38
+ description: `The route to generate. One of ${ROUTES.join()}.`,
37
39
  required: true,
38
40
  options: ROUTES,
39
41
  env: "SHOPIFY_HYDROGEN_ARG_ROUTE"
@@ -46,13 +48,11 @@ class GenerateRoute extends Command {
46
48
  const { route } = args;
47
49
  const routePath = route === "all" ? Object.values(ROUTE_MAP).flat() : ROUTE_MAP[route];
48
50
  if (!routePath) {
49
- throw new error.Abort(
50
- `No template generator found for ${route}. Try one of ${ROUTES.join()}`
51
+ throw new AbortError(
52
+ `No route found for ${route}. Try one of ${ROUTES.join()}.`
51
53
  );
52
54
  }
53
- const isTypescript = await file.exists(
54
- path.join(directory, "tsconfig.json")
55
- );
55
+ const isTypescript = flags.typescript || await file.exists(path.join(directory, "tsconfig.json"));
56
56
  const routesArray = Array.isArray(routePath) ? routePath : [routePath];
57
57
  try {
58
58
  for (const item of routesArray) {
@@ -67,7 +67,7 @@ class GenerateRoute extends Command {
67
67
  );
68
68
  }
69
69
  } catch (err) {
70
- throw new error.Abort(err.message);
70
+ throw new AbortError(err.message);
71
71
  }
72
72
  const extension = isTypescript ? ".tsx" : ".jsx";
73
73
  const success = Array.from(result.values()).filter(
@@ -75,10 +75,13 @@ class GenerateRoute extends Command {
75
75
  );
76
76
  renderSuccess({
77
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")
78
+ body: {
79
+ list: {
80
+ items: Array.from(result.entries()).map(
81
+ ([path2, { operation }]) => `[${operation}] app/routes${path2}${extension}`
82
+ )
83
+ }
84
+ }
82
85
  });
83
86
  }
84
87
  }
@@ -89,8 +92,14 @@ async function runGenerate(route, {
89
92
  adapter,
90
93
  templatesRoot = new URL("../../../", import.meta.url).pathname
91
94
  }) {
95
+ let operation;
92
96
  const extension = typescript ? ".tsx" : ".jsx";
93
- const templatePath = path.join(templatesRoot, "templates", `${route}.tsx`);
97
+ const templatePath = path.join(
98
+ templatesRoot,
99
+ "generator-templates",
100
+ "routes",
101
+ `${route}.tsx`
102
+ );
94
103
  const destinationPath = path.join(
95
104
  directory,
96
105
  "app",
@@ -113,26 +122,23 @@ async function runGenerate(route, {
113
122
  choices: options
114
123
  }
115
124
  ]);
116
- return {
117
- operation: choice.value === "skip" ? "skipped" : "overwritten"
118
- };
125
+ operation = choice.value === "skip" ? "skipped" : "overwritten";
126
+ if (operation === "skipped") {
127
+ return { operation };
128
+ }
129
+ } else {
130
+ operation = "generated";
119
131
  }
120
132
  let templateContent = await file.read(templatePath);
121
133
  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);
134
+ const jsConfigPath = path.join(directory, "jsconfig.json");
135
+ const config = await file.exists(jsConfigPath) ? JSON.parse(
136
+ (await file.read(jsConfigPath, { encoding: "utf8" })).replace(
137
+ /^\s*\/\/.*$/gm,
138
+ ""
139
+ )
140
+ ) : void 0;
141
+ templateContent = transpileFile(templateContent, config?.compilerOptions);
136
142
  }
137
143
  if (adapter) {
138
144
  templateContent = templateContent.replace(
@@ -140,35 +146,18 @@ async function runGenerate(route, {
140
146
  adapter
141
147
  );
142
148
  }
143
- templateContent = await format(templateContent, destinationPath);
149
+ templateContent = format(
150
+ templateContent,
151
+ await resolveFormatConfig(destinationPath),
152
+ destinationPath
153
+ );
144
154
  if (!await file.exists(path.dirname(destinationPath))) {
145
155
  await file.mkdir(path.dirname(destinationPath));
146
156
  }
147
157
  await file.write(destinationPath, templateContent);
148
158
  return {
149
- operation: "generated"
159
+ operation
150
160
  };
151
161
  }
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
162
 
174
163
  export { GenerateRoute as default, runGenerate };
@@ -0,0 +1,16 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ declare class GenerateRoutes extends Command {
5
+ static description: string;
6
+ static hidden: true;
7
+ static flags: {
8
+ adapter: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
9
+ typescript: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
10
+ force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
11
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
15
+
16
+ export { GenerateRoutes as default };
@@ -0,0 +1,22 @@
1
+ import GenerateRoute from './route.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ class GenerateRoutes extends Command {
5
+ static description = "Generates all supported standard shopify routes.";
6
+ static hidden;
7
+ static flags = GenerateRoute.flags;
8
+ async run() {
9
+ const { flags } = await this.parse(GenerateRoutes);
10
+ await GenerateRoute.run([
11
+ "all",
12
+ ...Object.entries(flags).map(([name, value]) => {
13
+ if (value === true) {
14
+ return `--${name}`;
15
+ }
16
+ return `--${name}=${value}`;
17
+ })
18
+ ]);
19
+ }
20
+ }
21
+
22
+ export { GenerateRoutes as default };
@@ -0,0 +1,22 @@
1
+ import * as _oclif_core_lib_interfaces_parser_js from '@oclif/core/lib/interfaces/parser.js';
2
+ import Command from '@shopify/cli-kit/node/base-command';
3
+
4
+ declare class Init extends Command {
5
+ static description: string;
6
+ static flags: {
7
+ path: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
8
+ force: _oclif_core_lib_interfaces_parser_js.BooleanFlag<boolean>;
9
+ language: _oclif_core_lib_interfaces_parser_js.OptionFlag<string>;
10
+ template: _oclif_core_lib_interfaces_parser_js.OptionFlag<string | undefined>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+ declare function runInit(options?: {
15
+ path?: string;
16
+ template?: string;
17
+ language?: string;
18
+ token?: string;
19
+ force?: boolean;
20
+ }): Promise<void>;
21
+
22
+ export { Init as default, runInit };